Merge Development (#44)
* CEC-244 Remote car commands, search, sortable tables (#42) * Add sortable table header * Send bulk commands page Update table page sizes All tables are sortable * Update site layout Add search to update packages * Reenable Datadog * remove dev stuff * CEC-244 Add search (#43) * Add search to car send command page Add snapshot check
This commit is contained in:
@@ -4,12 +4,15 @@ const StatusContext = React.createContext();
|
||||
|
||||
export const StatusProvider = ({ children }) => {
|
||||
const [message, setMessage] = useState(null);
|
||||
const [title, setTitle] = useState("");
|
||||
|
||||
return (
|
||||
<StatusContext.Provider
|
||||
value={{
|
||||
message,
|
||||
setMessage,
|
||||
title,
|
||||
setTitle,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -84,10 +84,10 @@ export const VehicleProvider = ({ children }) => {
|
||||
}
|
||||
};
|
||||
|
||||
const sendCommand = async (vin, command, token) => {
|
||||
const sendCommand = async (vins, command, parameters, token) => {
|
||||
try {
|
||||
setBusy(true);
|
||||
const result = await api.sendCommand(vin, command, token);
|
||||
const result = await api.sendCommand(vins, command, parameters, token);
|
||||
if (result.error)
|
||||
throw new Error(`Send command error. ${result.message}`);
|
||||
return result;
|
||||
@@ -96,18 +96,6 @@ export const VehicleProvider = ({ children }) => {
|
||||
}
|
||||
};
|
||||
|
||||
const sendLogFilter = async (vin, filter, token) => {
|
||||
try {
|
||||
setBusy(true);
|
||||
const result = await api.sendLog(vin, filter, token);
|
||||
if (result.error)
|
||||
throw new Error(`Send log filter error. ${result.message}`);
|
||||
return result;
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<VehicleContext.Provider
|
||||
value={{
|
||||
@@ -121,7 +109,6 @@ export const VehicleProvider = ({ children }) => {
|
||||
getModels,
|
||||
getYears,
|
||||
sendCommand,
|
||||
sendLogFilter,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -25,13 +25,10 @@ export const useVehicleContext = () => ({
|
||||
getYears: jest.fn(() => {
|
||||
years = [2023, 2024];
|
||||
}),
|
||||
sendCommand: jest.fn((vin, command, token) => ({
|
||||
sendCommand: jest.fn((vin, command, parameters, token) => ({
|
||||
vin,
|
||||
command,
|
||||
})),
|
||||
sendLogFilter: jest.fn((vin, filter, token) => ({
|
||||
vin,
|
||||
filter,
|
||||
parameters,
|
||||
})),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user