CEC-6031 - OTA Campaign

This commit is contained in:
padamsen_fisker
2024-05-06 17:56:33 -04:00
parent 1a2b25fb1a
commit aea9d23869
2 changed files with 23 additions and 1 deletions

View File

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

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