From 3562ccc31c2dd94b776a535f9722db9c52951736 Mon Sep 17 00:00:00 2001 From: Paul Adamsen <117673433+pauladamseniii@users.noreply.github.com> Date: Fri, 25 Aug 2023 16:46:41 -0400 Subject: [PATCH] CEC-2374 - Add online filter to deploy search page (#422) * CEC-4855: fix manifest deselect (#410) * fix manifest deselect * CEC-4563: add cancel and include results in promise (#411) * CEC-4635: prevent false 0 calculation (#413) * prevent false 0 calculation * refactor switch statement * CEC-4729: add retry button to active car updates (#414) * add deploy button * disable control if inactive * add cases * CEC-2374 - Add online filter to deploy search page --------- Co-authored-by: Tristan Timblin --- .../App/__snapshots__/App.test.js.snap | 32 ++++++++- src/components/Manifest/Deploy/index.jsx | 70 ++++++++++++++----- 2 files changed, 83 insertions(+), 19 deletions(-) diff --git a/src/components/App/__snapshots__/App.test.js.snap b/src/components/App/__snapshots__/App.test.js.snap index 7ba10d0..985b9b9 100644 --- a/src/components/App/__snapshots__/App.test.js.snap +++ b/src/components/App/__snapshots__/App.test.js.snap @@ -4255,7 +4255,7 @@ exports[`App Route /package-deploy authenticated 1`] = `
+
+
+ +
+
diff --git a/src/components/Manifest/Deploy/index.jsx b/src/components/Manifest/Deploy/index.jsx index 8a84d56..7bb7abd 100644 --- a/src/components/Manifest/Deploy/index.jsx +++ b/src/components/Manifest/Deploy/index.jsx @@ -1,4 +1,5 @@ -import { Button, FormControlLabel, Grid, Switch, Typography } from "@material-ui/core"; +import { Button, Checkbox, FormControlLabel, Grid, MenuItem, Switch, Typography } from "@material-ui/core"; +import clsx from "clsx"; import SendIcon from "@material-ui/icons/Send"; import React, { useEffect, useState } from "react"; import { Redirect, useParams } from "react-router"; @@ -13,6 +14,7 @@ import { useStatusContext } from "../../Contexts/StatusContext"; import { useUserContext } from "../../Contexts/UserContext"; import { VehicleProvider } from "../../Contexts/VehicleContext"; import CarSelectionTable from "../../Controls/CarSelectionTable"; +import OptionsDropdown from "../../Controls/OptionsDropdown"; import { DropDownList } from "../../Controls/DropDownList"; import FleetSelectionTable from "../../Controls/FleetSelectionTable"; import { RoleWrap } from "../../Controls/RoleWrap"; @@ -24,23 +26,25 @@ const FLEET_UPDATE = true; const MainForm = () => { const [updateType, setUpdateType] = useState(CAR_UPDATE); - const {manifest_id} = useParams(); - const {getManifests, manifests, busy} = useManifestsContext(); - const {deployCarUpdates, deployFleetUpdates, getSUMSVersions, versions, updateSUMSVersion} = useCarUpdatesContext(); + const { manifest_id } = useParams(); + const { getManifests, manifests, busy } = useManifestsContext(); + const { deployCarUpdates, deployFleetUpdates, getSUMSVersions, versions, updateSUMSVersion } = useCarUpdatesContext(); const { groups, providers, token: { - idToken: {jwtToken: token}, + idToken: { jwtToken: token }, }, } = useUserContext(); - const {setMessage, setTitle, setSitePath} = useStatusContext(); + const { setMessage, setTitle, setSitePath } = useStatusContext(); const [manifestName, setManifestName] = useState(""); const [version, setVersion] = useState(""); const [sumsVersion, setSUMSersion] = useState(""); const [createDate, setCreateDate] = useState(""); const [selected, setSelected] = useState([]); const [search, setSearch] = useState(""); + const [online, setOnline] = useState(false); + const [onlineHMI, setOnlineHMI] = useState(false); const [softwareVersion, setSoftwareVersion] = useState(SELECT_VERSION); const [redirect, setRedirect] = useState(""); const classes = useStyles(); @@ -55,6 +59,14 @@ const MainForm = () => { setSearch(query); }; + const handleOnline = (event) => { + setOnline(event.target.checked); + }; + + const handleOnlineHMI = (event) => { + setOnlineHMI(event.target.checked); + }; + const handleSelectAll = (cars) => { setSelected(cars); }; @@ -103,7 +115,7 @@ const MainForm = () => { const getData = async () => { try { - await getManifests({id: parseInt(manifest_id)}, token); + await getManifests({ id: parseInt(manifest_id) }, token); await getSUMSVersions(token); } catch (e) { setMessage(e.message); @@ -146,7 +158,7 @@ const MainForm = () => { }, [manifests]); if (redirect.length > 0) { - return ; + return ; } return ( @@ -168,12 +180,30 @@ const MainForm = () => { } label="Car(default) or Fleet"/> + inputProps={{ 'aria-label': 'controlled' }} + />} label="Car(default) or Fleet" /> - - + + + + + + + } + label="Only online" + /> + + + + } + label="Only online HMI" + /> + + {sumsVersion.length === 0 && @@ -185,14 +215,14 @@ const MainForm = () => { data={versions} classes={classes} onChange={changeVersion} /> - } + } @@ -202,7 +232,11 @@ const MainForm = () => { classes={classes} token={token} multiSelect={true} - search={{search}} + search={{ + search, + online: online ? true : null, + online_hmi: onlineHMI ? true : null, + }} selected={selected} onSelect={handleSelect} onSelectAll={handleSelectAll} @@ -212,10 +246,10 @@ const MainForm = () => { classes={classes} token={token} multiSelect={true} - search={{search}} + search={{ search }} selected={selected} onSelect={handleSelect} - onSelectAll={handleSelectAll}/> + onSelectAll={handleSelectAll} /> } @@ -226,7 +260,7 @@ const MainForm = () => { const ManifestDeployForm = () => ( - + );