Merge branch 'release/0.0.3'
This commit is contained in:
@@ -126,6 +126,10 @@ describe("App", () => {
|
||||
await check("/tools/security-dll", "span.MuiButton-label", "Sign In");
|
||||
});
|
||||
|
||||
it("Route /dashboards/0 unauthenticated", async () => {
|
||||
await check("/dashboards/0", "span.MuiButton-label", "Sign In");
|
||||
});
|
||||
|
||||
it("Route /page-not-found unauthenticated", async () => {
|
||||
await check("/page-not-found", "h1", "Page Not Found");
|
||||
});
|
||||
@@ -200,4 +204,9 @@ describe("App", () => {
|
||||
setToken(TEST_AUTH_OBJECT_MAGNA);
|
||||
await sleepAndCheck("/tools/security-dll", "h6", "Security.dll Download");
|
||||
});
|
||||
|
||||
it("Route /dashboards/0 authenticated", async () => {
|
||||
setToken(TEST_AUTH_OBJECT_FISKER);
|
||||
await check("/dashboards/0", "h6", "Datascope");
|
||||
});
|
||||
});
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,7 +22,7 @@ const getCertTypeLabel = (certtype) => {
|
||||
|
||||
const getCertsTypes = (providers) => {
|
||||
if (providers.length === 0) return [];
|
||||
if (providers[0] === Providers.MAGNA) {
|
||||
if ((providers[0] === Providers.MAGNA) || (providers[0] === Providers.FISKER_QA)) {
|
||||
return CertTypeData.filter((item) => {
|
||||
return (item.label === CertTypes.TBOX || item.label === CertTypes.ICC);
|
||||
})
|
||||
@@ -32,7 +32,7 @@ const getCertsTypes = (providers) => {
|
||||
|
||||
const CreateForm = ({ onCreate, busy }) => {
|
||||
const classes = useStyles();
|
||||
const {providers} = useUserContext();
|
||||
const { providers } = useUserContext();
|
||||
const [commonName, setCommonName] = useState("");
|
||||
const [certType, setCertType] = useState(CertTypes.TBOX);
|
||||
const onVINChange = getVINOnChangeHandler(setCommonName);
|
||||
|
||||
28
src/components/DashboardStatic/index.jsx
Normal file
28
src/components/DashboardStatic/index.jsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useParams } from "react-router-dom";
|
||||
|
||||
import { getStaticDashboard } from "../../services/staticDashboards";
|
||||
import { useStatusContext } from "../Contexts/StatusContext";
|
||||
import useStyles from "../useStyles";
|
||||
|
||||
const StaticDashboard = () => {
|
||||
const classes = useStyles();
|
||||
const [dashboard, setDashboard] = useState(null);
|
||||
const { setTitle, setSitePath } = useStatusContext();
|
||||
const { index } = useParams();
|
||||
|
||||
useEffect(() => {
|
||||
const result = getStaticDashboard(parseInt(index));
|
||||
setDashboard(result);
|
||||
setTitle("Datascope");
|
||||
setSitePath([{ label: result.label}]);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [index]);
|
||||
|
||||
if (!dashboard) return <div>Loading...</div>;
|
||||
if (dashboard.error) return <span className="error">{dashboard.error}</span>;
|
||||
return <iframe className={classes.iframe} src={dashboard.url} title={dashboard.label}/>;
|
||||
|
||||
};
|
||||
|
||||
export default StaticDashboard;
|
||||
@@ -1,19 +1,19 @@
|
||||
import { List } from "@material-ui/core";
|
||||
import AssessmentIcon from "@material-ui/icons/Assessment";
|
||||
import BugReportIcon from "@material-ui/icons/BugReport";
|
||||
import BuildIcon from "@material-ui/icons/Build";
|
||||
import CloudDownloadIcon from "@material-ui/icons/CloudDownload";
|
||||
import CommuteIcon from "@material-ui/icons/Commute";
|
||||
import DirectionsCarIcon from "@material-ui/icons/DirectionsCar";
|
||||
import BugReportIcon from "@material-ui/icons/BugReport";
|
||||
import HomeIcon from "@material-ui/icons/Home";
|
||||
import SettingsInputCompositeIcon from "@material-ui/icons/SettingsInputComposite";
|
||||
import { default as React, useEffect, useState } from "react";
|
||||
|
||||
import { getStaticDashboardSubmenu } from "../../services/staticDashboards";
|
||||
import { hasRole, Permissions } from "../../utils/roles";
|
||||
import { useUserContext } from "../Contexts/UserContext";
|
||||
import SupersetDashboardList from "../SupersetDashboardList/SupersetDashboardList";
|
||||
import { ExpandableSideMenuItem, MenuItem } from "./MenuItem";
|
||||
|
||||
const menuData = [
|
||||
{
|
||||
label: "Home",
|
||||
@@ -49,8 +49,9 @@ const menuData = [
|
||||
label: "Datascope",
|
||||
to: null,
|
||||
icon: <AssessmentIcon />,
|
||||
rolesPerProvider: Permissions.FiskerRead,
|
||||
rolesPerProvider: Permissions.FiskerMagnaRead,
|
||||
component: SupersetDashboardList,
|
||||
submenus: getStaticDashboardSubmenu(Permissions.FiskerMagnaRead),
|
||||
},
|
||||
{
|
||||
label: "Suppliers",
|
||||
|
||||
@@ -188,67 +188,95 @@ exports[`SideMenu Authenticated 1`] = `
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<div
|
||||
aria-disabled="false"
|
||||
class="MuiButtonBase-root MuiListItem-root MuiListItem-gutters MuiListItem-button"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<span>
|
||||
<li>
|
||||
<div
|
||||
class="MuiListItemIcon-root"
|
||||
aria-disabled="false"
|
||||
class="MuiButtonBase-root MuiListItem-root MuiListItem-gutters MuiListItem-button"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
<div
|
||||
class="MuiListItemIcon-root"
|
||||
>
|
||||
<path
|
||||
d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<div
|
||||
class="MuiListItemText-root"
|
||||
>
|
||||
<span
|
||||
class="MuiTypography-root MuiListItemText-primary MuiTypography-body1 MuiTypography-displayBlock"
|
||||
>
|
||||
Datascope
|
||||
</span>
|
||||
</div>
|
||||
<span
|
||||
class="MuiTouchRipple-root"
|
||||
/>
|
||||
</div>
|
||||
<ul
|
||||
style="margin-left: 50px;"
|
||||
>
|
||||
<li>
|
||||
<a
|
||||
aria-disabled="false"
|
||||
class="MuiButtonBase-root MuiListItem-root MuiListItem-gutters MuiListItem-button"
|
||||
href="/datascope/00000000-0000-0000-0000-000000000000"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
class="MuiListItemText-root"
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<span
|
||||
class="MuiTypography-root MuiListItemText-primary MuiTypography-body1 MuiTypography-displayBlock"
|
||||
>
|
||||
test title
|
||||
</span>
|
||||
</div>
|
||||
<path
|
||||
d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<div
|
||||
class="MuiListItemText-root"
|
||||
>
|
||||
<span
|
||||
class="MuiTouchRipple-root"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
class="MuiTypography-root MuiListItemText-primary MuiTypography-body1 MuiTypography-displayBlock"
|
||||
>
|
||||
Datascope
|
||||
</span>
|
||||
</div>
|
||||
<span
|
||||
class="MuiTouchRipple-root"
|
||||
/>
|
||||
</div>
|
||||
<ul
|
||||
style="margin-left: 50px;"
|
||||
>
|
||||
<li>
|
||||
<a
|
||||
aria-disabled="false"
|
||||
class="MuiButtonBase-root MuiListItem-root MuiListItem-gutters MuiListItem-button"
|
||||
href="/datascope/00000000-0000-0000-0000-000000000000"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
class="MuiListItemText-root"
|
||||
>
|
||||
<span
|
||||
class="MuiTypography-root MuiListItemText-primary MuiTypography-body1 MuiTypography-displayBlock"
|
||||
>
|
||||
test title
|
||||
</span>
|
||||
</div>
|
||||
<span
|
||||
class="MuiTouchRipple-root"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</span>
|
||||
<ul
|
||||
style="margin-left: 50px;"
|
||||
>
|
||||
<li>
|
||||
<a
|
||||
aria-disabled="false"
|
||||
class="MuiButtonBase-root MuiListItem-root MuiListItem-gutters MuiListItem-button"
|
||||
href="/dashboards/0"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
class="MuiListItemText-root"
|
||||
>
|
||||
<span
|
||||
class="MuiTypography-root MuiListItemText-primary MuiTypography-body1 MuiTypography-displayBlock"
|
||||
>
|
||||
Vehicle Paths
|
||||
</span>
|
||||
</div>
|
||||
<span
|
||||
class="MuiTouchRipple-root"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<li>
|
||||
<a
|
||||
aria-disabled="false"
|
||||
@@ -492,6 +520,95 @@ exports[`SideMenu Magna Authenticated 1`] = `
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
<span>
|
||||
<li>
|
||||
<div
|
||||
aria-disabled="false"
|
||||
class="MuiButtonBase-root MuiListItem-root MuiListItem-gutters MuiListItem-button"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
class="MuiListItemIcon-root"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<div
|
||||
class="MuiListItemText-root"
|
||||
>
|
||||
<span
|
||||
class="MuiTypography-root MuiListItemText-primary MuiTypography-body1 MuiTypography-displayBlock"
|
||||
>
|
||||
Datascope
|
||||
</span>
|
||||
</div>
|
||||
<span
|
||||
class="MuiTouchRipple-root"
|
||||
/>
|
||||
</div>
|
||||
<ul
|
||||
style="margin-left: 50px;"
|
||||
>
|
||||
<li>
|
||||
<a
|
||||
aria-disabled="false"
|
||||
class="MuiButtonBase-root MuiListItem-root MuiListItem-gutters MuiListItem-button"
|
||||
href="/datascope/00000000-0000-0000-0000-000000000000"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
class="MuiListItemText-root"
|
||||
>
|
||||
<span
|
||||
class="MuiTypography-root MuiListItemText-primary MuiTypography-body1 MuiTypography-displayBlock"
|
||||
>
|
||||
test title
|
||||
</span>
|
||||
</div>
|
||||
<span
|
||||
class="MuiTouchRipple-root"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</span>
|
||||
<ul
|
||||
style="margin-left: 50px;"
|
||||
>
|
||||
<li>
|
||||
<a
|
||||
aria-disabled="false"
|
||||
class="MuiButtonBase-root MuiListItem-root MuiListItem-gutters MuiListItem-button"
|
||||
href="/dashboards/0"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
class="MuiListItemText-root"
|
||||
>
|
||||
<span
|
||||
class="MuiTypography-root MuiListItemText-primary MuiTypography-body1 MuiTypography-displayBlock"
|
||||
>
|
||||
Vehicle Paths
|
||||
</span>
|
||||
</div>
|
||||
<span
|
||||
class="MuiTouchRipple-root"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<span>
|
||||
<li>
|
||||
<a
|
||||
|
||||
@@ -31,6 +31,7 @@ import {
|
||||
import { useStatusContext } from "../../Contexts/StatusContext";
|
||||
import { useUserContext } from "../../Contexts/UserContext";
|
||||
import ECUList from "../../Controls/ECUList";
|
||||
import { RoleWrap } from "../../Controls/RoleWrap";
|
||||
import SearchField from "../../Controls/SearchField";
|
||||
import DeleteConfirmation from "../../DeleteConfirmation";
|
||||
import TableHeaderSortable from "../../Table/HeaderSortable";
|
||||
@@ -136,7 +137,7 @@ const MainForm = () => {
|
||||
order: `${orderBy} ${order}`,
|
||||
manifest_type: TYPE_MANIFEST_SOFTWARE,
|
||||
search,
|
||||
active: active,
|
||||
active,
|
||||
},
|
||||
token
|
||||
);
|
||||
@@ -246,15 +247,21 @@ const MainForm = () => {
|
||||
<Grid item md={4} className={classes.textJustifyAlign}></Grid>
|
||||
<Grid item md={4} className={classes.textCenterAlign}>
|
||||
<SearchField classes={classes} onSearch={handleSearch} />
|
||||
<ToggleButtonGroup
|
||||
value={active}
|
||||
exclusive
|
||||
aria-label="Active"
|
||||
onChange={handleActiveChange}
|
||||
<RoleWrap
|
||||
groups={groups}
|
||||
providers={providers}
|
||||
rolesPerProvider={Permissions.FiskerCreate}
|
||||
>
|
||||
<ToggleButton value={true}>Active</ToggleButton>
|
||||
<ToggleButton value={false}>Archived</ToggleButton>
|
||||
</ToggleButtonGroup>
|
||||
<ToggleButtonGroup
|
||||
value={active}
|
||||
exclusive
|
||||
aria-label="Active"
|
||||
onChange={handleActiveChange}
|
||||
>
|
||||
<ToggleButton value={true}>Active</ToggleButton>
|
||||
<ToggleButton value={false}>Archived</ToggleButton>
|
||||
</ToggleButtonGroup>
|
||||
</RoleWrap>
|
||||
</Grid>
|
||||
<Grid item md={4} className={classes.textRightAlign}></Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -41,6 +41,8 @@ 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 StaticDashboard = React.lazy(() => import("../DashboardStatic"));
|
||||
|
||||
const SiteRoutes = () => {
|
||||
const { token, groups, providers } = useUserContext();
|
||||
return (
|
||||
@@ -54,6 +56,15 @@ const SiteRoutes = () => {
|
||||
type={TYPES.GUEST}
|
||||
token={token}
|
||||
/>
|
||||
<AuthRoute
|
||||
path="/dashboards/:index"
|
||||
render={() => <StaticDashboard />}
|
||||
type={TYPES.PROTECTED}
|
||||
token={token}
|
||||
groups={groups}
|
||||
rolesPerGroup={Permissions.FiskerMagnaRead}
|
||||
providers={providers}
|
||||
/>
|
||||
<AuthRoute
|
||||
path="/filter-add"
|
||||
render={() => <CANFilterCreate />}
|
||||
@@ -291,7 +302,7 @@ const SiteRoutes = () => {
|
||||
type={TYPES.PROTECTED}
|
||||
token={token}
|
||||
groups={groups}
|
||||
rolesPerGroup={Permissions.FiskerRead}
|
||||
rolesPerGroup={Permissions.FiskerMagnaRead}
|
||||
providers={providers}
|
||||
/>
|
||||
<PageNotFound />
|
||||
|
||||
Reference in New Issue
Block a user