Merge remote-tracking branch 'origin/main'

This commit is contained in:
Kim 2023-04-06 14:29:42 +02:00
commit 65dd23bd8e
19 changed files with 76 additions and 76 deletions

View File

@ -28,10 +28,15 @@ const AddNewDialog = (props: AddNewDialogProps) => {
return ( return (
<> <>
<InnovenergyButton sx={{ ml: 2 }} onClick={() => setOpen(true)}> <InnovenergyButton
id={"add-new-child-dialog-button-" + props.values.id}
sx={{ ml: 2 }}
onClick={() => setOpen(true)}
>
<FormattedMessage id="addNewChild" defaultMessage="Add new child" /> <FormattedMessage id="addNewChild" defaultMessage="Add new child" />
</InnovenergyButton> </InnovenergyButton>
<Dialog <Dialog
id={"add-new-child-dialog-" + props.values.id}
onClose={() => setOpen(false)} onClose={() => setOpen(false)}
aria-labelledby="customized-dialog-title" aria-labelledby="customized-dialog-title"
open={open} open={open}
@ -46,6 +51,7 @@ const AddNewDialog = (props: AddNewDialogProps) => {
<DialogTitle> <DialogTitle>
Create new folder Create new folder
<IconButton <IconButton
id={"add-new-child-dialog-icon-button-" + props.values.id}
edge="start" edge="start"
color="inherit" color="inherit"
onClick={() => setOpen(false)} onClick={() => setOpen(false)}
@ -56,7 +62,9 @@ const AddNewDialog = (props: AddNewDialogProps) => {
top: 8, top: 8,
}} }}
> >
<CloseIcon /> <CloseIcon
id={"add-new-child-dialog-close-icon-" + props.values.id}
/>
</IconButton> </IconButton>
</DialogTitle> </DialogTitle>
<DialogContent> <DialogContent>

View File

@ -53,7 +53,7 @@ const FolderForm = (props: I_CustomerFormProps) => {
<> <>
<form onSubmit={formik.handleSubmit}> <form onSubmit={formik.handleSubmit}>
<InnovenergyTextfield <InnovenergyTextfield
id="name-textfield" id="folder-name-textfield"
label={intl.formatMessage({ label={intl.formatMessage({
id: "name", id: "name",
defaultMessage: "Name", defaultMessage: "Name",
@ -63,7 +63,7 @@ const FolderForm = (props: I_CustomerFormProps) => {
handleChange={formik.handleChange} handleChange={formik.handleChange}
/> />
<InnovenergyTextfield <InnovenergyTextfield
id="information-textfield" id="folder-information-textfield"
label={intl.formatMessage({ label={intl.formatMessage({
id: "information", id: "information",
defaultMessage: "Information", defaultMessage: "Information",
@ -75,7 +75,11 @@ const FolderForm = (props: I_CustomerFormProps) => {
<Grid container justifyContent="flex-end" sx={{ pt: 1 }}> <Grid container justifyContent="flex-end" sx={{ pt: 1 }}>
{loading && <CircularProgress />} {loading && <CircularProgress />}
{additionalButtons && additionalButtons.map((button) => button)} {additionalButtons && additionalButtons.map((button) => button)}
<InnovenergyButton type="submit" sx={{ ml: 2 }}> <InnovenergyButton
id="folder-form-submit-button"
type="submit"
sx={{ ml: 2 }}
>
<FormattedMessage id="submit" defaultMessage="Submit" /> <FormattedMessage id="submit" defaultMessage="Submit" />
</InnovenergyButton> </InnovenergyButton>
</Grid> </Grid>

View File

@ -30,6 +30,7 @@ const GroupTabs = () => {
> >
{currentType === "Folder" ? ( {currentType === "Folder" ? (
<StyledTab <StyledTab
id="styled-tab-folder"
label={intl.formatMessage({ label={intl.formatMessage({
id: "folder", id: "folder",
defaultMessage: "Folder", defaultMessage: "Folder",
@ -42,6 +43,7 @@ const GroupTabs = () => {
/> />
) : ( ) : (
<StyledTab <StyledTab
id="styled-tab-installation"
label={intl.formatMessage({ label={intl.formatMessage({
id: "installation", id: "installation",
defaultMessage: "Installation", defaultMessage: "Installation",
@ -58,6 +60,7 @@ const GroupTabs = () => {
)} )}
<StyledTab <StyledTab
id="styled-tab-manage-access"
label={intl.formatMessage({ label={intl.formatMessage({
id: "manageAccess", id: "manageAccess",
defaultMessage: "Manage access", defaultMessage: "Manage access",

View File

@ -1,50 +0,0 @@
import { Grid, InputLabel } from "@mui/material";
import { useContext, useState } from "react";
import { FormattedMessage } from "react-intl";
import { useParams } from "react-router-dom";
import axiosConfig from "../../config/axiosConfig";
import { GroupContext } from "../Context/GroupContextProvider";
import InnovenergyButton from "../Layout/InnovenergyButton";
interface LocationFormProps {
parentId: number;
}
const LocationForm = (props: LocationFormProps) => {
const [selectedParentId, setSelectedParentId] = useState<number>(
props.parentId
);
const { fetchData, currentType } = useContext(GroupContext);
const { id } = useParams();
const handleMove = () => {
const route =
currentType === "Folder" ? "/MoveFolder" : "/MoveInstallation";
const paramsProp = currentType === "Folder" ? "folderId" : "installationId";
axiosConfig
.put(route, null, {
params: { [paramsProp]: id, parentId: selectedParentId },
})
.then((res) => {
fetchData();
});
};
return (
<Grid container direction="row" alignItems="center" spacing={2}>
<Grid item xs={3} alignItems="start">
<InputLabel style={{ marginBottom: "180px" }}>
<FormattedMessage id="location" defaultMessage="Location" />
</InputLabel>
</Grid>
<Grid item xs={9} display="inline"></Grid>
<Grid container justifyContent="flex-end" sx={{ pt: 1 }}>
<InnovenergyButton sx={{ height: 40, ml: 2 }} onClick={handleMove}>
<FormattedMessage id="move" defaultMessage="Move" />
</InnovenergyButton>
</Grid>
</Grid>
);
};
export default LocationForm;

View File

@ -30,6 +30,7 @@ const GroupTree = () => {
return data.map((element) => { return data.map((element) => {
return ( return (
<Link <Link
id={"group-tree-link-" + element.id}
key={element.id} key={element.id}
to={ to={
element.type === "Folder" element.type === "Folder"
@ -43,6 +44,7 @@ const GroupTree = () => {
draggable={false} draggable={false}
> >
<TreeItem <TreeItem
id={"group-tree-item-" + element.id}
key={element.type + element.id} key={element.type + element.id}
nodeId={element.type + element.id} nodeId={element.type + element.id}
label={element.name} label={element.name}

View File

@ -38,10 +38,15 @@ const MoveDialog = (props: MoveDialogProps) => {
return ( return (
<div> <div>
<InnovenergyButton onClick={() => setOpen(true)} sx={{ mr: 1 }}> <InnovenergyButton
id={"move-dialog-open-button-" + id}
onClick={() => setOpen(true)}
sx={{ mr: 1 }}
>
<FormattedMessage id="move" defaultMessage="Move" /> <FormattedMessage id="move" defaultMessage="Move" />
</InnovenergyButton> </InnovenergyButton>
<Dialog <Dialog
id={"move-dialog-" + id}
onClose={() => setOpen(false)} onClose={() => setOpen(false)}
aria-labelledby="customized-dialog-title" aria-labelledby="customized-dialog-title"
open={open} open={open}
@ -59,7 +64,12 @@ const MoveDialog = (props: MoveDialogProps) => {
/> />
</DialogContent> </DialogContent>
<DialogActions> <DialogActions>
<InnovenergyButton onClick={handleMove}>Move</InnovenergyButton> <InnovenergyButton
id={"move-dialog-move-button-" + id}
onClick={handleMove}
>
Move
</InnovenergyButton>
</DialogActions> </DialogActions>
</Dialog> </Dialog>
</div> </div>

View File

@ -28,7 +28,8 @@ const MoveTree = (props: MoveTreeProps) => {
.map((element) => { .map((element) => {
return ( return (
<TreeItem <TreeItem
key={"move-tree-element-" + element.id} id={"move-tree-item-" + element.id}
key={"move-tree-item-" + element.id}
nodeId={element.id.toString()} nodeId={element.id.toString()}
label={element.name} label={element.name}
> >

View File

@ -49,7 +49,7 @@ const InstallationForm = (props: I_InstallationFormProps) => {
return ( return (
<form onSubmit={formik.handleSubmit}> <form onSubmit={formik.handleSubmit}>
<InnovenergyTextfield <InnovenergyTextfield
id="name-textfield" id="installation-name-textfield"
label={intl.formatMessage({ label={intl.formatMessage({
id: "customerName", id: "customerName",
defaultMessage: "Customer name", defaultMessage: "Customer name",
@ -59,7 +59,7 @@ const InstallationForm = (props: I_InstallationFormProps) => {
handleChange={formik.handleChange} handleChange={formik.handleChange}
/> />
<InnovenergyTextfield <InnovenergyTextfield
id="region-textfield" id="installation-region-textfield"
label={intl.formatMessage({ label={intl.formatMessage({
id: "region", id: "region",
defaultMessage: "Region", defaultMessage: "Region",
@ -69,7 +69,7 @@ const InstallationForm = (props: I_InstallationFormProps) => {
handleChange={formik.handleChange} handleChange={formik.handleChange}
/> />
<InnovenergyTextfield <InnovenergyTextfield
id="location-textfield" id="installation-location-textfield"
label={intl.formatMessage({ label={intl.formatMessage({
id: "location", id: "location",
defaultMessage: "Location", defaultMessage: "Location",
@ -79,7 +79,7 @@ const InstallationForm = (props: I_InstallationFormProps) => {
handleChange={formik.handleChange} handleChange={formik.handleChange}
/> />
<InnovenergyTextfield <InnovenergyTextfield
id="country-textfield" id="installation-country-textfield"
label={intl.formatMessage({ label={intl.formatMessage({
id: "country", id: "country",
defaultMessage: "Country", defaultMessage: "Country",
@ -89,7 +89,7 @@ const InstallationForm = (props: I_InstallationFormProps) => {
handleChange={formik.handleChange} handleChange={formik.handleChange}
/> />
<InnovenergyTextfield <InnovenergyTextfield
id="orderNumbers-textfield" id="installation-orderNumbers-textfield"
label={intl.formatMessage({ label={intl.formatMessage({
id: "orderNumbers", id: "orderNumbers",
defaultMessage: "Order number", defaultMessage: "Order number",
@ -100,7 +100,7 @@ const InstallationForm = (props: I_InstallationFormProps) => {
/> />
<Grid container justifyContent="flex-end" sx={{ pt: 1 }}> <Grid container justifyContent="flex-end" sx={{ pt: 1 }}>
{hasMoveButton && <MoveDialog values={values} />} {hasMoveButton && <MoveDialog values={values} />}
<InnovenergyButton type="submit"> <InnovenergyButton id="installation-form-submit-button" type="submit">
<FormattedMessage id="applyChanges" defaultMessage="Apply changes" /> <FormattedMessage id="applyChanges" defaultMessage="Apply changes" />
</InnovenergyButton> </InnovenergyButton>
</Grid> </Grid>

View File

@ -75,15 +75,18 @@ const InstallationList = (props: InstallationListProps) => {
return ( return (
<Fragment key={installation.id}> <Fragment key={installation.id}>
<Link <Link
id={"installation-list-link-" + installation.id}
to={ to={
getPathWithoutId(routeMatch?.pattern?.path) + installation.id getPathWithoutId(routeMatch?.pattern?.path) + installation.id
} }
style={{ textDecoration: "none", color: "black" }} style={{ textDecoration: "none", color: "black" }}
> >
<ListItemButton <ListItemButton
id={"installation-list-button-" + installation.id}
selected={installation.id === Number(routeMatch?.params.id)} selected={installation.id === Number(routeMatch?.params.id)}
> >
<ListItemText <ListItemText
id={"installation-list-text-" + installation.id}
primary={installation.location + " | " + installation.name} primary={installation.location + " | " + installation.name}
/> />
</ListItemButton> </ListItemButton>

View File

@ -25,6 +25,7 @@ const InstallationTabs = () => {
aria-label="installation tabs" aria-label="installation tabs"
> >
<StyledTab <StyledTab
id={"installation-tab-installation"}
label={intl.formatMessage({ label={intl.formatMessage({
id: "installation", id: "installation",
defaultMessage: "Installation", defaultMessage: "Installation",
@ -36,6 +37,7 @@ const InstallationTabs = () => {
to={routes.installation + id} to={routes.installation + id}
/> />
<StyledTab <StyledTab
id={"installation-tab-alarms"}
label={intl.formatMessage({ label={intl.formatMessage({
id: "alarms", id: "alarms",
defaultMessage: "Alarms", defaultMessage: "Alarms",
@ -45,6 +47,7 @@ const InstallationTabs = () => {
to={routes.alarms + id} to={routes.alarms + id}
/> />
<StyledTab <StyledTab
id={"installation-tab-log"}
label={intl.formatMessage({ label={intl.formatMessage({
id: "log", id: "log",
defaultMessage: "Log", defaultMessage: "Log",

View File

@ -14,7 +14,10 @@ const Installations = () => {
<InstallationContextProvider> <InstallationContextProvider>
<Grid container spacing={2}> <Grid container spacing={2}>
<Grid item xs={3}> <Grid item xs={3}>
<SearchSidebar listComponent={InstallationList} /> <SearchSidebar
id="installations-search-sidebar"
listComponent={InstallationList}
/>
</Grid> </Grid>
<Grid item xs={9}> <Grid item xs={9}>
<InstallationTabs /> <InstallationTabs />

View File

@ -8,16 +8,15 @@ interface LanguageSelectProps {
const LanguageSelect = (props: LanguageSelectProps) => { const LanguageSelect = (props: LanguageSelectProps) => {
return ( return (
<Select <Select
labelId="demo-simple-select-label" id="language-select"
id="demo-simple-select"
value={props.language} value={props.language}
label="Age" label="Age"
onChange={(e) => props.setLanguage(e.target.value)} onChange={(e) => props.setLanguage(e.target.value)}
> >
<MenuItem value="EN"> <MenuItem id="english-menu-item" value="EN">
<FormattedMessage id="english" defaultMessage="English" /> <FormattedMessage id="english" defaultMessage="English" />
</MenuItem> </MenuItem>
<MenuItem value="DE"> <MenuItem id="german-menu-item" value="DE">
<FormattedMessage id="german" defaultMessage="German" /> <FormattedMessage id="german" defaultMessage="German" />
</MenuItem> </MenuItem>
</Select> </Select>

View File

@ -11,6 +11,7 @@ const LogoutButton = (props: LogoutButtonProps) => {
return ( return (
<InnovenergyButton <InnovenergyButton
id="logout-button"
onClick={() => { onClick={() => {
axiosConfig.post("/Logout").then(() => { axiosConfig.post("/Logout").then(() => {
navigate("/"); navigate("/");

View File

@ -31,6 +31,7 @@ const ModeButtons = () => {
/> />
</AntTabs> */} </AntTabs> */}
<ToggleButtonGroup <ToggleButtonGroup
id="mode-button-group"
color="primary" color="primary"
value={routeMatch?.pattern?.path} value={routeMatch?.pattern?.path}
exclusive exclusive
@ -38,18 +39,20 @@ const ModeButtons = () => {
size="small" size="small"
> >
<ToggleButton <ToggleButton
id="mode-toggle-button-list"
value={routes.installations + routes.list + "*"} value={routes.installations + routes.list + "*"}
component={Link} component={Link}
to={routes.list} to={routes.list}
> >
<ListIcon /> <ListIcon id="mode-toggle-button-list-icon" />
</ToggleButton> </ToggleButton>
<ToggleButton <ToggleButton
id="mode-toggle-button-tree"
value={routes.installations + routes.tree + "*"} value={routes.installations + routes.tree + "*"}
component={Link} component={Link}
to={routes.tree} to={routes.tree}
> >
<AccountTreeIcon /> <AccountTreeIcon id="mode-toggle-button-tree-icon" />
</ToggleButton> </ToggleButton>
</ToggleButtonGroup> </ToggleButtonGroup>
</> </>

View File

@ -35,10 +35,12 @@ const NavigationButtons = () => {
</ToggleButton> </ToggleButton>
</ToggleButtonGroup> */} </ToggleButtonGroup> */}
<AntTabs <AntTabs
id="navigation-buttons-group"
value={routeMatch?.pattern?.path} value={routeMatch?.pattern?.path}
aria-label="basic tabs example" aria-label="basic tabs example"
> >
<StyledTab <StyledTab
id="navigation-tab-installations"
value={routes.installations + "*"} value={routes.installations + "*"}
component={Link} component={Link}
to={routes.installations + routes.list} to={routes.installations + routes.list}
@ -50,6 +52,7 @@ const NavigationButtons = () => {
} }
/> />
<StyledTab <StyledTab
id="navigation-tab-users"
value={routes.users + "*"} value={routes.users + "*"}
component={Link} component={Link}
to={routes.users} to={routes.users}

View File

@ -4,16 +4,17 @@ import { useIntl } from "react-intl";
interface SearchSidebarProps { interface SearchSidebarProps {
listComponent: FC<{ searchQuery: string }>; listComponent: FC<{ searchQuery: string }>;
id: string;
} }
const SearchSidebar = (props: SearchSidebarProps) => { const SearchSidebar = (props: SearchSidebarProps) => {
const { listComponent: ListComponent } = props; const { listComponent: ListComponent, id } = props;
const [searchQuery, setSearchQuery] = useState(""); const [searchQuery, setSearchQuery] = useState("");
const intl = useIntl(); const intl = useIntl();
return ( return (
<> <>
<TextField <TextField
id="outlined-search" id={id}
label={intl.formatMessage({ label={intl.formatMessage({
id: "search", id: "search",
defaultMessage: "Search", defaultMessage: "Search",

View File

@ -22,8 +22,12 @@ const AddUser = () => {
return ( return (
<> <>
<InnovenergyButton sx={{ my: 1 }} onClick={() => setOpen(true)}> <InnovenergyButton
<FormattedMessage id="addNewChild" defaultMessage="Add user" /> id="add-user-button"
sx={{ my: 1 }}
onClick={() => setOpen(true)}
>
<FormattedMessage id="addUser" defaultMessage="Add user" />
</InnovenergyButton> </InnovenergyButton>
<Dialog <Dialog
onClose={() => setOpen(false)} onClose={() => setOpen(false)}

View File

@ -17,10 +17,12 @@ const UserTabs = () => {
<Box sx={{ width: "100%" }}> <Box sx={{ width: "100%" }}>
<Box sx={{ borderBottom: 1, borderColor: "divider" }}> <Box sx={{ borderBottom: 1, borderColor: "divider" }}>
<AntTabs <AntTabs
id="users-tabs"
value={routeMatch?.pattern?.path ?? routes.user + ":id"} value={routeMatch?.pattern?.path ?? routes.user + ":id"}
aria-label="user tabs" aria-label="user tabs"
> >
<StyledTab <StyledTab
id="users-tab-user"
label={intl.formatMessage({ label={intl.formatMessage({
id: "user", id: "user",
defaultMessage: "User", defaultMessage: "User",

View File

@ -14,7 +14,7 @@ const Users = () => {
<Grid container> <Grid container>
<Grid item xs={3}> <Grid item xs={3}>
<AddUser /> <AddUser />
<SearchSidebar listComponent={UserList} /> <SearchSidebar id="users-search-sidebar" listComponent={UserList} />
</Grid> </Grid>
<Grid item xs={9}> <Grid item xs={9}>
<UserTabs /> <UserTabs />