CEC-3595-invalid-locations (#276)

* CEC-3595-invalid-locations

* fix ci

* added validate function

* resolve comments:
This commit is contained in:
das31
2023-02-03 20:11:00 -05:00
committed by GitHub
parent 25cbafabce
commit f863f37a9a
3 changed files with 28 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
import React from "react";
import { LocalDateTimeString } from "../../utils/dates";
import { ValidateLocationByParam } from "../../utils/locations"
import useStyles from "../useStyles";
const keyValueTemplate = (key, value) => (
@@ -83,6 +84,9 @@ const DigitalTwin = (props) => {
<div className={classes.popupSection}>
<h3>Location</h3>
{Object.entries(location).map((value) => {
if (ValidateLocationByParam(value[0], value[1]) === false) {
return keyValueTemplate(value[0], "Invalid")
}
if (value[0] === "altitude") {
return keyValueTemplate(value[0], value[1]);
} else {

View File

@@ -7,6 +7,7 @@ import { Button } from "@material-ui/core";
import { useUserContext } from "../Contexts/UserContext";
import { useVehicleContext, VehicleProvider } from "../Contexts/VehicleContext";
import { VehiclePopUp } from "./popup";
import { ValidateLocationData } from "../../utils/locations"
import GreenMarkerIcon from "../../assets/green-marker.png";
import GrayMarkerIcon from "../../assets/gray-marker.png";
import { logger } from "../../services/monitoring";
@@ -44,7 +45,7 @@ const Component = () => {
const retrieveAndStoreLocations = (accessToken) => {
return getLocations(accessToken)
.then((result) => {
if (result.data != null) {
if (result.data != null && ValidateLocationData(result.data) !== false) {
const points = result.data.map((point) => [
point.latitude,
point.longitude,