From 6acb5e134bcf8770df91485ea33c4651ec51bed5 Mon Sep 17 00:00:00 2001 From: Noe Date: Tue, 30 Apr 2024 11:41:45 +0200 Subject: [PATCH] Changes to the frontend: Unable to communicate modal, utc bugs fixed in configuration tab --- .../dashboards/BatteryView/BatteryView.tsx | 141 ++--- .../BatteryView/DetailedBatteryView.tsx | 484 +++++++++--------- .../Configuration/Configuration.tsx | 42 +- .../dashboards/Information/Information.tsx | 2 +- .../Information/InformationSalidomo.tsx | 7 +- .../Installations/FlatInstallationView.tsx | 12 +- .../dashboards/Installations/Installation.tsx | 70 ++- .../Installations/InstallationSearch.tsx | 6 +- .../Installations/installationForm.tsx | 26 +- .../src/content/dashboards/Log/graph.util.tsx | 3 +- .../FlatInstallationView.tsx | 14 +- .../SalidomoInstallations/Installation.tsx | 11 +- .../InstallationSearch.tsx | 6 +- .../SalidomoInstallationForm.tsx | 16 +- .../dashboards/Tree/CustomTreeItem.tsx | 2 +- .../dashboards/Tree/InstallationTree.tsx | 18 +- .../src/interfaces/InstallationTypes.tsx | 1 + .../src/interfaces/S3Types.tsx | 3 +- 18 files changed, 502 insertions(+), 362 deletions(-) diff --git a/typescript/frontend-marios2/src/content/dashboards/BatteryView/BatteryView.tsx b/typescript/frontend-marios2/src/content/dashboards/BatteryView/BatteryView.tsx index bf559b6ba..897212f1a 100644 --- a/typescript/frontend-marios2/src/content/dashboards/BatteryView/BatteryView.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/BatteryView/BatteryView.tsx @@ -31,6 +31,7 @@ interface BatteryViewProps { values: TopologyValues; s3Credentials: I_S3Credentials; installationId: number; + productNum: number; } function BatteryView(props: BatteryViewProps) { @@ -157,6 +158,7 @@ function BatteryView(props: BatteryViewProps) { s3Credentials={props.s3Credentials} batteryData={findBatteryData(battery.BatteryId)} installationId={props.installationId} + productNum={props.productNum} > } /> @@ -272,72 +274,83 @@ function BatteryView(props: BatteryViewProps) { battery.AverageTemperature.unit} - - {battery.Warnings.value === '' ? ( - 'None' - ) : battery.Warnings.value.toString().split('-').length > - 1 ? ( - + - Multiple Warnings - - ) : ( - battery.Warnings.value - )} - - - {battery.Alarms.value === '' ? ( - 'None' - ) : battery.Alarms.value.toString().split('-').length > - 1 ? ( - 1 ? ( + + Multiple Warnings + + ) : ( + battery.Warnings.value + )} + + - Multiple Alarms - - ) : ( - battery.Alarms.value - )} - + {battery.Alarms.value === '' ? ( + 'None' + ) : battery.Alarms.value.toString().split('-') + .length > 1 ? ( + + Multiple Alarms + + ) : ( + battery.Alarms.value + )} + + + )} ))} diff --git a/typescript/frontend-marios2/src/content/dashboards/BatteryView/DetailedBatteryView.tsx b/typescript/frontend-marios2/src/content/dashboards/BatteryView/DetailedBatteryView.tsx index 808d54d7a..51d0d72b4 100644 --- a/typescript/frontend-marios2/src/content/dashboards/BatteryView/DetailedBatteryView.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/BatteryView/DetailedBatteryView.tsx @@ -25,6 +25,7 @@ interface DetailedBatteryViewProps { s3Credentials: I_S3Credentials; batteryData: Battery; installationId: number; + productNum: number; } function DetailedBatteryView(props: DetailedBatteryViewProps) { @@ -273,22 +274,24 @@ function DetailedBatteryView(props: DetailedBatteryViewProps) { - + {props.productNum === 0 && ( + + )} @@ -310,7 +313,8 @@ function DetailedBatteryView(props: DetailedBatteryViewProps) { style={{ ...batteryStringStyle, backgroundColor: - props.batteryData.String1Active.value == 'True' + props.batteryData.String1Active.value == 'True' || + props.batteryData.String4Active.value == 0 ? '#32CD32' : '#FF033E' }} @@ -319,7 +323,8 @@ function DetailedBatteryView(props: DetailedBatteryViewProps) { style={{ ...batteryStringStyle, backgroundColor: - props.batteryData.String2Active.value == 'True' + props.batteryData.String2Active.value == 'True' || + props.batteryData.String4Active.value == 0 ? '#32CD32' : '#FF033E' }} @@ -328,7 +333,8 @@ function DetailedBatteryView(props: DetailedBatteryViewProps) { style={{ ...batteryStringStyle, backgroundColor: - props.batteryData.String3Active.value == 'True' + props.batteryData.String3Active.value == 'True' || + props.batteryData.String4Active.value == 0 ? '#32CD32' : '#FF033E' }} @@ -337,7 +343,8 @@ function DetailedBatteryView(props: DetailedBatteryViewProps) { style={{ ...batteryStringStyle, backgroundColor: - props.batteryData.String4Active.value == 'True' + props.batteryData.String4Active.value == 'True' || + props.batteryData.String4Active.value == 0 ? '#32CD32' : '#FF033E' }} @@ -346,7 +353,8 @@ function DetailedBatteryView(props: DetailedBatteryViewProps) { style={{ ...batteryStringStyle, backgroundColor: - props.batteryData.String5Active.value == 'True' + props.batteryData.String5Active.value == 'True' || + props.batteryData.String4Active.value == 0 ? '#32CD32' : '#FF033E' }} @@ -514,6 +522,7 @@ function DetailedBatteryView(props: DetailedBatteryViewProps) { props.batteryData.Power.unit} + {/*----------------------------------------------------------------------------------------------------------------------------------*/} - - - - Temperature - + {props.productNum === 0 && ( + <> + + + + Temperature + - - - - - - Heating - - - {props.batteryData.HeatingTemperature.value + - ' ' + - props.batteryData.HeatingTemperature.unit} - - - - - Board Temperature - - - {props.batteryData.BoardTemperature.value + - ' ' + - props.batteryData.BoardTemperature.unit} - - - - - Center Cells Temperature - - - {props.batteryData.AverageTemperature.value + - ' ' + - props.batteryData.AverageTemperature.unit} - - - - - Left Cells Temperature - - - {props.batteryData.LeftCellsTemperature.value + - ' ' + - props.batteryData.LeftCellsTemperature.unit} - - - - - Right Cells Temperature - - - {props.batteryData.RightCellsTemperature.value + - ' ' + - props.batteryData.RightCellsTemperature.unit} - - - - - Average Temperature - - - {props.batteryData.AverageTemperature.value + - ' ' + - props.batteryData.AverageTemperature.unit} - - - - - State - - - {props.batteryData.StateTemperature.value + - ' ' + - props.batteryData.StateTemperature.unit} - - - -
-
-
-
+ + + + + + Heating + + + {props.batteryData.HeatingTemperature.value + + ' ' + + props.batteryData.HeatingTemperature.unit} + + + + + Board Temperature + + + {props.batteryData.BoardTemperature.value + + ' ' + + props.batteryData.BoardTemperature.unit} + + + + + Center Cells Temperature + + + {props.batteryData.AverageTemperature.value + + ' ' + + props.batteryData.AverageTemperature.unit} + + + + + Left Cells Temperature + + + {props.batteryData.LeftCellsTemperature.value + + ' ' + + props.batteryData.LeftCellsTemperature.unit} + + + + + Right Cells Temperature + + + {props.batteryData.RightCellsTemperature.value + + ' ' + + props.batteryData.RightCellsTemperature.unit} + + + + + Average Temperature + + + {props.batteryData.AverageTemperature.value + + ' ' + + props.batteryData.AverageTemperature.unit} + + + + + State + + + {props.batteryData.StateTemperature.value + + ' ' + + props.batteryData.StateTemperature.unit} + + + +
+
+
+
+ + )} {/*----------------------------------------------------------------------------------------------------------------------------------*/} @@ -807,6 +820,7 @@ function DetailedBatteryView(props: DetailedBatteryViewProps) { overflow: 'visible', marginTop: '30px', marginLeft: '20px', + marginBottom: '20px', display: 'flex', flexDirection: 'column', alignItems: 'center', @@ -992,6 +1006,7 @@ function DetailedBatteryView(props: DetailedBatteryViewProps) { {/*----------------------------------------------------------------------------------------------------------------------------------*/} + + + - - - Calibration Charge Requested - - - {props.batteryData.CalibrationChargeRequested.value + - ' ' + - props.batteryData.CalibrationChargeRequested.unit} - - + {props.productNum === 0 && ( + + + Calibration Charge Requested + + + {props.batteryData.CalibrationChargeRequested.value + + ' ' + + props.batteryData.CalibrationChargeRequested.unit} + + + )} + {/*----------------------------------------------------------------------------------------------------------------------------------*/} {/**/} diff --git a/typescript/frontend-marios2/src/content/dashboards/Configuration/Configuration.tsx b/typescript/frontend-marios2/src/content/dashboards/Configuration/Configuration.tsx index 030ddc70a..66b682adf 100644 --- a/typescript/frontend-marios2/src/content/dashboards/Configuration/Configuration.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/Configuration/Configuration.tsx @@ -43,7 +43,7 @@ function Configuration(props: ConfigurationProps) { const CalibrationChargeOptions = [ 'Repetitive Calibration', 'Additional Calibration', - 'Force Calibration Now' + 'Force Permanent Calibration Now' ]; const CalibrationChargeOptionsController = [ @@ -93,13 +93,11 @@ function Configuration(props: ConfigurationProps) { CalibrationChargeOptionsController.indexOf( props.values.calibrationChargeState[0].value.toString() ) == 0 - ? dayjs - .utc(props.values.repetitiveCalibrationChargeDate[0].value) - .add(localOffset, 'minute') + ? dayjs(props.values.repetitiveCalibrationChargeDate[0].value) + // .add(localOffset, 'minute') .toDate() - : dayjs - .utc(props.values.additionalCalibrationChargeDate[0].value) - .add(localOffset, 'minute') + : dayjs(props.values.additionalCalibrationChargeDate[0].value) + // .add(localOffset, 'minute') .toDate() }); @@ -124,14 +122,19 @@ function Configuration(props: ConfigurationProps) { setErrorDateModalOpen(true); return; } else { - //console.log('asked for', dayjs(formValues.calibrationChargeDate)); + // console.log('asked for', dayjs(formValues.calibrationChargeDate)); const configurationToSend: ConfigurationValues = { minimumSoC: formValues.minimumSoC, gridSetPoint: formValues.gridSetPoint, CalibrationChargeState: formValues.CalibrationChargeState, - calibrationChargeDate: dayjs(formValues.calibrationChargeDate).toDate() + calibrationChargeDate: dayjs + .utc(formValues.calibrationChargeDate) + .add(localOffset, 'minute') + .toDate() }; + // console.log('will send ', dayjs(formValues.calibrationChargeDate)); + setLoading(true); const res = await axiosConfig .post( @@ -157,9 +160,11 @@ function Configuration(props: ConfigurationProps) { }; const handleConfirm = (newDate) => { + //console.log('non adapted day is ', newDate); + //console.log('adapted day is ', dayjs.utc(newDate).toDate()); setFormValues({ ...formValues, - ['calibrationChargeDate']: dayjs.utc(newDate).toDate() + ['calibrationChargeDate']: dayjs(newDate).toDate() }); }; @@ -170,6 +175,7 @@ function Configuration(props: ConfigurationProps) { if (difference < 0) { difference += 7; } + const adjustedDate = currentDate.add(difference, 'day'); setFormValues({ ...formValues, @@ -185,13 +191,11 @@ function Configuration(props: ConfigurationProps) { ), ['calibrationChargeDate']: CalibrationChargeOptions.indexOf(event.target.value) == 0 - ? dayjs - .utc(props.values.repetitiveCalibrationChargeDate[0].value) - .add(localOffset, 'minute') + ? dayjs(props.values.repetitiveCalibrationChargeDate[0].value) + // .add(localOffset, 'minute') .toDate() - : dayjs - .utc(props.values.additionalCalibrationChargeDate[0].value) - .add(localOffset, 'minute') + : dayjs(props.values.additionalCalibrationChargeDate[0].value) + // .add(localOffset, 'minute') .toDate() }); }; @@ -349,7 +353,7 @@ function Configuration(props: ConfigurationProps) { format="DD/MM/YYYY HH:mm" ampm={false} label="Select Next Calibration Charge Date" - value={dayjs.utc(formValues.calibrationChargeDate)} + value={dayjs(formValues.calibrationChargeDate)} onChange={handleConfirm} sx={{ marginTop: 2 @@ -397,8 +401,8 @@ function Configuration(props: ConfigurationProps) { handleConfirm(dayjs(newTime))} /> diff --git a/typescript/frontend-marios2/src/content/dashboards/Information/Information.tsx b/typescript/frontend-marios2/src/content/dashboards/Information/Information.tsx index 2fc3183ac..1c11206f5 100644 --- a/typescript/frontend-marios2/src/content/dashboards/Information/Information.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/Information/Information.tsx @@ -307,7 +307,7 @@ function Information(props: InformationProps) { label="S3 Bucket Name" name="s3writesecretkey" value={ - formValues.id + + formValues.s3BucketId + '-3e5b3069-214a-43ee-8d85-57d72000c19d' } variant="outlined" diff --git a/typescript/frontend-marios2/src/content/dashboards/Information/InformationSalidomo.tsx b/typescript/frontend-marios2/src/content/dashboards/Information/InformationSalidomo.tsx index d3a9d73ce..fa4edbd13 100644 --- a/typescript/frontend-marios2/src/content/dashboards/Information/InformationSalidomo.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/Information/InformationSalidomo.tsx @@ -37,7 +37,7 @@ function InformationSalidomo(props: InformationSalidomoProps) { const { currentUser } = context; const theme = useTheme(); const [formValues, setFormValues] = useState(props.values); - const requiredFields = ['name', 'region', 'location', 'country']; + const requiredFields = ['installationName', 'region', 'location', 'country']; const [openModalDeleteInstallation, setOpenModalDeleteInstallation] = useState(false); const navigate = useNavigate(); @@ -194,7 +194,7 @@ function InformationSalidomo(props: InformationSalidomoProps) { /> } name="installationName" - value={formValues.name} + value={formValues.installationName} onChange={handleChange} variant="outlined" fullWidth @@ -280,7 +280,8 @@ function InformationSalidomo(props: InformationSalidomoProps) { label="S3 Bucket Name" name="s3writesecretkey" value={ - formValues.id + '-c0436b6a-d276-4cd8-9c44-1eae86cf5d0e' + formValues.s3BucketId + + '-c0436b6a-d276-4cd8-9c44-1eae86cf5d0e' } variant="outlined" fullWidth diff --git a/typescript/frontend-marios2/src/content/dashboards/Installations/FlatInstallationView.tsx b/typescript/frontend-marios2/src/content/dashboards/Installations/FlatInstallationView.tsx index aa5d789c3..ccf926149 100644 --- a/typescript/frontend-marios2/src/content/dashboards/Installations/FlatInstallationView.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/Installations/FlatInstallationView.tsx @@ -102,11 +102,11 @@ const FlatInstallationView = (props: FlatInstallationViewProps) => { {props.installations.map((installation) => { const isInstallationSelected = - installation.id === selectedInstallation; + installation.s3BucketId === selectedInstallation; const status = getStatus(installation.id); const rowStyles = - isRowHovered === installation.id + isRowHovered === installation.s3BucketId ? { cursor: 'pointer', backgroundColor: theme.colors.primary.lighter @@ -116,13 +116,15 @@ const FlatInstallationView = (props: FlatInstallationViewProps) => { return ( - handleSelectOneInstallation(installation.id) + handleSelectOneInstallation(installation.s3BucketId) + } + onMouseEnter={() => + handleRowMouseEnter(installation.s3BucketId) } - onMouseEnter={() => handleRowMouseEnter(installation.id)} onMouseLeave={() => handleRowMouseLeave()} > diff --git a/typescript/frontend-marios2/src/content/dashboards/Installations/Installation.tsx b/typescript/frontend-marios2/src/content/dashboards/Installations/Installation.tsx index b66b309c7..067ad9eca 100644 --- a/typescript/frontend-marios2/src/content/dashboards/Installations/Installation.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/Installations/Installation.tsx @@ -1,5 +1,11 @@ import React, { useContext, useEffect, useState } from 'react'; -import { Card, CircularProgress, Grid, Typography } from '@mui/material'; +import { + Card, + CircularProgress, + Container, + Grid, + Typography +} from '@mui/material'; import { I_Installation } from 'src/interfaces/InstallationTypes'; import { UserContext } from 'src/contexts/userContext'; import AccessContextProvider from 'src/contexts/AccessContextProvider'; @@ -39,6 +45,14 @@ function Installation(props: singleInstallationProps) { const [currentTab, setCurrentTab] = useState(undefined); const [values, setValues] = useState(null); const status = getStatus(props.current_installation.id); + const [ + failedToCommunicateWithInstallation, + setFailedToCommunicateWithInstallation + ] = useState(0); + const [ + openModalUnableToCommunicateWIthInstallation, + setOpenModalUnableToCommunicateWIthInstallation + ] = useState(false); if (props.current_installation == undefined) { return null; @@ -48,14 +62,15 @@ function Installation(props: singleInstallationProps) { s3Region: props.current_installation.s3Region, s3Provider: props.current_installation.s3Provider, s3Key: props.current_installation.s3Key, - s3Secret: props.current_installation.s3Secret + s3Secret: props.current_installation.s3Secret, + s3BucketId: props.current_installation.s3BucketId }; const s3Bucket = props.current_installation.product === 0 - ? props.current_installation.id.toString() + + ? props.current_installation.s3BucketId.toString() + '-3e5b3069-214a-43ee-8d85-57d72000c19d' - : props.current_installation.id.toString() + + : props.current_installation.s3BucketId.toString() + '-c0436b6a-d276-4cd8-9c44-1eae86cf5d0e'; const s3Credentials = { s3Bucket, ...S3data }; @@ -67,6 +82,8 @@ function Installation(props: singleInstallationProps) { const res = await fetchData(now, s3Credentials); if (res != FetchResult.notAvailable && res != FetchResult.tryLater) { + setFailedToCommunicateWithInstallation(0); + setOpenModalUnableToCommunicateWIthInstallation(false); setValues( extractValues({ time: now, @@ -74,6 +91,13 @@ function Installation(props: singleInstallationProps) { }) ); return true; + } else { + setFailedToCommunicateWithInstallation((prevCount) => { + if (prevCount + 1 >= 3) { + setOpenModalUnableToCommunicateWIthInstallation(true); + } + return prevCount + 1; + }); } } catch (err) { return false; @@ -99,6 +123,12 @@ function Installation(props: singleInstallationProps) { setCurrentTab(path[path.length - 1]); }, [location]); + useEffect(() => { + if (status === -1) { + setOpenModalUnableToCommunicateWIthInstallation(true); + } + }, [status]); + useEffect(() => { if ( currentTab == 'live' || @@ -118,7 +148,7 @@ function Installation(props: singleInstallationProps) { fetchDataOnlyOneTime(); } - // Cleanup function to cancel interval and update isMounted when unmounted + // Cleanup function to cancel interval return () => { if ( currentTab == 'live' || @@ -130,6 +160,10 @@ function Installation(props: singleInstallationProps) { } }, [currentTab, location]); + const UnableToCommunicateModalHandleOk = () => { + setOpenModalUnableToCommunicateWIthInstallation(false); + }; + return ( <> @@ -264,6 +298,31 @@ function Installation(props: singleInstallationProps) { alignItems="stretch" spacing={0} > + {openModalUnableToCommunicateWIthInstallation && ( + + + + Unable to communicate with the installation + + + Please wait or refresh the page + + + )} + } > diff --git a/typescript/frontend-marios2/src/content/dashboards/Installations/InstallationSearch.tsx b/typescript/frontend-marios2/src/content/dashboards/Installations/InstallationSearch.tsx index 28f12d3b4..c7da184d5 100644 --- a/typescript/frontend-marios2/src/content/dashboards/Installations/InstallationSearch.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/Installations/InstallationSearch.tsx @@ -63,11 +63,11 @@ function InstallationSearch(props: installationSearchProps) { {filteredData.map((installation) => { return ( diff --git a/typescript/frontend-marios2/src/content/dashboards/Installations/installationForm.tsx b/typescript/frontend-marios2/src/content/dashboards/Installations/installationForm.tsx index 83a4051f8..a1e79c7f7 100644 --- a/typescript/frontend-marios2/src/content/dashboards/Installations/installationForm.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/Installations/installationForm.tsx @@ -25,6 +25,7 @@ function installationForm(props: installationFormProps) { const theme = useTheme(); const [open, setOpen] = useState(true); const [formValues, setFormValues] = useState>({ + installationName: '', name: '', region: '', location: '', @@ -32,7 +33,14 @@ function installationForm(props: installationFormProps) { vpnIp: '', orderNumbers: '' }); - const requiredFields = ['name', 'region', 'location', 'country', 'vpnIp']; + const requiredFields = [ + 'installationName', + 'name', + 'region', + 'location', + 'country', + 'vpnIp' + ]; const tokencontext = useContext(TokenContext); const { removeToken } = tokencontext; @@ -105,6 +113,21 @@ function installationForm(props: installationFormProps) { noValidate autoComplete="off" > +
+ + } + name="installationName" + value={formValues.installationName} + onChange={handleChange} + required + error={formValues.installationName === ''} + /> +
+
} diff --git a/typescript/frontend-marios2/src/content/dashboards/Log/graph.util.tsx b/typescript/frontend-marios2/src/content/dashboards/Log/graph.util.tsx index 7a6c15155..79237a1e5 100644 --- a/typescript/frontend-marios2/src/content/dashboards/Log/graph.util.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/Log/graph.util.tsx @@ -174,7 +174,6 @@ const batteryPaths = [ '/Battery/Devices/%id%/Dc/Voltage', '/Battery/Devices/%id%/Soc', '/Battery/Devices/%id%/Temperatures/Cells/Average', - //'/Log/SalimaxWarnings/Battery/%id%', '/Battery/Devices/%id%/Warnings', '/Battery/Devices/%id%/Alarms', @@ -319,6 +318,8 @@ export const extractValues = ( ): TopologyValues | null => { const extractedValues: TopologyValues = {} as TopologyValues; + // console.log('timeSeriesData=', timeSeriesData); + for (const topologyKey of Object.keys(topologyPaths)) { //Each topologykey may have more than one paths (for example inverter) const paths = topologyPaths[topologyKey]; diff --git a/typescript/frontend-marios2/src/content/dashboards/SalidomoInstallations/FlatInstallationView.tsx b/typescript/frontend-marios2/src/content/dashboards/SalidomoInstallations/FlatInstallationView.tsx index 1d0c4d7fe..6f218af27 100644 --- a/typescript/frontend-marios2/src/content/dashboards/SalidomoInstallations/FlatInstallationView.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/SalidomoInstallations/FlatInstallationView.tsx @@ -100,11 +100,11 @@ const FlatInstallationView = (props: FlatInstallationViewProps) => { {props.installations.map((installation) => { const isInstallationSelected = - installation.id === selectedInstallation; + installation.s3BucketId === selectedInstallation; const status = getStatus(installation.id); const rowStyles = - isRowHovered === installation.id + isRowHovered === installation.s3BucketId ? { cursor: 'pointer', backgroundColor: theme.colors.primary.lighter @@ -114,13 +114,15 @@ const FlatInstallationView = (props: FlatInstallationViewProps) => { return ( - handleSelectOneInstallation(installation.id) + handleSelectOneInstallation(installation.s3BucketId) + } + onMouseEnter={() => + handleRowMouseEnter(installation.s3BucketId) } - onMouseEnter={() => handleRowMouseEnter(installation.id)} onMouseLeave={() => handleRowMouseLeave()} > @@ -132,7 +134,7 @@ const FlatInstallationView = (props: FlatInstallationViewProps) => { noWrap sx={{ marginTop: '10px', fontSize: 'small' }} > - {installation.name} + {installation.installationName} diff --git a/typescript/frontend-marios2/src/content/dashboards/SalidomoInstallations/Installation.tsx b/typescript/frontend-marios2/src/content/dashboards/SalidomoInstallations/Installation.tsx index 90025f2c7..781503724 100644 --- a/typescript/frontend-marios2/src/content/dashboards/SalidomoInstallations/Installation.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/SalidomoInstallations/Installation.tsx @@ -10,7 +10,6 @@ import { } from 'src/content/dashboards/Log/graph.util'; import { WebSocketContext } from 'src/contexts/WebSocketContextProvider'; import { FormattedMessage } from 'react-intl'; -import Overview from '../Overview/overview'; import { fetchData } from 'src/content/dashboards/Installations/fetchData'; import { Navigate, Route, Routes, useLocation } from 'react-router-dom'; import routes from '../../../Resources/routes.json'; @@ -41,11 +40,12 @@ function Installation(props: singleInstallationProps) { s3Region: props.current_installation.s3Region, s3Provider: props.current_installation.s3Provider, s3Key: props.current_installation.s3Key, - s3Secret: props.current_installation.s3Secret + s3Secret: props.current_installation.s3Secret, + s3BucketId: props.current_installation.s3BucketId }; const s3Bucket = - props.current_installation.id.toString() + + props.current_installation.s3BucketId.toString() + '-' + 'c0436b6a-d276-4cd8-9c44-1eae86cf5d0e'; @@ -182,13 +182,10 @@ function Installation(props: singleInstallationProps) { values={values} s3Credentials={s3Credentials} installationId={props.current_installation.id} + productNum={props.current_installation.product} > } > - } - /> { return ( diff --git a/typescript/frontend-marios2/src/content/dashboards/SalidomoInstallations/SalidomoInstallationForm.tsx b/typescript/frontend-marios2/src/content/dashboards/SalidomoInstallations/SalidomoInstallationForm.tsx index b308af2a1..254ebf80a 100644 --- a/typescript/frontend-marios2/src/content/dashboards/SalidomoInstallations/SalidomoInstallationForm.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/SalidomoInstallations/SalidomoInstallationForm.tsx @@ -23,14 +23,20 @@ function SalidomonstallationForm(props: SalidomoInstallationFormProps) { const theme = useTheme(); const [open, setOpen] = useState(true); const [formValues, setFormValues] = useState>({ - name: '', + installationName: '', region: '', location: '', country: '', vpnIp: '', vrmLink: '' }); - const requiredFields = ['name', 'location', 'country', 'vpnIp', 'vrmLink']; + const requiredFields = [ + 'installationName', + 'location', + 'country', + 'vpnIp', + 'vrmLink' + ]; const installationContext = useContext(InstallationsContext); const { createInstallation, loading, setLoading, error, setError } = installationContext; @@ -108,11 +114,11 @@ function SalidomonstallationForm(props: SalidomoInstallationFormProps) { defaultMessage="Installation Name" /> } - name="name" - value={formValues.name} + name="installationName" + value={formValues.installationName} onChange={handleChange} required - error={formValues.name === ''} + error={formValues.installationName === ''} />
diff --git a/typescript/frontend-marios2/src/content/dashboards/Tree/CustomTreeItem.tsx b/typescript/frontend-marios2/src/content/dashboards/Tree/CustomTreeItem.tsx index 42df26c7e..7183e8f4d 100644 --- a/typescript/frontend-marios2/src/content/dashboards/Tree/CustomTreeItem.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/Tree/CustomTreeItem.tsx @@ -52,7 +52,7 @@ function CustomTreeItem(props: CustomTreeItemProps) { routes.installations + routes.tree + routes.installation + - installation.id + + installation.s3BucketId + '/' + routes.live, { diff --git a/typescript/frontend-marios2/src/content/dashboards/Tree/InstallationTree.tsx b/typescript/frontend-marios2/src/content/dashboards/Tree/InstallationTree.tsx index 650f5f842..afb84ab99 100644 --- a/typescript/frontend-marios2/src/content/dashboards/Tree/InstallationTree.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/Tree/InstallationTree.tsx @@ -28,7 +28,11 @@ function InstallationTree() { subnode != node && subnode.parentId == node.id && ( @@ -58,7 +62,11 @@ function InstallationTree() { {foldersAndInstallations.map((node, index) => { return ( @@ -72,11 +80,11 @@ function InstallationTree() { if (installation.type == 'Installation') { return ( diff --git a/typescript/frontend-marios2/src/interfaces/InstallationTypes.tsx b/typescript/frontend-marios2/src/interfaces/InstallationTypes.tsx index 2c85c9b37..74b1836cd 100644 --- a/typescript/frontend-marios2/src/interfaces/InstallationTypes.tsx +++ b/typescript/frontend-marios2/src/interfaces/InstallationTypes.tsx @@ -25,5 +25,6 @@ export interface I_Folder { information: string; parentId: number; type: string; + s3BucketId: number; children?: (I_Installation | I_Folder)[]; } diff --git a/typescript/frontend-marios2/src/interfaces/S3Types.tsx b/typescript/frontend-marios2/src/interfaces/S3Types.tsx index e910f702a..7309b1cb5 100644 --- a/typescript/frontend-marios2/src/interfaces/S3Types.tsx +++ b/typescript/frontend-marios2/src/interfaces/S3Types.tsx @@ -3,7 +3,8 @@ export interface I_S3Credentials { s3Provider: string; s3Key: string; s3Secret: string; - s3Bucket?: string; + s3Bucket: string; + s3BucketId: number; } export interface ErrorMessage {