Updated Heal section (#351)
Co-authored-by: Benjamin Perez <benjamin@bexsoft.net>
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -54,8 +54,14 @@ const styles = (theme: Theme) =>
|
|||||||
...fieldBasic,
|
...fieldBasic,
|
||||||
...tooltipHelper,
|
...tooltipHelper,
|
||||||
...checkboxIcons,
|
...checkboxIcons,
|
||||||
labelContainer: {
|
fieldContainer: {
|
||||||
flexGrow: 1,
|
...fieldBasic.fieldContainer,
|
||||||
|
display: "flex",
|
||||||
|
justifyContent: "flex-start",
|
||||||
|
alignItems: "center",
|
||||||
|
margin: "15px 0",
|
||||||
|
marginBottom: 0,
|
||||||
|
flexBasis: "initial",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -73,19 +79,7 @@ const CheckboxWrapper = ({
|
|||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<Grid item xs={12} className={classes.fieldContainer}>
|
<Grid item xs={12} className={classes.fieldContainer}>
|
||||||
{label !== "" && (
|
<div>
|
||||||
<InputLabel htmlFor={id} className={classes.inputLabel}>
|
|
||||||
<span>{label}</span>
|
|
||||||
{tooltip !== "" && (
|
|
||||||
<div className={classes.tooltipContainer}>
|
|
||||||
<Tooltip title={tooltip} placement="top-start">
|
|
||||||
<HelpIcon className={classes.tooltip} />
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</InputLabel>
|
|
||||||
)}
|
|
||||||
<div className={classes.labelContainer}>
|
|
||||||
<Checkbox
|
<Checkbox
|
||||||
name={name}
|
name={name}
|
||||||
id={id}
|
id={id}
|
||||||
@@ -99,6 +93,18 @@ const CheckboxWrapper = ({
|
|||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{label !== "" && (
|
||||||
|
<InputLabel htmlFor={id} className={classes.inputLabel}>
|
||||||
|
<span>{label}</span>
|
||||||
|
{tooltip !== "" && (
|
||||||
|
<div className={classes.tooltipContainer}>
|
||||||
|
<Tooltip title={tooltip} placement="top-start">
|
||||||
|
<HelpIcon className={classes.tooltip} />
|
||||||
|
</Tooltip>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</InputLabel>
|
||||||
|
)}
|
||||||
</Grid>
|
</Grid>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
import { HorizontalBar } from "react-chartjs-2";
|
import { HorizontalBar } from "react-chartjs-2";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { Button, Grid, TextField, Checkbox } from "@material-ui/core";
|
import {
|
||||||
|
Button,
|
||||||
|
Grid,
|
||||||
|
TextField,
|
||||||
|
Checkbox,
|
||||||
|
InputBase,
|
||||||
|
} from "@material-ui/core";
|
||||||
import { IMessageEvent, w3cwebsocket as W3CWebSocket } from "websocket";
|
import { IMessageEvent, w3cwebsocket as W3CWebSocket } from "websocket";
|
||||||
import { createStyles, Theme, withStyles } from "@material-ui/core/styles";
|
import { createStyles, Theme, withStyles } from "@material-ui/core/styles";
|
||||||
import { wsProtocol } from "../../../utils/wsUtils";
|
import { wsProtocol } from "../../../utils/wsUtils";
|
||||||
@@ -9,8 +15,13 @@ import { FormControl, MenuItem, Select } from "@material-ui/core";
|
|||||||
import { BucketList, Bucket } from "../Watch/types";
|
import { BucketList, Bucket } from "../Watch/types";
|
||||||
import { HealStatus, colorH } from "./types";
|
import { HealStatus, colorH } from "./types";
|
||||||
import { niceBytes } from "../../../common/utils";
|
import { niceBytes } from "../../../common/utils";
|
||||||
import { containerForHeader } from "../Common/FormComponents/common/styleLibrary";
|
import {
|
||||||
|
actionsTray,
|
||||||
|
containerForHeader,
|
||||||
|
searchField,
|
||||||
|
} from "../Common/FormComponents/common/styleLibrary";
|
||||||
import PageHeader from "../Common/PageHeader/PageHeader";
|
import PageHeader from "../Common/PageHeader/PageHeader";
|
||||||
|
import CheckboxWrapper from "../Common/FormComponents/CheckboxWrapper/CheckboxWrapper";
|
||||||
|
|
||||||
const styles = (theme: Theme) =>
|
const styles = (theme: Theme) =>
|
||||||
createStyles({
|
createStyles({
|
||||||
@@ -29,31 +40,27 @@ const styles = (theme: Theme) =>
|
|||||||
borderBottom: "1px solid #dedede",
|
borderBottom: "1px solid #dedede",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
actionsTray: {
|
graphContainer: {
|
||||||
textAlign: "right",
|
backgroundColor: "#fff",
|
||||||
"& button": {
|
border: "#EAEDEE 1px solid",
|
||||||
marginLeft: 10,
|
borderRadius: 3,
|
||||||
},
|
padding: "19px 38px",
|
||||||
},
|
},
|
||||||
inputField: {
|
scanInfo: {
|
||||||
background: "#FFFFFF",
|
marginTop: 20,
|
||||||
padding: 12,
|
display: "flex",
|
||||||
borderRadius: 5,
|
flexDirection: "row",
|
||||||
marginLeft: 10,
|
justifyContent: "space-between",
|
||||||
boxShadow: "0px 3px 6px #00000012",
|
|
||||||
},
|
},
|
||||||
fieldContainer: {
|
scanData: {
|
||||||
background: "#FFFFFF",
|
fontSize: 13,
|
||||||
padding: 0,
|
|
||||||
borderRadius: 5,
|
|
||||||
marginLeft: 10,
|
|
||||||
textAlign: "left",
|
|
||||||
minWidth: "206",
|
|
||||||
boxShadow: "0px 3px 6px #00000012",
|
|
||||||
},
|
},
|
||||||
lastElementWPadding: {
|
inlineCheckboxes: {
|
||||||
paddingRight: "78",
|
display: "flex",
|
||||||
|
justifyContent: "flex-start",
|
||||||
},
|
},
|
||||||
|
...actionsTray,
|
||||||
|
...searchField,
|
||||||
...containerForHeader(theme.spacing(4)),
|
...containerForHeader(theme.spacing(4)),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -61,6 +68,26 @@ interface IHeal {
|
|||||||
classes: any;
|
classes: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SelectStyled = withStyles((theme: Theme) =>
|
||||||
|
createStyles({
|
||||||
|
root: {
|
||||||
|
width: 450,
|
||||||
|
lineHeight: 1,
|
||||||
|
marginRight: 15,
|
||||||
|
"label + &": {
|
||||||
|
marginTop: theme.spacing(3),
|
||||||
|
},
|
||||||
|
"& .MuiSelect-select:focus": {
|
||||||
|
backgroundColor: "transparent",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
input: {
|
||||||
|
fontSize: 13,
|
||||||
|
lineHeight: 15,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
)(InputBase);
|
||||||
|
|
||||||
const Heal = ({ classes }: IHeal) => {
|
const Heal = ({ classes }: IHeal) => {
|
||||||
const [start, setStart] = useState(false);
|
const [start, setStart] = useState(false);
|
||||||
const [bucketName, setBucketName] = useState("Select Bucket");
|
const [bucketName, setBucketName] = useState("Select Bucket");
|
||||||
@@ -204,8 +231,8 @@ const Heal = ({ classes }: IHeal) => {
|
|||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setBucketName(e.target.value as string);
|
setBucketName(e.target.value as string);
|
||||||
}}
|
}}
|
||||||
className={classes.fieldContainer}
|
className={classes.searchField}
|
||||||
disabled={false}
|
input={<SelectStyled />}
|
||||||
>
|
>
|
||||||
<MenuItem value="" key={`select-bucket-name-default`}>
|
<MenuItem value="" key={`select-bucket-name-default`}>
|
||||||
Select Bucket
|
Select Bucket
|
||||||
@@ -222,7 +249,7 @@ const Heal = ({ classes }: IHeal) => {
|
|||||||
</FormControl>
|
</FormControl>
|
||||||
<TextField
|
<TextField
|
||||||
placeholder="Prefix"
|
placeholder="Prefix"
|
||||||
className={classes.inputField}
|
className={classes.searchField}
|
||||||
id="prefix-resource"
|
id="prefix-resource"
|
||||||
label=""
|
label=""
|
||||||
disabled={false}
|
disabled={false}
|
||||||
@@ -242,76 +269,75 @@ const Heal = ({ classes }: IHeal) => {
|
|||||||
>
|
>
|
||||||
Start
|
Start
|
||||||
</Button>
|
</Button>
|
||||||
<Grid item xs={12}>
|
</Grid>
|
||||||
<span>{"Recursive"}</span>
|
<Grid item xs={12} className={classes.inlineCheckboxes}>
|
||||||
<Checkbox
|
<CheckboxWrapper
|
||||||
name="recursive"
|
name="recursive"
|
||||||
id="recursive"
|
id="recursive"
|
||||||
value="recursive"
|
value="recursive"
|
||||||
color="primary"
|
checked={recursive}
|
||||||
inputProps={{ "aria-label": "secondary checkbox" }}
|
onChange={(e) => {
|
||||||
checked={recursive}
|
setRecursive(e.target.checked);
|
||||||
onChange={(e) => {
|
}}
|
||||||
setRecursive(e.target.checked);
|
disabled={false}
|
||||||
}}
|
label="Recursive"
|
||||||
disabled={false}
|
/>
|
||||||
/>
|
<CheckboxWrapper
|
||||||
<span>{"Force Start"}</span>
|
name="forceStart"
|
||||||
<Checkbox
|
id="forceStart"
|
||||||
name="recursive"
|
value="forceStart"
|
||||||
id="recursive"
|
checked={forceStart}
|
||||||
value="recursive"
|
onChange={(e) => {
|
||||||
color="primary"
|
setForceStart(e.target.checked);
|
||||||
inputProps={{ "aria-label": "secondary checkbox" }}
|
}}
|
||||||
checked={forceStart}
|
disabled={false}
|
||||||
onChange={(e) => {
|
label="Force Start"
|
||||||
setForceStart(e.target.checked);
|
/>
|
||||||
}}
|
<CheckboxWrapper
|
||||||
disabled={false}
|
name="forceStop"
|
||||||
/>
|
id="forceStop"
|
||||||
<span>{"Force Stop"}</span>
|
value="forceStop"
|
||||||
<Checkbox
|
checked={forceStop}
|
||||||
name="recursive"
|
onChange={(e) => {
|
||||||
id="recursive"
|
setForceStop(e.target.checked);
|
||||||
value="recursive"
|
}}
|
||||||
color="primary"
|
disabled={false}
|
||||||
inputProps={{ "aria-label": "secondary checkbox" }}
|
label="Force Stop"
|
||||||
checked={forceStop}
|
/>
|
||||||
onChange={(e) => {
|
</Grid>
|
||||||
setForceStop(e.target.checked);
|
<Grid item xs={12}>
|
||||||
}}
|
<br />
|
||||||
disabled={false}
|
</Grid>
|
||||||
/>
|
<Grid item xs={12} className={classes.graphContainer}>
|
||||||
<span className={classes.lastElementWPadding}>{""}</span>
|
<HorizontalBar
|
||||||
|
data={data}
|
||||||
|
width={80}
|
||||||
|
height={30}
|
||||||
|
options={{
|
||||||
|
title: {
|
||||||
|
display: true,
|
||||||
|
text: "Item's Health Status [%]",
|
||||||
|
fontSize: 20,
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
display: true,
|
||||||
|
position: "right",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Grid item xs={12} className={classes.scanInfo}>
|
||||||
|
<div className={classes.scanData}>
|
||||||
|
<strong>Size scanned:</strong> {hStatus.sizeScanned}
|
||||||
|
</div>
|
||||||
|
<div className={classes.scanData}>
|
||||||
|
<strong>Objects healed:</strong> {hStatus.objectsHealed} /{" "}
|
||||||
|
{hStatus.objectsScanned}
|
||||||
|
</div>
|
||||||
|
<div className={classes.scanData}>
|
||||||
|
<strong>Healing time:</strong> {hStatus.healDuration}s
|
||||||
|
</div>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12}>
|
|
||||||
<br />
|
|
||||||
</Grid>
|
|
||||||
<HorizontalBar
|
|
||||||
data={data}
|
|
||||||
width={100}
|
|
||||||
height={30}
|
|
||||||
options={{
|
|
||||||
title: {
|
|
||||||
display: true,
|
|
||||||
text: "Item's Health Status [%]",
|
|
||||||
fontSize: 20,
|
|
||||||
},
|
|
||||||
legend: {
|
|
||||||
display: true,
|
|
||||||
position: "right",
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<Grid item xs={12}>
|
|
||||||
<br />
|
|
||||||
Size scanned: {hStatus.sizeScanned}
|
|
||||||
<br />
|
|
||||||
Objects healed: {hStatus.objectsHealed} / {hStatus.objectsScanned}
|
|
||||||
<br />
|
|
||||||
Healing time: {hStatus.healDuration}s
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
|
|||||||
Reference in New Issue
Block a user