diff --git a/src/components/App/__snapshots__/App.test.js.snap b/src/components/App/__snapshots__/App.test.js.snap
index ebdfb75..68feacd 100644
--- a/src/components/App/__snapshots__/App.test.js.snap
+++ b/src/components/App/__snapshots__/App.test.js.snap
@@ -6887,7 +6887,11 @@ exports[`App Route /packages authenticated 1`] = `
/>
|
+ >
+
+
diff --git a/src/components/Contexts/CarUpdatesContext.jsx b/src/components/Contexts/CarUpdatesContext.jsx
index f07427b..3acffec 100644
--- a/src/components/Contexts/CarUpdatesContext.jsx
+++ b/src/components/Contexts/CarUpdatesContext.jsx
@@ -36,6 +36,7 @@ export const CarUpdatesProvider = ({ children }) => {
const [busy, setBusy] = useState(false);
const [carUpdates, setCarUpdates] = useState([]);
const [versions, setVersions] = useState([SELECT_VERSION_OBJ]);
+ const [versionRxSwins, setVersionRxSwins] = useState([]);
const [totalCarUpdates, setTotalCarUpdates] = useState(0);
const [delayCount, setDelayCount] = useState(0);
let progressTimer = 0;
@@ -307,6 +308,24 @@ export const CarUpdatesProvider = ({ children }) => {
return result;
};
+ const getSUMSVersionRxSwins = async (sums_version, token) => {
+ let result;
+
+ try {
+ setBusy(true);
+
+ result = await api.getSUMSVersionRxSwins(sums_version, token);
+ if (result.error)
+ throw new Error(`Get software version rxswins error. ${result.message}`);
+
+ setVersionRxSwins(result.data);
+ } finally {
+ setBusy(false);
+ }
+
+ return result;
+ };
+
return (
{
startMonitor,
stopMonitor,
updateSUMSVersion,
+ getSUMSVersionRxSwins,
}}
>
{children}
diff --git a/src/components/Contexts/__mocks__/CarUpdatesContext.jsx b/src/components/Contexts/__mocks__/CarUpdatesContext.jsx
index 4ba1ce9..a0c3825 100644
--- a/src/components/Contexts/__mocks__/CarUpdatesContext.jsx
+++ b/src/components/Contexts/__mocks__/CarUpdatesContext.jsx
@@ -122,6 +122,19 @@ let sumsVersions = {
"data": ["2023.02.01.0.0.A", "2023.02.01.0.0.B"]
}
+let sumsVersionRxSwins = {
+ data: [
+ {
+ version: "2023.02.01.0.0.A",
+ rxswin: "testrxswin1",
+ },
+ {
+ version: "2023.02.01.0.0.A",
+ rxswin: "testrxswin2",
+ },
+ ]
+}
+
export const CarUpdatesProvider = ({ children }) => {
return {children} ;
};
@@ -140,5 +153,6 @@ export const useCarUpdatesContext = () => ({
stopMonitor: jest.fn(),
approveUpdate: jest.fn(),
getSUMSVersions: jest.fn(() => sumsVersions),
+ getSUMSVersionRxSwins: jest.fn(() => sumsVersionRxSwins),
updateSUMSVersion: jest.fn(),
});
\ No newline at end of file
diff --git a/src/components/Controls/CarUpdatesTable/index.jsx b/src/components/Controls/CarUpdatesTable/index.jsx
index 7da1829..d3cc482 100644
--- a/src/components/Controls/CarUpdatesTable/index.jsx
+++ b/src/components/Controls/CarUpdatesTable/index.jsx
@@ -177,7 +177,9 @@ const MainForm = ({ vin, token }) => {
- {row.updatemanifest?.sums}
+
+ {row.updatemanifest?.sums}
+
{row.username}
diff --git a/src/components/Manifest/List/index.jsx b/src/components/Manifest/List/index.jsx
index d1864d2..74d1871 100644
--- a/src/components/Manifest/List/index.jsx
+++ b/src/components/Manifest/List/index.jsx
@@ -447,7 +447,11 @@ const MainForm = () => {
{formatManifestType(row.manifest_type)}
- {row.sums}
+
+
+ {row.sums}
+
+
{formatType(row.type)}
diff --git a/src/components/Routes/SiteRoutes.jsx b/src/components/Routes/SiteRoutes.jsx
index 29052c2..5849252 100644
--- a/src/components/Routes/SiteRoutes.jsx
+++ b/src/components/Routes/SiteRoutes.jsx
@@ -41,6 +41,7 @@ const SMSSend = React.lazy(() => import("../SMS/Send"));
const SuppliersList = React.lazy(() => import("../Suppliers/List"));
const SupplierDetails = React.lazy(() => import("../Suppliers/Details"));
const Datascope = React.lazy(() => import("../Dashboard"));
+const SumsRxSwin = React.lazy(() => import("../SUMS"));
const DashboardCustom = React.lazy(() => import("../DashboardCustom"));
const SiteRoutes = () => {
@@ -305,6 +306,15 @@ const SiteRoutes = () => {
rolesPerGroup={Permissions.FiskerMagnaRead}
providers={providers}
/>
+ }
+ type={TYPES.PROTECTED}
+ token={token}
+ groups={groups}
+ rolesPerGroup={Permissions.FiskerMagnaCreate}
+ providers={providers}
+ />
diff --git a/src/components/SUMS/index.jsx b/src/components/SUMS/index.jsx
new file mode 100644
index 0000000..2380a38
--- /dev/null
+++ b/src/components/SUMS/index.jsx
@@ -0,0 +1,102 @@
+import {
+ Table,
+ TableBody,
+ TableCell,
+ TableFooter,
+ TablePagination,
+ TableRow,
+} from "@material-ui/core";
+import { logger } from "../../services/monitoring";
+import React, { useEffect, useState } from "react";
+import { useParams } from "react-router";
+import {
+ CarUpdatesProvider,
+ useCarUpdatesContext
+} from "../Contexts/CarUpdatesContext";
+import { useUserContext } from "../Contexts/UserContext";
+import TableHeaderSortable from "../Table/HeaderSortable";
+import useStyles from "../useStyles";
+
+const tableColumns = [
+ {
+ id: "sums_version",
+ label: "SUMS Version",
+ },
+ {
+ id: "sums_rxswin",
+ label: "RXSwin Version",
+ },
+];
+
+const MainForm = () => {
+ const { sums_version } = useParams();
+ const classes = useStyles();
+ const [orderBy, setOrderBy] = useState("id");
+ const [order, setOrder] = useState("desc");
+ const {
+ getSUMSVersionRxSwins,
+ stopMonitor,
+ } = useCarUpdatesContext();
+ const [versionRxSwins, setVersionRxSwins] = useState([]);
+ const {
+ token: {
+ idToken: { jwtToken: token },
+ },
+ } = useUserContext();
+
+ useEffect(() => {
+ (async () => {
+ try {
+ if (!sums_version || !token) return;
+ stopMonitor();
+ await getSUMSVersionRxSwins(
+ sums_version,
+ token
+ );
+ } catch (e) {
+ setVersionRxSwins(e.message);
+ logger.warn(e.stack);
+ }
+ })();
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [sums_version, token]);
+
+ const handleSort = (event, property) => {
+ try {
+ if (property === orderBy) {
+ if (order === "asc") {
+ setOrder("desc");
+ } else {
+ setOrder("asc");
+ }
+ } else {
+ setOrderBy(property);
+ setOrder("asc");
+ }
+ } catch (e) {
+ logger.warn(e.stack);
+ }
+ };
+
+ return (
+
+ );
+};
+
+const SumsRxSwin = () => (
+
+
+
+);
+
+export default SumsRxSwin;
\ No newline at end of file
diff --git a/src/services/updatesAPI.js b/src/services/updatesAPI.js
index 83f0736..65cf0c9 100644
--- a/src/services/updatesAPI.js
+++ b/src/services/updatesAPI.js
@@ -122,6 +122,18 @@ const updatesAPI = {
})
.then(fetchRespHandler)
.catch(errorHandler);
+ },
+
+ getSUMSVersionRxSwins: async (sums_version, token) => {
+ return fetch(`${API_ENDPOINT}/manifest/sums/${sums_version}/rxswins`, {
+ method: "GET",
+ headers: Object.assign(
+ { "Content-Type": "application/json" },
+ getAuthHeaderOptions(token)
+ ),
+ })
+ .then(fetchRespHandler)
+ .catch(errorHandler);
}
};
|