CEC-3933 - use VehiclePaths for location drawing (#306)

* CEC-3933 - Parse VehiclePaths location data

* changes

* fixes

* stuff

* sort of works

* fix

* progress

* refactor

* fix vehicle paths query

* digital twin shows map

* new dashboard

* wider digital twin map

* snapshot

* latest; using polylines

* lag lng changes

* stuff

* path showing up

* stuff

* things

* revert home page

* whitespace

* validation

* more stuff

* fix button issue

* tests pass without mocking data

* fix code smells

* remove map from digital twin, add to tab

* fix bug

* marker click event working

* individual colors

* possible fix

* fix warning

* merge and remove unused code

* small fixes

* re add dashboard

* snaps
This commit is contained in:
Paul Adamsen
2023-04-28 16:56:41 -04:00
committed by GitHub
parent 8dfc516986
commit 55ae0f20b9
14 changed files with 1684 additions and 624 deletions

View File

@@ -88,7 +88,19 @@ export const VehicleProvider = ({ children }) => {
setBusy(true);
const result = await api.getLocations(token);
if (result.error)
throw new Error(`Get locations error. ${result.message}`);
throw new Error(`Get locations vehicle paths error. ${result.message}`);
return result;
} finally {
setBusy(false);
}
};
const getLocationsVehiclePaths = async (token, vinsParam) => {
try {
setBusy(true);
const result = await api.getLocationsVehiclePaths(token, vinsParam);
if (result.error)
throw new Error(`Get locations vehicle paths error. ${result.message}`);
return result;
} finally {
setBusy(false);
@@ -263,6 +275,7 @@ export const VehicleProvider = ({ children }) => {
getCANSignals,
getECUs,
getLocations,
getLocationsVehiclePaths,
getModels,
getState,
getYears,

View File

@@ -98,15 +98,14 @@ export const useVehicleContext = () => ({
vehicles,
years,
addVehicle: jest.fn(),
getConnections: jest.fn((vins, _token) => {
const result = {};
vins.forEach((vin) => {
result[vin] = true;
});
return result;
}),
getConnections: jest
.fn().mockImplementation((vins, _token) => {
const result = {};
vins.forEach((vin) => {
result[vin] = true;
});
return Promise.resolve(result);
}),
getECUs: jest.fn(() => {
return {
data: [
@@ -134,6 +133,13 @@ export const useVehicleContext = () => ({
.mockResolvedValue([
{ altitude: 5, longitude: 10, latitude: 15, vin: "TESTVIN123" },
]),
getLocationsVehiclePaths: jest
.fn()
.mockResolvedValue({
// tests only pass without mocking the data here
// '3FAFP13P31R199430': [[16.891136999999986, 26.832352999999955], [56.891136999999986, 66.832352999999955], [26.891136999999986, 36.832352999999955]],
// '3FAFP13P71R199060': [[36.891136999999986, 46.832352999999955], [76.891136999999986, 16.832352999999955]],
}),
getModels: jest.fn(() => {
models = ["Ocean", "PEAR"];
}),