diff --git a/portal-ui/src/screens/Console/Heal/Heal.tsx b/portal-ui/src/screens/Console/Heal/Heal.tsx index cb86c0125..48eab714c 100644 --- a/portal-ui/src/screens/Console/Heal/Heal.tsx +++ b/portal-ui/src/screens/Console/Heal/Heal.tsx @@ -16,116 +16,48 @@ import React, { Fragment, useEffect, useState } from "react"; import { useSelector } from "react-redux"; -import { - FormControl, - Grid, - InputBase, - MenuItem, - Select, - TextField, -} from "@mui/material"; import { IMessageEvent, w3cwebsocket as W3CWebSocket } from "websocket"; -import { Theme } from "@mui/material/styles"; -import { Button, HealIcon, PageLayout } from "mds"; -import createStyles from "@mui/styles/createStyles"; -import withStyles from "@mui/styles/withStyles"; -import { wsProtocol } from "../../../utils/wsUtils"; -import { colorH, HealStatus } from "./types"; -import { niceBytes } from "../../../common/utils"; import { - actionsTray, - containerForHeader, - inlineCheckboxes, - searchField, -} from "../Common/FormComponents/common/styleLibrary"; -import { - CONSOLE_UI_RESOURCE, - IAM_SCOPES, -} from "../../../common/SecureComponent/permissions"; -import CheckboxWrapper from "../Common/FormComponents/CheckboxWrapper/CheckboxWrapper"; -import { SecureComponent } from "../../../common/SecureComponent"; -import DistributedOnly from "../Common/DistributedOnly/DistributedOnly"; -import { selDistSet, setHelpName } from "../../../systemSlice"; -import makeStyles from "@mui/styles/makeStyles"; -import PageHeaderWrapper from "../Common/PageHeaderWrapper/PageHeaderWrapper"; + Box, + Button, + Checkbox, + Grid, + HealIcon, + InputBox, + InputLabel, + PageLayout, + Select, +} from "mds"; import { Bar, BarChart, CartesianGrid, + Legend, ResponsiveContainer, Tooltip, XAxis, YAxis, } from "recharts"; -import { Legend } from "recharts"; -import HelpMenu from "../HelpMenu"; -import { useAppDispatch } from "../../../store"; + import { api } from "api"; import { Bucket } from "api/consoleApi"; import { errorToHandler } from "api/errors"; - -const useStyles = makeStyles((theme: Theme) => - createStyles({ - graphContainer: { - backgroundColor: "#fff", - border: "#EAEDEE 1px solid", - borderRadius: 3, - padding: "19px 38px", - marginTop: 15, - }, - scanInfo: { - marginTop: 20, - display: "flex", - flexDirection: "row", - justifyContent: "space-between", - }, - scanData: { - fontSize: 13, - }, - formBox: { - padding: 15, - border: "1px solid #EAEAEA", - }, - buttonBar: { - display: "flex", - alignItems: "center", - justifyContent: "flex-end", - }, - bucketField: { - flex: 1, - }, - prefixField: { - ...searchField.searchField, - marginLeft: 10, - flex: 1, - }, - actionsTray: { - ...actionsTray.actionsTray, - marginBottom: 0, - }, - ...inlineCheckboxes, - ...searchField, - ...containerForHeader, - }), -); - -const SelectStyled = withStyles((theme: Theme) => - createStyles({ - root: { - lineHeight: "50px", - marginRight: 15, - "label + &": { - marginTop: theme.spacing(3), - }, - "& .MuiSelect-select:focus": { - backgroundColor: "transparent", - }, - }, - }), -)(InputBase); +import { wsProtocol } from "../../../utils/wsUtils"; +import { colorH, HealStatus } from "./types"; +import { niceBytes } from "../../../common/utils"; +import { modalStyleUtils } from "../Common/FormComponents/common/styleLibrary"; +import { + CONSOLE_UI_RESOURCE, + IAM_SCOPES, +} from "../../../common/SecureComponent/permissions"; +import { selDistSet, setHelpName } from "../../../systemSlice"; +import { SecureComponent } from "../../../common/SecureComponent"; +import { useAppDispatch } from "../../../store"; +import DistributedOnly from "../Common/DistributedOnly/DistributedOnly"; +import PageHeaderWrapper from "../Common/PageHeaderWrapper/PageHeaderWrapper"; +import HelpMenu from "../HelpMenu"; const Heal = () => { - const classes = useStyles(); const distributedSetup = useSelector(selDistSet); const [start, setStart] = useState(false); @@ -166,13 +98,13 @@ const Heal = () => { // forceStart and forceStop need to be mutually exclusive useEffect(() => { - if (forceStart === true) { + if (forceStart) { setForceStop(false); } }, [forceStart]); useEffect(() => { - if (forceStop === true) { + if (forceStop) { setForceStart(false); } }, [forceStop]); @@ -285,84 +217,81 @@ const Heal = () => { scopes={[IAM_SCOPES.ADMIN_HEAL]} resource={CONSOLE_UI_RESOURCE} > - - - + + + + Bucket { - setBucketName(e.target.value as string); + onChange={(value) => { + setBucketName(value as string); }} - className={classes.searchField} - input={} - displayEmpty - > - - Select Bucket - - {bucketNames.map((option) => ( - - {option.label} - - ))} - - - { - setPrefix(e.target.value); - }} - variant="standard" - /> - - - { - setRecursive(e.target.checked); - }} - disabled={false} - label="Recursive" - /> - { - setForceStart(e.target.checked); - }} - disabled={false} - label="Force Start" - /> - { - setForceStop(e.target.checked); - }} - disabled={false} - label="Force Stop" - /> - - + options={bucketNames} + placeholder={"Select Bucket"} + /> + + + Prefix + { + setPrefix(e.target.value); + }} + /> + + + + + { + setRecursive(!recursive); + }} + disabled={false} + label="Recursive" + /> + + + { + setForceStart(!forceStart); + }} + disabled={false} + label="Force Start" + /> + + + { + setForceStop(!forceStop); + }} + disabled={false} + label="Force Stop" + /> + + + { onClick={() => setStart(true)} label={"Start"} /> - - - + + + { - + - - + + Size scanned: {hStatus.sizeScanned} - - + + Objects healed: {hStatus.objectsHealed} /{" "} {hStatus.objectsScanned} - - + + Healing time: {hStatus.healDuration}s - + - + )} diff --git a/portal-ui/src/screens/Console/Watch/Watch.tsx b/portal-ui/src/screens/Console/Watch/Watch.tsx index b3e31491b..58771c9f5 100644 --- a/portal-ui/src/screens/Console/Watch/Watch.tsx +++ b/portal-ui/src/screens/Console/Watch/Watch.tsx @@ -13,83 +13,33 @@ // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -import React, { useEffect, useState } from "react"; -import { - FormControl, - Grid, - InputBase, - MenuItem, - Select, - TextField, -} from "@mui/material"; + +import React, { useEffect, useState, Fragment } from "react"; import { IMessageEvent, w3cwebsocket as W3CWebSocket } from "websocket"; import { useSelector } from "react-redux"; -import { Theme } from "@mui/material/styles"; -import { Button, PageLayout } from "mds"; -import createStyles from "@mui/styles/createStyles"; -import withStyles from "@mui/styles/withStyles"; +import { + Box, + Button, + DataTable, + Grid, + InputBox, + InputLabel, + PageLayout, + Select, +} from "mds"; import { AppState, useAppDispatch } from "../../../store"; import { Bucket, BucketList, EventInfo } from "./types"; import { niceBytes, timeFromDate } from "../../../common/utils"; import { wsProtocol } from "../../../utils/wsUtils"; -import { - actionsTray, - containerForHeader, - searchField, - tableStyles, -} from "../Common/FormComponents/common/styleLibrary"; import { ErrorResponseHandler } from "../../../common/types"; -import TableWrapper from "../Common/TableWrapper/TableWrapper"; -import api from "../../../common/api"; -import makeStyles from "@mui/styles/makeStyles"; import { watchMessageReceived, watchResetMessages } from "./watchSlice"; +import { setHelpName } from "../../../systemSlice"; +import api from "../../../common/api"; import PageHeaderWrapper from "../Common/PageHeaderWrapper/PageHeaderWrapper"; import HelpMenu from "../HelpMenu"; -import { setHelpName } from "../../../systemSlice"; - -const useStyles = makeStyles((theme: Theme) => - createStyles({ - searchPrefix: { - flexGrow: 1, - marginLeft: 15, - }, - watchTableHeight: { - height: "calc(100vh - 270px)", - }, - bucketField: { - flexGrow: 2, - minWidth: 200, - }, - ...tableStyles, - ...actionsTray, - ...searchField, - ...containerForHeader, - }), -); - -const SelectStyled = withStyles((theme: Theme) => - createStyles({ - root: { - lineHeight: "50px", - "label + &": { - marginTop: theme.spacing(3), - }, - "& .MuiSelect-select:focus": { - backgroundColor: "transparent", - }, - }, - input: { - height: 50, - fontSize: 13, - lineHeight: "50px", - }, - }), -)(InputBase); const Watch = () => { const dispatch = useAppDispatch(); - const classes = useStyles(); - const messages = useSelector((state: AppState) => state.watch.messages); const [start, setStart] = useState(false); @@ -177,89 +127,83 @@ const Watch = () => { // eslint-disable-next-line react-hooks/exhaustive-deps }, []); - return ( - - } /> + const optionsArray = bucketNames.map((option) => ({ + label: option.label, + value: option.value, + })); + return ( + + } /> - - - + + + + Bucket { - setBucketName(e.target.value as string); + onChange={(value) => { + setBucketName(value as string); }} - className={classes.searchField} disabled={start} - input={} - > - - Select Bucket - - {bucketNames.map((option) => ( - - {option.label} - - ))} - - - { - setPrefix(e.target.value); - }} - variant="standard" - /> - { - setSuffix(e.target.value); - }} - variant="standard" - /> - {start ? ( - setStart(false)} - label={"Stop"} + options={optionsArray} + placeholder={"Select Bucket"} /> - ) : ( - setStart(true)} - label={"Start"} + + + Prefix + { + setPrefix(e.target.value); + }} /> - )} + + + Suffix + { + setSuffix(e.target.value); + }} + /> + + + {start ? ( + setStart(false)} + label={"Stop"} + /> + ) : ( + setStart(true)} + label={"Start"} + /> + )} + - - + { customEmptyMessage={"No Changes at this time"} idField={"watch_table"} isLoading={false} - customPaperHeight={classes.watchTableHeight} + customPaperHeight={"calc(100vh - 270px)"} /> - + ); }; diff --git a/portal-ui/tests/utils/elements.ts b/portal-ui/tests/utils/elements.ts index a8886ffc1..68df35e7e 100644 --- a/portal-ui/tests/utils/elements.ts +++ b/portal-ui/tests/utils/elements.ts @@ -59,7 +59,7 @@ export const deleteAllVersions = //---------------------------------------------------- // Inputs //---------------------------------------------------- -export const bucketNameInput = Selector("#bucket-name"); +export const bucketNameInput = Selector("#bucket-name-select"); export const bucketsPrefixInput = Selector("#prefix"); export const bucketsAccessInput = Selector("div.selectContainer"); export const bucketsAccessReadOnlyInput = Selector("li").withText("readonly"); @@ -85,8 +85,7 @@ export const groupUserCheckbox = Selector(".ReactVirtualized__Table__row input") // Dropdowns and options //---------------------------------------------------- export const bucketDropdownOptionFor = (modifier) => { - return Selector("li").withAttribute( - "data-value", + return Selector("#bucket-name-options-selector li").withText( `${constants.TEST_BUCKET_NAME}-${modifier}`, ); };