Merge pull request #527 from Fisker-Inc/CEC-6031

CEC-6031 - OTA Campaign
This commit is contained in:
Paul Adamsen
2024-05-16 08:50:34 -04:00
committed by GitHub
4 changed files with 59 additions and 2 deletions

View File

@@ -23,7 +23,6 @@ import {
} from "../../../../Contexts/FleetContext";
import { useStatusContext } from "../../../../Contexts/StatusContext";
import { useUserContext } from "../../../../Contexts/UserContext";
import { VehicleProvider } from "../../../../Contexts/VehicleContext";
import SearchField from "../../../../Controls/SearchField";
import TableHeaderSortable from "../../../../Table/HeaderSortable";
import { useLocalStorage } from "../../../../useLocalStorage";

View File

@@ -1,7 +1,9 @@
import { useEffect, useState } from "react";
import {
Box,
Checkbox,
FormControl,
FormControlLabel,
IconButton,
Input,
InputLabel,
@@ -149,6 +151,12 @@ export default function Configure({
{manifest.name ? (<i>{manifest.name}</i>) : `This manifest`} is incomplete, and cannot be deployed without all required fields filled out.
</Typography>
<br />
<FormControlLabel control={
<Checkbox
checked={localManifest.notify_sap}
onChange={(e) => handleManifestField("notify_sap", e.target.checked)}
/>
} label="Notify SAP for OTA Campaign" />
<DropDownList
label="Sums Version"
labelField="version"

View File

@@ -433,6 +433,43 @@ exports[`Manifest Details Component Render 1`] = `
/>
</div>
</div>
<label
class="MuiFormControlLabel-root"
>
<span
aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-0 MuiCheckbox-root MuiCheckbox-colorSecondary MuiIconButton-colorSecondary"
>
<span
class="MuiIconButton-label"
>
<input
class="PrivateSwitchBase-input-0"
data-indeterminate="false"
type="checkbox"
value=""
/>
<svg
aria-hidden="true"
class="MuiSvgIcon-root"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"
/>
</svg>
</span>
<span
class="MuiTouchRipple-root"
/>
</span>
<span
class="MuiTypography-root MuiFormControlLabel-label MuiTypography-body1"
>
Notify SAP for OTA Campaign
</span>
</label>
<button
aria-label="send command"
class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-0 MuiButton-containedPrimary MuiButton-fullWidth"

View File

@@ -1,4 +1,4 @@
import { Button, FormControl, TextField } from "@material-ui/core";
import { Button, Checkbox, FormControl, FormControlLabel, TextField } from "@material-ui/core";
import React, { useEffect, useState } from "react";
import { Redirect } from "react-router";
import { useParams } from "react-router-dom";
@@ -59,6 +59,7 @@ const MainForm = () => {
const [env, setEnv] = useState("current");
const [updateDuration, setUpdateDuration] = useState(0);
const [maxAttempts, setMaxAttempts] = useState(0);
const [notifySAP, setNotifySAP] = useState(false);
const changeName = (e) => {
setName(e.target.value);
@@ -98,6 +99,10 @@ const MainForm = () => {
setMaxAttempts(value);
}
const changeNotifySAP = (event) => {
setNotifySAP(event.target.checked);
}
const onSubmit = async (e) => {
e.preventDefault();
try {
@@ -110,6 +115,7 @@ const MainForm = () => {
env,
update_duration: parseInt(updateDuration),
max_attempts: parseInt(maxAttempts),
notify_sap: notifySAP,
}, token);
if (!result || result.error) return;
@@ -148,6 +154,7 @@ const MainForm = () => {
setEnv(result.env ?? "current");
setUpdateDuration(result.update_duration);
setMaxAttempts(result.max_attempts);
setNotifySAP(result.notify_sap);
}
} catch (e) {
setMessage(e.message);
@@ -239,6 +246,12 @@ const MainForm = () => {
value={maxAttempts}
setValue={changeMaxAttempts}
/>
<FormControlLabel control={
<Checkbox
checked={notifySAP}
onChange={changeNotifySAP}
/>
} label="Notify SAP for OTA Campaign" />
<Button
type="submit"
aria-label="send command"