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
This commit is contained in:
@@ -25,14 +25,11 @@ const vehiclesAPI = {
|
||||
data: [2021, 2022],
|
||||
};
|
||||
},
|
||||
sendCommand: async (vin, command, token) => {
|
||||
sendCommand: async (vin, command, parameters, token) => {
|
||||
return {
|
||||
vin, command,
|
||||
vin, command, parameters
|
||||
}
|
||||
},
|
||||
sendLog: async (vin, filter, token) => {
|
||||
return Object.assign(filter, {vin});
|
||||
},
|
||||
};
|
||||
|
||||
export default vehiclesAPI;
|
||||
|
||||
@@ -1,41 +1,68 @@
|
||||
const LockUnlockParams = [
|
||||
{
|
||||
value: "LOCK",
|
||||
label: "Lock",
|
||||
},
|
||||
{
|
||||
value: "UNLOCK",
|
||||
label: "Unlock",
|
||||
},
|
||||
];
|
||||
|
||||
const OpenCloseParams = [
|
||||
{
|
||||
value: "OPEN",
|
||||
label: "Open",
|
||||
},
|
||||
{
|
||||
value: "CLOSE",
|
||||
label: "Close",
|
||||
},
|
||||
];
|
||||
|
||||
const Commands = [{
|
||||
value: "LFRD",
|
||||
label: "Lock front right door",
|
||||
value: "LOG",
|
||||
label: "Log level",
|
||||
parameters: [
|
||||
{
|
||||
value: "INFO",
|
||||
label: "Info",
|
||||
},
|
||||
{
|
||||
value: "DEBUG",
|
||||
label: "Debug",
|
||||
},
|
||||
{
|
||||
value: "TRACE",
|
||||
label: "Trace",
|
||||
},
|
||||
],
|
||||
},{
|
||||
value: "UFRD",
|
||||
label: "Unlock front right door",
|
||||
value: "FRONT-RIGHT",
|
||||
label: "Front right door",
|
||||
parameters: LockUnlockParams,
|
||||
},{
|
||||
value: "LFLD",
|
||||
label: "Lock front left door",
|
||||
value: "FRONT-LEFT",
|
||||
label: "Front left door",
|
||||
parameters: LockUnlockParams,
|
||||
},{
|
||||
value: "UFLD",
|
||||
label: "Unlock front left door",
|
||||
value: "REAR-RIGHT",
|
||||
label: "Rear right door",
|
||||
parameters: LockUnlockParams,
|
||||
},{
|
||||
value: "LRRD",
|
||||
label: "Lock rear right door",
|
||||
value: "REAR-LEFT",
|
||||
label: "Rear left door",
|
||||
parameters: LockUnlockParams,
|
||||
},{
|
||||
value: "URRD",
|
||||
label: "Unlock rear right door",
|
||||
value: "TRUNK",
|
||||
label: "Trunk",
|
||||
parameters: LockUnlockParams,
|
||||
},{
|
||||
value: "LRLD",
|
||||
label: "Lock rear left door",
|
||||
value: "WINDOWS",
|
||||
label: "Windows",
|
||||
parameters: OpenCloseParams,
|
||||
},{
|
||||
value: "URLD",
|
||||
label: "Unlock rear left door",
|
||||
},{
|
||||
value: "LTRK",
|
||||
label: "Lock trunk",
|
||||
},{
|
||||
value: "UTRK",
|
||||
label: "Unlock trunk",
|
||||
},{
|
||||
value: "OWIN",
|
||||
label: "Open Windows",
|
||||
},{
|
||||
value: "CWIN",
|
||||
label: "Close Windows",
|
||||
},{
|
||||
value: "FLASH",
|
||||
value: "FLASH-HEADLIGHTS",
|
||||
label: "Flash headlights",
|
||||
}];
|
||||
|
||||
|
||||
@@ -31,22 +31,14 @@ const vehiclesAPI = {
|
||||
})
|
||||
.then(fetchRespHandler),
|
||||
|
||||
sendCommand: async (vin, command, token) => fetch(`${API_ENDPOINT}/vehiclecommand`, {
|
||||
sendCommand: async (vins, command, parameters, token) => fetch(`${API_ENDPOINT}/vehiclecommand`, {
|
||||
method: "POST",
|
||||
headers: Object.assign({ "Content-Type": "application/json" }, getAuthHeaderOptions(token)),
|
||||
body: JSON.stringify({
|
||||
vin, command,
|
||||
vins, command, parameters
|
||||
}),
|
||||
})
|
||||
.then(fetchRespHandler),
|
||||
|
||||
sendLog: async (vin, filter, token) => fetch(`${API_ENDPOINT}/vehiclelog`, {
|
||||
method: "POST",
|
||||
headers: Object.assign({ "Content-Type": "application/json" }, getAuthHeaderOptions(token)),
|
||||
body: JSON.stringify(Object.assign(filter, {vin})),
|
||||
})
|
||||
.then(fetchRespHandler),
|
||||
|
||||
};
|
||||
|
||||
export default vehiclesAPI;
|
||||
|
||||
Reference in New Issue
Block a user