From 984455e815ae6c32dd1ee2e7ebfa408cc3c6fff7 Mon Sep 17 00:00:00 2001 From: Noe Date: Tue, 13 Feb 2024 15:20:58 +0100 Subject: [PATCH 1/2] V2 of front-end is ready --- .../dashboards/Installations/index.tsx | 12 +- .../src/content/dashboards/Log/Log.tsx | 11 +- .../dashboards/Overview/chartOptions.tsx | 11 + .../content/dashboards/Overview/overview.tsx | 518 ++++++++++-------- .../frontend-marios2/src/interfaces/Chart.tsx | 24 +- 5 files changed, 329 insertions(+), 247 deletions(-) diff --git a/typescript/frontend-marios2/src/content/dashboards/Installations/index.tsx b/typescript/frontend-marios2/src/content/dashboards/Installations/index.tsx index 42f8ba4ac..376a2d256 100644 --- a/typescript/frontend-marios2/src/content/dashboards/Installations/index.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/Installations/index.tsx @@ -104,7 +104,10 @@ function InstallationTabs() { value: 'live', label: }, - + { + value: 'overview', + label: + }, { value: 'batteryview', label: ( @@ -148,12 +151,7 @@ function InstallationTabs() { value: 'overview', label: }, - { - value: 'batteryview', - label: ( - - ) - }, + { value: 'log', label: diff --git a/typescript/frontend-marios2/src/content/dashboards/Log/Log.tsx b/typescript/frontend-marios2/src/content/dashboards/Log/Log.tsx index cd9823a17..559c9debc 100644 --- a/typescript/frontend-marios2/src/content/dashboards/Log/Log.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/Log/Log.tsx @@ -29,10 +29,17 @@ interface LogProps { function Log(props: LogProps) { const theme = useTheme(); + const searchParams = new URLSearchParams(location.search); + const openModal = searchParams.get('open'); + const [warnings, setWarnings] = useState([]); const [errors, setErrors] = useState([]); - const [errorButtonPressed, setErrorButtonPressed] = useState(false); - const [warningButtonPressed, setWarningButtonPressed] = useState(false); + const [errorButtonPressed, setErrorButtonPressed] = useState( + openModal === 'error' ? true : false + ); + const [warningButtonPressed, setWarningButtonPressed] = useState( + openModal === 'warning' ? true : false + ); const [updateCount, setUpdateCount] = useState(0); const navigate = useNavigate(); const tokencontext = useContext(TokenContext); diff --git a/typescript/frontend-marios2/src/content/dashboards/Overview/chartOptions.tsx b/typescript/frontend-marios2/src/content/dashboards/Overview/chartOptions.tsx index ccb93510b..037f835b8 100644 --- a/typescript/frontend-marios2/src/content/dashboards/Overview/chartOptions.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/Overview/chartOptions.tsx @@ -306,6 +306,17 @@ export const getChartOptions = ( } } }, + annotations: { + yaxis: [ + { + y: 0, + strokeDashArray: 0, + borderColor: '#d3d3d3', + borderWidth: 1, + yAxisIndex: 0 + } + ] + }, tooltip: { y: { formatter: function (val) { diff --git a/typescript/frontend-marios2/src/content/dashboards/Overview/overview.tsx b/typescript/frontend-marios2/src/content/dashboards/Overview/overview.tsx index 4f5061b72..39a5af4d5 100644 --- a/typescript/frontend-marios2/src/content/dashboards/Overview/overview.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/Overview/overview.tsx @@ -444,20 +444,20 @@ function Overview(props: OverviewProps) { > - + {/**/} + {/* */} + {/**/} {dailyData && ( <> - {/**/} - {/* */} - {/**/} + {dailyData && ( <> - - - - - - Search - - - } - startAdornment={ - - - - } - /> - - OR - - - diff --git a/typescript/frontend-marios2/src/interfaces/Chart.tsx b/typescript/frontend-marios2/src/interfaces/Chart.tsx index cc4b4a63a..1c209eb69 100644 --- a/typescript/frontend-marios2/src/interfaces/Chart.tsx +++ b/typescript/frontend-marios2/src/interfaces/Chart.tsx @@ -110,7 +110,7 @@ export const transformInputToDailyData = async ( while (startUnixTime < endTimestamp) { timestampPromises.push(fetchData(startUnixTime, s3Credentials)); - startUnixTime = UnixTime.fromTicks(startUnixTime.ticks + diff / 200); + startUnixTime = UnixTime.fromTicks(startUnixTime.ticks + diff / 100); if (startUnixTime.ticks % 2 !== 0) { startUnixTime = UnixTime.fromTicks(startUnixTime.ticks + 1); } @@ -436,12 +436,8 @@ export const transformInputToAggregatedData = async ( overviewData['/GridExportPower'].magnitude ), unit: '(kWh)', - min: - overviewData['/GridImportPower'].min + - overviewData['/GridExportPower'].min, - max: - overviewData['/GridImportPower'].max + - overviewData['/GridExportPower'].max + min: overviewData['/GridExportPower'].min, + max: overviewData['/GridImportPower'].max }; chartOverview.overview = { diff --git a/typescript/frontend-marios2/src/layouts/SidebarLayout/Header/Menu/index.tsx b/typescript/frontend-marios2/src/layouts/SidebarLayout/Header/Menu/index.tsx index 65c3784cd..743301461 100644 --- a/typescript/frontend-marios2/src/layouts/SidebarLayout/Header/Menu/index.tsx +++ b/typescript/frontend-marios2/src/layouts/SidebarLayout/Header/Menu/index.tsx @@ -11,6 +11,7 @@ import { styled } from '@mui/material/styles'; import ExpandMoreTwoToneIcon from '@mui/icons-material/ExpandMoreTwoTone'; import { ThemeContext } from '../../../../theme/ThemeProvider'; import { FormattedMessage } from 'react-intl'; +import '../../../../App.css'; interface HeaderButtonsProps { language: string; @@ -106,7 +107,7 @@ function HeaderMenu(props: HeaderButtonsProps) { const isMobile = window.innerWidth <= 1280; return ( - <> +
- - handleLanguageSelect('en')}> - English - - handleLanguageSelect('de')}> - German - - handleLanguageSelect('fr')}> - French - - - +
+ + handleLanguageSelect('en')}> + English + + handleLanguageSelect('de')}> + German + + handleLanguageSelect('fr')}> + French + + +
+
); } diff --git a/typescript/frontend-marios2/src/layouts/SidebarLayout/Header/Userbox/index.tsx b/typescript/frontend-marios2/src/layouts/SidebarLayout/Header/Userbox/index.tsx index 04eb7cd32..cdfe96b9d 100644 --- a/typescript/frontend-marios2/src/layouts/SidebarLayout/Header/Userbox/index.tsx +++ b/typescript/frontend-marios2/src/layouts/SidebarLayout/Header/Userbox/index.tsx @@ -19,6 +19,7 @@ import { TokenContext } from 'src/contexts/tokenContext'; import { useNavigate } from 'react-router-dom'; import routes from 'src/Resources/routes.json'; import { WebSocketContext } from '../../../../contexts/WebSocketContextProvider'; +import '../../../../App.css'; const UserBoxButton = styled(Button)( ({ theme }) => ` @@ -86,8 +87,13 @@ function HeaderUserbox() { }; return ( - <> - +
+ {currentUser?.name} @@ -113,14 +119,16 @@ function HeaderUserbox() { horizontal: 'right' }} > - - - {currentUser?.name} - - {currentUser?.email} - - - +
+ + + {currentUser?.name} + + {currentUser?.email} + + + +
@@ -130,7 +138,7 @@ function HeaderUserbox() { - +
); } diff --git a/typescript/frontend-marios2/src/layouts/SidebarLayout/index.tsx b/typescript/frontend-marios2/src/layouts/SidebarLayout/index.tsx index 4c9f3e7cf..bbcd07914 100644 --- a/typescript/frontend-marios2/src/layouts/SidebarLayout/index.tsx +++ b/typescript/frontend-marios2/src/layouts/SidebarLayout/index.tsx @@ -43,10 +43,12 @@ const SidebarLayout = (props: SidebarLayoutProps) => { } }} > -
+
+
+