diff --git a/typescript/Frontend/src/App.tsx b/typescript/Frontend/src/App.tsx index 0df1873f1..e979dfa0c 100644 --- a/typescript/Frontend/src/App.tsx +++ b/typescript/Frontend/src/App.tsx @@ -78,7 +78,7 @@ const App = () => { bgcolor={colors.greyLight} pt={3} borderTop="2px solid" - borderColor={colors.darkGrey} + borderColor={colors.borderColor} flex="1 0 auto" > diff --git a/typescript/Frontend/src/components/Context/GroupContextProvider.tsx b/typescript/Frontend/src/components/Context/GroupContextProvider.tsx index 8032ebf48..7d29ca104 100644 --- a/typescript/Frontend/src/components/Context/GroupContextProvider.tsx +++ b/typescript/Frontend/src/components/Context/GroupContextProvider.tsx @@ -2,8 +2,9 @@ import { createContext, ReactNode, useCallback, useState } from "react"; import axiosConfig from "../../config/axiosConfig"; import { transformArrayToTree } from "../../util/group.util"; import { I_Folder, I_Installation } from "../../util/types"; +import { AxiosError } from "axios"; -interface GroupContextProviderProps { +interface I_GroupContextProviderProps { currentType: string; setCurrentType: (value: string) => void; data: (I_Folder | I_Installation)[]; @@ -11,10 +12,10 @@ interface GroupContextProviderProps { fetchData: () => Promise; loading: boolean; setLoading: (value: boolean) => void; - getError: boolean; + getError?: AxiosError; } -export const GroupContext = createContext({ +export const GroupContext = createContext({ currentType: "", setCurrentType: () => {}, data: [], @@ -22,14 +23,14 @@ export const GroupContext = createContext({ fetchData: () => Promise.resolve(), loading: false, setLoading: () => {}, - getError: false, + getError: undefined, }); const GroupContextProvider = ({ children }: { children: ReactNode }) => { const [currentType, setCurrentType] = useState(""); const [data, setData] = useState<(I_Folder | I_Installation)[]>([]); const [loading, setLoading] = useState(false); - const [getError, setGetError] = useState(false); + const [getError, setGetError] = useState(); const fetchData = useCallback(async () => { setLoading(true); diff --git a/typescript/Frontend/src/components/Context/InstallationsContextProvider.tsx b/typescript/Frontend/src/components/Context/InstallationsContextProvider.tsx index 37a74533b..e75462c99 100644 --- a/typescript/Frontend/src/components/Context/InstallationsContextProvider.tsx +++ b/typescript/Frontend/src/components/Context/InstallationsContextProvider.tsx @@ -3,7 +3,7 @@ import { createContext, ReactNode, useCallback, useState } from "react"; import axiosConfig from "../../config/axiosConfig"; import { I_Installation } from "../../util/types"; -interface InstallationContextProviderProps { +interface I_InstallationContextProviderProps { data: I_Installation[]; setData: (value: I_Installation[]) => void; fetchData: () => Promise; @@ -14,7 +14,7 @@ interface InstallationContextProviderProps { } export const InstallationsContext = - createContext({ + createContext({ data: [], setData: () => {}, fetchData: () => Promise.resolve(), diff --git a/typescript/Frontend/src/components/Context/LogContextProvider.tsx b/typescript/Frontend/src/components/Context/LogContextProvider.tsx index 6b09c5672..ac7ea4f7d 100644 --- a/typescript/Frontend/src/components/Context/LogContextProvider.tsx +++ b/typescript/Frontend/src/components/Context/LogContextProvider.tsx @@ -1,16 +1,16 @@ import { createContext, ReactNode, useState } from "react"; -import { TreeElement } from "../Installations/Log/CheckboxTree"; +import { I_TreeElement } from "../Installations/Log/CheckboxTree"; import React from "react"; -interface LogContextProviderProps { - toggles: TreeElement[] | null; - setToggles: (value: TreeElement[]) => void; +interface I_LogContextProviderProps { + toggles: I_TreeElement[] | null; + setToggles: (value: I_TreeElement[]) => void; checkedToggles: string[]; setChecked: (newValue: string) => void; removeChecked: (value: string) => void; } -export const LogContext = createContext({ +export const LogContext = createContext({ toggles: [], setToggles: () => {}, checkedToggles: [], @@ -19,7 +19,7 @@ export const LogContext = createContext({ }); const LogContextProvider = ({ children }: { children: ReactNode }) => { - const [toggles, setToggles] = useState(null); + const [toggles, setToggles] = useState(null); const [checkedToggles, setCheckedToggles] = useState([]); const setChecked = (newValue: string) => { diff --git a/typescript/Frontend/src/components/Context/S3CredentialsContextProvider.tsx b/typescript/Frontend/src/components/Context/S3CredentialsContextProvider.tsx index bef707611..43902eb19 100644 --- a/typescript/Frontend/src/components/Context/S3CredentialsContextProvider.tsx +++ b/typescript/Frontend/src/components/Context/S3CredentialsContextProvider.tsx @@ -1,21 +1,20 @@ import { createContext, ReactNode, useState } from "react"; -import { I_User } from "../../util/user.util"; -import { I_Installation, S3Credentials } from "../../util/types"; +import { I_S3Credentials } from "../../util/types"; import { UnixTime } from "../../dataCache/time"; import { FetchResult } from "../../dataCache/dataCache"; import { DataRecord } from "../../dataCache/data"; import { S3Access } from "../../dataCache/S3/S3Access"; import { parseCsv } from "../../util/graph.util"; -interface S3CredentialsContextProviderProps { - s3Credentials?: S3Credentials; - saveS3Credentials: (credentials: S3Credentials, id: string) => void; +interface I_S3CredentialsContextProviderProps { + s3Credentials?: I_S3Credentials; + saveS3Credentials: (credentials: I_S3Credentials, id: string) => void; fetchData: (timestamp: UnixTime) => Promise>; } export const S3CredentialsContext = - createContext({ - s3Credentials: {} as S3Credentials, + createContext({ + s3Credentials: {} as I_S3Credentials, saveS3Credentials: () => {}, fetchData: () => ({} as Promise>), }); @@ -25,9 +24,9 @@ const S3CredentialsContextProvider = ({ }: { children: ReactNode; }) => { - const [s3Credentials, setS3Credentials] = useState(); + const [s3Credentials, setS3Credentials] = useState(); - const saveS3Credentials = (credentials: S3Credentials, id: string) => { + const saveS3Credentials = (credentials: I_S3Credentials, id: string) => { const s3Bucket = id + "-3e5b3069-214a-43ee-8d85-57d72000c19d"; setS3Credentials({ s3Bucket, ...credentials }); }; diff --git a/typescript/Frontend/src/components/Context/UserContextProvider.tsx b/typescript/Frontend/src/components/Context/UserContextProvider.tsx index 6b9f35adb..2a1ea29b5 100644 --- a/typescript/Frontend/src/components/Context/UserContextProvider.tsx +++ b/typescript/Frontend/src/components/Context/UserContextProvider.tsx @@ -1,14 +1,14 @@ import { createContext, ReactNode, useState } from "react"; import { I_User } from "../../util/user.util"; -interface InstallationContextProviderProps { +interface I_InstallationContextProviderProps { currentUser?: I_User; setCurrentUser: (value: I_User) => void; saveCurrentUser: (user: I_User) => void; getCurrentUser: () => I_User; } -export const UserContext = createContext({ +export const UserContext = createContext({ currentUser: {} as I_User, setCurrentUser: () => {}, saveCurrentUser: () => {}, diff --git a/typescript/Frontend/src/components/Context/UsersContextProvider.tsx b/typescript/Frontend/src/components/Context/UsersContextProvider.tsx index 9952b2b7d..b6fce138c 100644 --- a/typescript/Frontend/src/components/Context/UsersContextProvider.tsx +++ b/typescript/Frontend/src/components/Context/UsersContextProvider.tsx @@ -8,14 +8,14 @@ import { } from "react"; import { useParams } from "react-router-dom"; import axiosConfig from "../../config/axiosConfig"; -import { I_User, UserWithInheritedAccess } from "../../util/user.util"; +import { I_User, I_UserWithInheritedAccess } from "../../util/user.util"; import { GroupContext } from "./GroupContextProvider"; -interface UsersContextProviderProps { +interface I_UsersContextProviderProps { directAccessUsers: I_User[]; setDirectAccessUsers: (value: I_User[]) => void; - inheritedAccessUsers: UserWithInheritedAccess[]; - setInheritedAccessUsers: (value: UserWithInheritedAccess[]) => void; + inheritedAccessUsers: I_UserWithInheritedAccess[]; + setInheritedAccessUsers: (value: I_UserWithInheritedAccess[]) => void; availableUsers: I_User[]; setAvailableUsers: (value: I_User[]) => void; getAvailableUsersForResource: () => I_User[]; @@ -24,7 +24,7 @@ interface UsersContextProviderProps { fetchAvailableUsers: () => Promise; } -export const UsersContext = createContext({ +export const UsersContext = createContext({ directAccessUsers: [], setDirectAccessUsers: () => {}, inheritedAccessUsers: [], @@ -48,7 +48,7 @@ export const UsersContext = createContext({ const UsersContextProvider = ({ children }: { children: ReactNode }) => { const [directAccessUsers, setDirectAccessUsers] = useState([]); const [inheritedAccessUsers, setInheritedAccessUsers] = useState< - UserWithInheritedAccess[] + I_UserWithInheritedAccess[] >([]); const [availableUsers, setAvailableUsers] = useState([]); diff --git a/typescript/Frontend/src/components/Groups/AccessManagement/UsersWithInheritedAccess.tsx b/typescript/Frontend/src/components/Groups/AccessManagement/UsersWithInheritedAccess.tsx index 94b2c9827..b22301e9d 100644 --- a/typescript/Frontend/src/components/Groups/AccessManagement/UsersWithInheritedAccess.tsx +++ b/typescript/Frontend/src/components/Groups/AccessManagement/UsersWithInheritedAccess.tsx @@ -10,7 +10,7 @@ import { Fragment, useContext, useEffect } from "react"; import { Link } from "react-router-dom"; import { filterDuplicateUsers, - UserWithInheritedAccess, + I_UserWithInheritedAccess, } from "../../../util/user.util"; import routes from "../../../routes.json"; import PersonIcon from "@mui/icons-material/Person"; @@ -29,7 +29,7 @@ const UsersWithInheritedAccess = () => { return ( <> {filterDuplicateUsers(inheritedAccessUsers).map( - ({ user, folderName }: UserWithInheritedAccess) => { + ({ user, folderName }: I_UserWithInheritedAccess) => { return ( diff --git a/typescript/Frontend/src/components/Groups/AddNewButtons.tsx b/typescript/Frontend/src/components/Groups/AddNewButtons.tsx index a4522e34a..19f549ab4 100644 --- a/typescript/Frontend/src/components/Groups/AddNewButtons.tsx +++ b/typescript/Frontend/src/components/Groups/AddNewButtons.tsx @@ -1,5 +1,4 @@ -import { useState } from "react"; -import { FormattedMessage, useIntl } from "react-intl"; +import { FormattedMessage } from "react-intl"; import axiosConfig from "../../config/axiosConfig"; import { I_Folder, I_Installation } from "../../util/types"; import FolderForm from "./Detail/FolderForm"; diff --git a/typescript/Frontend/src/components/Groups/AddNewDialog.tsx b/typescript/Frontend/src/components/Groups/AddNewDialog.tsx index 9c3efadda..0de1f9e58 100644 --- a/typescript/Frontend/src/components/Groups/AddNewDialog.tsx +++ b/typescript/Frontend/src/components/Groups/AddNewDialog.tsx @@ -5,13 +5,13 @@ import CloseIcon from "@mui/icons-material/Close"; import { ReactNode, useState } from "react"; import InnovenergyButton from "../Layout/InnovenergyButton"; -interface AddNewDialogProps { +interface I_AddNewDialogProps { form: ReactNode; message: ReactNode; id: number; } -const AddNewDialog = (props: AddNewDialogProps) => { +const AddNewDialog = (props: I_AddNewDialogProps) => { const { form, id, message } = props; const [open, setOpen] = useState(false); const intl = useIntl(); diff --git a/typescript/Frontend/src/components/Groups/Detail/Folder.tsx b/typescript/Frontend/src/components/Groups/Detail/Folder.tsx index fdbc87c92..3666411d9 100644 --- a/typescript/Frontend/src/components/Groups/Detail/Folder.tsx +++ b/typescript/Frontend/src/components/Groups/Detail/Folder.tsx @@ -53,7 +53,6 @@ const Folder = () => { borderBottomLeftRadius: 4, borderBottomRightRadius: 4, borderColor: theme.palette.text.disabled, - marginTop: 0.05, }} > { +const MoveDialog = (props: I_MoveDialogProps) => { const { values } = props; const [open, setOpen] = useState(false); diff --git a/typescript/Frontend/src/components/Groups/Detail/MoveTree.tsx b/typescript/Frontend/src/components/Groups/Detail/MoveTree.tsx index 4210f339f..762f087fa 100644 --- a/typescript/Frontend/src/components/Groups/Detail/MoveTree.tsx +++ b/typescript/Frontend/src/components/Groups/Detail/MoveTree.tsx @@ -8,12 +8,12 @@ import { instanceOfFolder } from "../../../util/group.util"; import { useIntl } from "react-intl"; import InnovenergyTreeItem from "../../Layout/InnovenergyTreeItem"; -interface MoveTreeProps { +interface I_MoveTreeProps { setSelectedParentId: (value: number) => void; parentId: number; } -const MoveTree = (props: MoveTreeProps) => { +const MoveTree = (props: I_MoveTreeProps) => { const { data } = useContext(GroupContext); const intl = useIntl(); diff --git a/typescript/Frontend/src/components/Groups/GroupTabs.tsx b/typescript/Frontend/src/components/Groups/GroupTabs.tsx index 9e1ec6d73..f17eb01bb 100644 --- a/typescript/Frontend/src/components/Groups/GroupTabs.tsx +++ b/typescript/Frontend/src/components/Groups/GroupTabs.tsx @@ -22,6 +22,8 @@ const GroupTabs = () => { const id = routeMatch?.params?.id; + console.log("fuck", routeMatch?.pattern?.path, currentType); + if (id) { return ( diff --git a/typescript/Frontend/src/components/Groups/GroupTree.tsx b/typescript/Frontend/src/components/Groups/GroupTree.tsx index 4c2084fbb..e60a86f4b 100644 --- a/typescript/Frontend/src/components/Groups/GroupTree.tsx +++ b/typescript/Frontend/src/components/Groups/GroupTree.tsx @@ -1,19 +1,20 @@ import TreeView from "@mui/lab/TreeView"; import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; import ChevronRightIcon from "@mui/icons-material/ChevronRight"; -import { ReactNode, useContext, useEffect, useState } from "react"; +import React, { ReactNode, useContext, useEffect, useState } from "react"; import { I_Folder, I_Installation } from "../../util/types"; import { Link } from "react-router-dom"; import routes from "../../routes.json"; import { GroupContext } from "../Context/GroupContextProvider"; import { instanceOfFolder } from "../../util/group.util"; -import { Grid, CircularProgress, useTheme } from "@mui/material"; +import { Grid, CircularProgress, useTheme, Alert } from "@mui/material"; import { useIntl } from "react-intl"; import InnovenergyTreeItem from "../Layout/InnovenergyTreeItem"; import TypeIcon from "./TypeIcon"; const GroupTree = () => { - const { setCurrentType, fetchData, data, loading } = useContext(GroupContext); + const { setCurrentType, fetchData, data, loading, getError } = + useContext(GroupContext); const [openNodes, setOpenNodes] = useState([]); const [selected, setSelected] = useState(""); const intl = useIntl(); @@ -56,7 +57,11 @@ const GroupTree = () => { {element.name} } - onClick={() => setCurrentType(element.type)} + onClick={() => { + console.log("fuck", element.type); + setCurrentType(element.type); + }} + sx={{ ".MuiTreeItem-label": { display: "flex" } }} > {getNodes(element)} @@ -100,6 +105,8 @@ const GroupTree = () => { {renderTree(data)} ); + } else if (getError) { + return {getError.message} ; } return null; }; diff --git a/typescript/Frontend/src/components/Groups/TypeIcon.tsx b/typescript/Frontend/src/components/Groups/TypeIcon.tsx index bf8fb7397..bf4b42ce4 100644 --- a/typescript/Frontend/src/components/Groups/TypeIcon.tsx +++ b/typescript/Frontend/src/components/Groups/TypeIcon.tsx @@ -1,11 +1,11 @@ import FolderIcon from "@mui/icons-material/Folder"; import InsertDriveFileIcon from "@mui/icons-material/InsertDriveFile"; -interface TypeIconProps { +interface I_TypeIconProps { type: string | undefined; } -const TypeIcon = (props: TypeIconProps) => { +const TypeIcon = (props: I_TypeIconProps) => { return ( <> {props.type === "Folder" ? ( diff --git a/typescript/Frontend/src/components/Installations/Detail/Installation.tsx b/typescript/Frontend/src/components/Installations/Detail/Installation.tsx index f620b342b..008556738 100644 --- a/typescript/Frontend/src/components/Installations/Detail/Installation.tsx +++ b/typescript/Frontend/src/components/Installations/Detail/Installation.tsx @@ -1,12 +1,9 @@ import { Alert, Box, CircularProgress, useTheme } from "@mui/material"; import { AxiosError } from "axios"; -import { useContext, useEffect, useState } from "react"; import { useParams } from "react-router-dom"; import axiosConfig from "../../../config/axiosConfig"; import { I_Folder, I_Installation } from "../../../util/types"; import InstallationForm from "./InstallationForm"; -import { colors } from "../../../index"; -import { S3CredentialsContext } from "../../Context/S3CredentialsContextProvider"; import MoveDialog from "../../Groups/Detail/MoveDialog"; interface I_InstallationProps { @@ -46,7 +43,7 @@ const Installation = (props: I_InstallationProps) => { {values.s3WriteKey &&
{`Write key: ${values.s3WriteKey}`}
} diff --git a/typescript/Frontend/src/components/Installations/Detail/InstallationForm.tsx b/typescript/Frontend/src/components/Installations/Detail/InstallationForm.tsx index fd3c7ecd7..afe2dcde6 100644 --- a/typescript/Frontend/src/components/Installations/Detail/InstallationForm.tsx +++ b/typescript/Frontend/src/components/Installations/Detail/InstallationForm.tsx @@ -8,8 +8,9 @@ import InnovenergyButton from "../../Layout/InnovenergyButton"; import { I_InnovenergyTextfieldProps } from "../../Layout/InnovenergyTextfield"; import { UserContext } from "../../Context/UserContextProvider"; import * as Yup from "yup"; -import { AxiosResponse } from "axios"; +import { AxiosError, AxiosResponse } from "axios"; import InnovenergyPropertyGrid from "../../Layout/InnovenergyPropertyGrid"; +import { GroupContext } from "../../Context/GroupContextProvider"; interface I_InstallationFormProps { values: I_Installation; @@ -23,8 +24,11 @@ interface I_InstallationFormProps { const InstallationForm = (props: I_InstallationFormProps) => { const { values, additionalButtons, handleSubmit } = props; const [open, setOpen] = useState(false); + const [error, setError] = useState(); + + const { fetchData: fetchInstallations } = useContext(InstallationsContext); + const { fetchData: fetchGroups } = useContext(GroupContext); - const { fetchData } = useContext(InstallationsContext); const { getCurrentUser } = useContext(UserContext); const readOnly = !getCurrentUser().hasWriteAccess; @@ -62,9 +66,16 @@ const InstallationForm = (props: I_InstallationFormProps) => { onSubmit: (formikValues) => { handleSubmit(values, formikValues) .then(() => { - fetchData(); + setOpen(true); + console.log(additionalButtons, "addbuttons"); + additionalButtons && additionalButtons.length > 0 + ? fetchGroups() + : fetchInstallations(); }) - .catch((err) => {}); + .catch((err) => { + setError(err); + setOpen(true); + }); }, validationSchema, }); @@ -171,10 +182,14 @@ const InstallationForm = (props: I_InstallationFormProps) => { onClose={handleClose} > - + {error ? ( + error.message + ) : ( + + )} diff --git a/typescript/Frontend/src/components/Installations/Installations.tsx b/typescript/Frontend/src/components/Installations/Installations.tsx index e77417de0..2548e345c 100644 --- a/typescript/Frontend/src/components/Installations/Installations.tsx +++ b/typescript/Frontend/src/components/Installations/Installations.tsx @@ -1,4 +1,4 @@ -import { Grid, colors } from "@mui/material"; +import { Grid } from "@mui/material"; import { Routes, Route } from "react-router"; import LiveView from "./LiveView/LiveView"; import InstallationTabs from "./InstallationTabs"; diff --git a/typescript/Frontend/src/components/Installations/LiveView/LiveView.tsx b/typescript/Frontend/src/components/Installations/LiveView/LiveView.tsx index 92fde3f08..f02f6c135 100644 --- a/typescript/Frontend/src/components/Installations/LiveView/LiveView.tsx +++ b/typescript/Frontend/src/components/Installations/LiveView/LiveView.tsx @@ -1,6 +1,5 @@ import TopologyView from "./TopologyView"; import { Box, useTheme } from "@mui/material"; -import { colors } from "../../../index"; const LiveView = () => { const theme = useTheme(); diff --git a/typescript/Frontend/src/components/Installations/LiveView/TopologyBox.tsx b/typescript/Frontend/src/components/Installations/LiveView/TopologyBox.tsx index 15167c646..ae1c56f9d 100644 --- a/typescript/Frontend/src/components/Installations/LiveView/TopologyBox.tsx +++ b/typescript/Frontend/src/components/Installations/LiveView/TopologyBox.tsx @@ -1,14 +1,14 @@ import { Box } from "@mui/material"; import { getBoxColor } from "../../../util/graph.util"; -export interface BoxDataValue { +export interface I_BoxDataValue { unit: string; value: string | number; } export type BoxData = { label: string; - values: BoxDataValue[]; + values: I_BoxDataValue[]; }; export type TopologyBoxProps = { diff --git a/typescript/Frontend/src/components/Installations/LiveView/TopologyView.tsx b/typescript/Frontend/src/components/Installations/LiveView/TopologyView.tsx index 93447ad96..797cff57f 100644 --- a/typescript/Frontend/src/components/Installations/LiveView/TopologyView.tsx +++ b/typescript/Frontend/src/components/Installations/LiveView/TopologyView.tsx @@ -1,4 +1,4 @@ -import { Alert, Box, useTheme } from "@mui/material"; +import { Alert, Box } from "@mui/material"; import TopologyColumn from "./TopologyColumn"; import { TimeSpan, UnixTime } from "../../../dataCache/time"; import { @@ -224,7 +224,6 @@ const TopologyView = () => { /> ); - return
TopologyView
; }; export default TopologyView; diff --git a/typescript/Frontend/src/components/Installations/Log/CheckboxTree.tsx b/typescript/Frontend/src/components/Installations/Log/CheckboxTree.tsx index fe43470ca..52a7b9b96 100644 --- a/typescript/Frontend/src/components/Installations/Log/CheckboxTree.tsx +++ b/typescript/Frontend/src/components/Installations/Log/CheckboxTree.tsx @@ -9,10 +9,10 @@ import routes from "../../../routes.json"; import React from "react"; import InnovenergyTreeItem from "../../Layout/InnovenergyTreeItem"; -export interface TreeElement { +export interface I_TreeElement { id: string; name: string; - children: TreeElement[]; + children: I_TreeElement[]; checked?: boolean; } @@ -23,13 +23,13 @@ const CheckboxTree = () => { routes.installations + routes.list + routes.log + ":id", ]); - const getNodes = (element: TreeElement): null | ReactNode => { + const getNodes = (element: I_TreeElement): null | ReactNode => { return element.children.length > 0 ? renderTree(element.children) : null; }; const handleClick = ( event: React.MouseEvent, - element: TreeElement, + element: I_TreeElement, checked?: string ) => { if (checked) { @@ -46,7 +46,7 @@ const CheckboxTree = () => { event.stopPropagation(); }; - const renderTree = (data: TreeElement[]): ReactNode => { + const renderTree = (data: I_TreeElement[]): ReactNode => { return data.map((element) => { const checked = checkedToggles.find((toggle) => element.id === toggle); const splitName = element.name.split("/"); diff --git a/typescript/Frontend/src/components/Installations/Log/DatePicker/DateRangePicker.tsx b/typescript/Frontend/src/components/Installations/Log/DatePicker/DateRangePicker.tsx index 61338af1c..ee562ced1 100644 --- a/typescript/Frontend/src/components/Installations/Log/DatePicker/DateRangePicker.tsx +++ b/typescript/Frontend/src/components/Installations/Log/DatePicker/DateRangePicker.tsx @@ -9,13 +9,13 @@ import { useTheme } from "@mui/material"; import { colors } from "../../../../index"; import ShortcutButton from "./ShortcutButton"; -interface DateRangePickerProps { +interface I_DateRangePickerProps { setRange: (value: Date[]) => void; range: Date[]; getCacheSeries: (xaxisRange0: Date, xaxisRange1: Date) => void; } -const DateRangePicker = (props: DateRangePickerProps) => { +const DateRangePicker = (props: I_DateRangePickerProps) => { const { setRange, range, getCacheSeries } = props; const theme = useTheme(); diff --git a/typescript/Frontend/src/components/Installations/Log/DatePicker/ShortcutButton.tsx b/typescript/Frontend/src/components/Installations/Log/DatePicker/ShortcutButton.tsx index b34147905..c4d4b2a41 100644 --- a/typescript/Frontend/src/components/Installations/Log/DatePicker/ShortcutButton.tsx +++ b/typescript/Frontend/src/components/Installations/Log/DatePicker/ShortcutButton.tsx @@ -2,14 +2,14 @@ import { UnixTime, TimeSpan } from "../../../../dataCache/time"; import { createTimes } from "../../../../util/graph.util"; import InnovenergyButton from "../../../Layout/InnovenergyButton"; -interface ShortcutButtonProps { +interface I_ShortcutButtonProps { setRange: (value: Date[]) => void; getCacheSeries: (xaxisRange0: Date, xaxisRange1: Date) => void; dayRange: number; children?: React.ReactNode; } -const ShortcutButton = (props: ShortcutButtonProps) => { +const ShortcutButton = (props: I_ShortcutButtonProps) => { return ( { diff --git a/typescript/Frontend/src/components/Installations/Log/ScalarGraph.tsx b/typescript/Frontend/src/components/Installations/Log/ScalarGraph.tsx index a0d024f39..c266e4c9c 100644 --- a/typescript/Frontend/src/components/Installations/Log/ScalarGraph.tsx +++ b/typescript/Frontend/src/components/Installations/Log/ScalarGraph.tsx @@ -1,7 +1,7 @@ import Plot from "react-plotly.js"; import { RecordSeries } from "../../../dataCache/data"; import { - GraphData, + I_GraphData, createTimes, getTreeElements, isNumeric, @@ -11,15 +11,15 @@ import { import { TimeRange, TimeSpan, UnixTime } from "../../../dataCache/time"; import { useCallback, useContext, useEffect, useMemo, useState } from "react"; import { BehaviorSubject, startWith, throttleTime, withLatestFrom } from "rxjs"; -import DataCache, { FetchResult } from "../../../dataCache/dataCache"; +import DataCache from "../../../dataCache/dataCache"; import { LogContext } from "../../Context/LogContextProvider"; import { isDefined } from "../../../dataCache/utils/maybe"; -import { Data, Icons, Layout, PlotRelayoutEvent } from "plotly.js"; +import { Data, Layout, PlotRelayoutEvent } from "plotly.js"; import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs"; import { FormattedMessage } from "react-intl"; import DateRangePicker from "./DatePicker/DateRangePicker"; import { LocalizationProvider } from "@mui/x-date-pickers"; -import { Alert, useTheme } from "@mui/material"; +import { Alert } from "@mui/material"; import { S3CredentialsContext } from "../../Context/S3CredentialsContextProvider"; const NUMBER_OF_NODES = 100; @@ -66,7 +66,7 @@ const ScalarGraph = () => { return () => subscription.unsubscribe(); }, [toggles]); - const transformToGraphData = (input: RecordSeries): GraphData => { + const transformToGraphData = (input: RecordSeries): I_GraphData => { const transformedObject: any = {}; input.forEach((item) => { @@ -101,7 +101,7 @@ const ScalarGraph = () => { y: [], }, }), - {} as GraphData + {} as I_GraphData ); }; diff --git a/typescript/Frontend/src/components/Layout/InnovenergyButton.tsx b/typescript/Frontend/src/components/Layout/InnovenergyButton.tsx index dfbff7637..9e656d632 100644 --- a/typescript/Frontend/src/components/Layout/InnovenergyButton.tsx +++ b/typescript/Frontend/src/components/Layout/InnovenergyButton.tsx @@ -1,4 +1,4 @@ -import { Button, SxProps, Theme, colors, useTheme } from "@mui/material"; +import { Button, SxProps, Theme, useTheme } from "@mui/material"; import { ReactNode } from "react"; interface I_InnovenergyButtonProps { diff --git a/typescript/Frontend/src/components/Layout/InnovenergyList.tsx b/typescript/Frontend/src/components/Layout/InnovenergyList.tsx index d0c67bb0a..b44678572 100644 --- a/typescript/Frontend/src/components/Layout/InnovenergyList.tsx +++ b/typescript/Frontend/src/components/Layout/InnovenergyList.tsx @@ -1,12 +1,12 @@ import { List, useTheme } from "@mui/material"; import { ReactNode } from "react"; -interface InnovenergyListProps { +interface I_InnovenergyListProps { id: string; children: ReactNode; } -const InnovenergyList = (props: InnovenergyListProps) => { +const InnovenergyList = (props: I_InnovenergyListProps) => { const theme = useTheme(); return ( { return (
diff --git a/typescript/Frontend/src/components/Layout/InnovenergySnackbar.tsx b/typescript/Frontend/src/components/Layout/InnovenergySnackbar.tsx index 10718d0d7..bb09aaa3e 100644 --- a/typescript/Frontend/src/components/Layout/InnovenergySnackbar.tsx +++ b/typescript/Frontend/src/components/Layout/InnovenergySnackbar.tsx @@ -1,13 +1,13 @@ import { Alert, Snackbar } from "@mui/material"; import { FormattedMessage } from "react-intl"; -interface InnovenergySnackbarProps { +interface I_InnovenergySnackbarProps { open: boolean; setOpen: (value: boolean) => void; error?: any; } -const InnovenergySnackbar = (props: InnovenergySnackbarProps) => { +const InnovenergySnackbar = (props: I_InnovenergySnackbarProps) => { const { open, setOpen, error } = props; const handleClose = () => { diff --git a/typescript/Frontend/src/components/Layout/InnovenergyTabs.tsx b/typescript/Frontend/src/components/Layout/InnovenergyTabs.tsx index 17b70ce73..1960e0637 100644 --- a/typescript/Frontend/src/components/Layout/InnovenergyTabs.tsx +++ b/typescript/Frontend/src/components/Layout/InnovenergyTabs.tsx @@ -1,15 +1,15 @@ -import { SxProps, Tabs, useTheme } from "@mui/material"; +import { Tabs, useTheme } from "@mui/material"; import { ReactNode } from "react"; import { colors } from "index"; -interface AntTabsProps { +interface I_AntTabsProps { id: string; value?: string; sx?: any; children: ReactNode; } -const InnovenergyTabs = (props: AntTabsProps) => { +const InnovenergyTabs = (props: I_AntTabsProps) => { const theme = useTheme(); return ( { id={props.id} nodeId={props.nodeId} label={props.label} - onClick={() => props.onClick} + onClick={props.onClick} sx={{ ".MuiTreeItem-content": { py: "10px", @@ -30,6 +30,7 @@ const InnovenergyTreeItem = (props: TreeItemProps) => { }, borderRadius: "4px", bgcolor: colors.greyDark, + ...props.sx, }} > {props.children} diff --git a/typescript/Frontend/src/components/Layout/LanguageSelect.tsx b/typescript/Frontend/src/components/Layout/LanguageSelect.tsx index c998b8c11..e3bcdd8e0 100644 --- a/typescript/Frontend/src/components/Layout/LanguageSelect.tsx +++ b/typescript/Frontend/src/components/Layout/LanguageSelect.tsx @@ -1,12 +1,12 @@ import { MenuItem, Select } from "@mui/material"; import { FormattedMessage } from "react-intl"; -interface LanguageSelectProps { +interface I_LanguageSelectProps { language: string; setLanguage: (language: string) => void; } -const LanguageSelect = (props: LanguageSelectProps) => { +const LanguageSelect = (props: I_LanguageSelectProps) => { return (