diff --git a/.env.stg b/.env.stg index 224b2c2..46937f3 100644 --- a/.env.stg +++ b/.env.stg @@ -2,4 +2,4 @@ REACT_APP_AUTH_SERVICE_URL=https://stg-gw.cloud.fiskerinc.com/compute_auth REACT_APP_CERT_SERVICE_URL=https://stg-gw.cloud.fiskerinc.com/certificate REACT_APP_UPLOAD_SERVICE_URL=https://stg-gw.cloud.fiskerinc.com/ota_update REACT_APP_AUTH_CALLBACK_URL=https://stg-ota-admin.cloud.fiskerinc.com -REACT_APP_SUPERSET_URL=https://stg-superset.cloud.fiskerinc.com/superset/dashboard/6/?native_filters_key=XBwRgJIvmxhqBhqlz45kuTnXc1iUY_M_ovzXCzXy5_l-AOFAXEaGLWpYIsfrEHGR +REACT_APP_SUPERSET_URL=https://stg-superset.cloud.fiskerinc.com/superset/dashboard/11/?native_filters_key=Vsj5MqKEPxPnyCgVzFWSSI3E_KgEJxD30afm_URlamPqBi6ypNKsaQ90YhQ6Fc54 diff --git a/src/components/CANFilter/Add/__snapshots__/index.test.jsx.snap b/src/components/CANFilter/Add/__snapshots__/index.test.jsx.snap index fff30da..2d2d5b1 100644 --- a/src/components/CANFilter/Add/__snapshots__/index.test.jsx.snap +++ b/src/components/CANFilter/Add/__snapshots__/index.test.jsx.snap @@ -124,7 +124,7 @@ exports[`CANFiltersAdd Render 1`] = ` for="interval" id="interval-label" > - Interval + Interval (ms)
- Interval + Interval (ms) diff --git a/src/components/CANFilter/Add/index.jsx b/src/components/CANFilter/Add/index.jsx index 2e06d69..5408720 100644 --- a/src/components/CANFilter/Add/index.jsx +++ b/src/components/CANFilter/Add/index.jsx @@ -93,7 +93,7 @@ const MainForm = () => { + + + Edge mask + + + + @@ -263,6 +289,9 @@ exports[`CANFiltersTable Render 1`] = ` href="/fleet/undefined" /> + @@ -323,6 +352,9 @@ exports[`CANFiltersTable Render 1`] = ` href="/fleet/undefined" /> + diff --git a/src/components/CANFilter/Table/index.jsx b/src/components/CANFilter/Table/index.jsx index 55d985d..9068090 100644 --- a/src/components/CANFilter/Table/index.jsx +++ b/src/components/CANFilter/Table/index.jsx @@ -29,6 +29,7 @@ import SearchField from "../../Controls/SearchField"; import { logger } from "../../../services/monitoring"; import { Roles, hasRole } from "../../../utils/roles"; import {useLocalStorage} from "../../useLocalStorage"; +import {trimIfMoreThan} from "../../../utils/strings"; const tableColumns = [ { @@ -43,6 +44,10 @@ const tableColumns = [ id: "fleet", label: "Fleet" }, + { + id: "edge_mask", + label: "Edge mask" + }, { id: "", label: "Actions" @@ -121,6 +126,10 @@ const MainForm = ({ vin }) => { }; const Actions = (row) => { + if(row.fleet != null) { + return + } + let actions = []; if (hasRole([Roles.CREATE], groups)) { actions.push({ @@ -187,6 +196,7 @@ const MainForm = ({ vin }) => { {row.fleet} + {trimIfMoreThan(row.edge_mask, 15, "...")} {Actions(row)} ))} diff --git a/src/components/CANFilter/Update/__snapshots__/index.test.jsx.snap b/src/components/CANFilter/Update/__snapshots__/index.test.jsx.snap index f7f60a2..4f66541 100644 --- a/src/components/CANFilter/Update/__snapshots__/index.test.jsx.snap +++ b/src/components/CANFilter/Update/__snapshots__/index.test.jsx.snap @@ -125,7 +125,7 @@ exports[`CANFiltersUpdate Render 1`] = ` for="interval" id="interval-label" > - Interval + Interval (ms)
); diff --git a/src/components/Cars/Status/__snapshots__/CANFiltersTab.test.jsx.snap b/src/components/Cars/Status/__snapshots__/CANFiltersTab.test.jsx.snap index bf2a936..da44961 100644 --- a/src/components/Cars/Status/__snapshots__/CANFiltersTab.test.jsx.snap +++ b/src/components/Cars/Status/__snapshots__/CANFiltersTab.test.jsx.snap @@ -171,6 +171,29 @@ exports[`CANFiltersTab Render 1`] = ` + + + Edge mask + + + + @@ -262,6 +288,9 @@ exports[`CANFiltersTab Render 1`] = ` href="/fleet/undefined" /> + @@ -322,6 +351,9 @@ exports[`CANFiltersTab Render 1`] = ` href="/fleet/undefined" /> + diff --git a/src/components/Fleets/Status/CANFilters/Add/__snapshots__/index.test.jsx.snap b/src/components/Fleets/Status/CANFilters/Add/__snapshots__/index.test.jsx.snap index c6d26c2..bc32912 100644 --- a/src/components/Fleets/Status/CANFilters/Add/__snapshots__/index.test.jsx.snap +++ b/src/components/Fleets/Status/CANFilters/Add/__snapshots__/index.test.jsx.snap @@ -124,7 +124,7 @@ exports[`FleetCANFilterAdd Render 1`] = ` for="interval" id="interval-label" > - Interval + Interval (ms)
- Interval + Interval (ms) diff --git a/src/components/Fleets/Status/CANFilters/Add/index.jsx b/src/components/Fleets/Status/CANFilters/Add/index.jsx index f9172f6..8a2b3ef 100644 --- a/src/components/Fleets/Status/CANFilters/Add/index.jsx +++ b/src/components/Fleets/Status/CANFilters/Add/index.jsx @@ -93,7 +93,7 @@ const MainForm = () => { + + + Edge mask + + + 789 + @@ -227,6 +253,9 @@ exports[`FleetCANFiltersTable Render 1`] = ` > 1000 + @@ -280,6 +309,9 @@ exports[`FleetCANFiltersTable Render 1`] = ` > 1 + diff --git a/src/components/Fleets/Status/CANFilters/Table/index.jsx b/src/components/Fleets/Status/CANFilters/Table/index.jsx index 07c51cf..e9eb631 100644 --- a/src/components/Fleets/Status/CANFilters/Table/index.jsx +++ b/src/components/Fleets/Status/CANFilters/Table/index.jsx @@ -24,6 +24,7 @@ import SearchField from "../../../../Controls/SearchField"; import { logger } from "../../../../../services/monitoring"; import { Roles, hasRole } from "../../../../../utils/roles"; import {useLocalStorage} from "../../../../useLocalStorage"; +import {trimIfMoreThan} from "../../../../../utils/strings" const tableColumns = [ { @@ -34,6 +35,10 @@ const tableColumns = [ id: "interval", label: "Interval (ms)" }, + { + id: "edge_mask", + label: "Edge mask" + }, { id: "", label: "Actions" @@ -173,6 +178,7 @@ const MainForm = ({ name }) => { {row.can_id} {row.interval} + {trimIfMoreThan(row.edge_mask, 15, "...")} {Actions(row)} ))} diff --git a/src/components/Fleets/Status/CANFilters/Update/__snapshots__/index.test.jsx.snap b/src/components/Fleets/Status/CANFilters/Update/__snapshots__/index.test.jsx.snap index 1fb8994..82e34d2 100644 --- a/src/components/Fleets/Status/CANFilters/Update/__snapshots__/index.test.jsx.snap +++ b/src/components/Fleets/Status/CANFilters/Update/__snapshots__/index.test.jsx.snap @@ -125,7 +125,7 @@ exports[`FleetCANFilterUpdate Render 1`] = ` for="interval" id="interval-label" > - Interval + Interval (ms) + + + Edge mask + + + 789 + @@ -226,6 +252,9 @@ exports[`CANFiltersTab Render 1`] = ` > 1000 + @@ -279,6 +308,9 @@ exports[`CANFiltersTab Render 1`] = ` > 1 + diff --git a/src/utils/strings.js b/src/utils/strings.js new file mode 100644 index 0000000..38df487 --- /dev/null +++ b/src/utils/strings.js @@ -0,0 +1,13 @@ +export function trimIfMoreThan(maybeString, maxLength = 20, sfx = "") { + if (typeof maybeString == "string" && maybeString !== "") { + let toAppSfx = sfx + let toTrimLnth = maxLength - toAppSfx.length + if (maybeString.length <= maxLength) { + toAppSfx = "" + toTrimLnth = maxLength + } + return maybeString.substring(0, toTrimLnth) + toAppSfx + } + + return "" +} \ No newline at end of file