Skip to content

Commit 10b8a93

Browse files
authored
UX Tenant summary screen (#1346)
1 parent 19caa72 commit 10b8a93

File tree

13 files changed

+776
-507
lines changed

13 files changed

+776
-507
lines changed

portal-ui/src/screens/Console/Common/FormComponents/FileSelector/FileSelector.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ const FileSelector = ({
137137
}}
138138
disableRipple={false}
139139
disableFocusRipple={false}
140-
size="large"
140+
size="small"
141141
>
142142
<CancelIcon />
143143
</IconButton>
@@ -157,7 +157,7 @@ const FileSelector = ({
157157
}}
158158
disableRipple={false}
159159
disableFocusRipple={false}
160-
size="large"
160+
size="small"
161161
>
162162
<AttachFileIcon />
163163
</IconButton>

portal-ui/src/screens/Console/Common/FormComponents/common/styleLibrary.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,15 +1134,25 @@ export const fileInputStyles = {
11341134
border: "1px solid #EAEAEA",
11351135
width: "100%",
11361136
paddingLeft: 10,
1137+
display: "flex",
1138+
alignItems: "center",
1139+
justifyContent: "center",
1140+
height: 36,
1141+
maxWidth: 300,
11371142
},
11381143
textBoxContainer: {
11391144
border: "1px solid #EAEAEA",
11401145
borderRadius: 3,
1146+
height: 36,
11411147
padding: 5,
11421148
"& input": {
11431149
width: "100%",
11441150
margin: "auto",
11451151
},
1152+
display: "flex",
1153+
alignItems: "center",
1154+
justifyContent: "center",
1155+
maxWidth: 300,
11461156
},
11471157
};
11481158

portal-ui/src/screens/Console/Common/ScreenTitle/ScreenTitle.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,19 @@ const styles = (theme: Theme) =>
4242
},
4343
headerBarSubheader: {
4444
color: "grey",
45+
"@media (max-width: 900px)": {
46+
maxWidth: 200,
47+
},
4548
},
4649
screenTitle: {
4750
display: "flex",
4851
alignItems: "center",
4952
justifyContent: "space-between",
5053
padding: "1rem",
5154
borderBottom: "1px solid #EAEAEA",
55+
"@media (max-width: 600px)": {
56+
flexFlow: "column",
57+
},
5258
},
5359
titleColumn: {
5460
height: "auto",
@@ -63,6 +69,9 @@ const styles = (theme: Theme) =>
6369
leftItems: {
6470
display: "flex",
6571
alignItems: "center",
72+
"@media (max-width: 600px)": {
73+
flexFlow: "column",
74+
},
6675
},
6776
rightItems: {
6877
display: "flex",
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import React from "react";
2+
import { Stack } from "@mui/material";
3+
4+
type LabelValuePairProps = {
5+
label?: any;
6+
value?: any;
7+
orientation?: any;
8+
stkProps?: any;
9+
lblProps?: any;
10+
valProps?: any;
11+
};
12+
13+
const LabelValuePair = ({
14+
label = null,
15+
value = "-",
16+
orientation = "column",
17+
stkProps = {},
18+
lblProps = {},
19+
valProps = {},
20+
}: LabelValuePairProps) => {
21+
return (
22+
<Stack direction={{ xs: "column", sm: orientation }} {...stkProps}>
23+
<label style={{ marginRight: 5, fontWeight: 600 }} {...lblProps}>
24+
{label}
25+
</label>
26+
<label style={{ marginRight: 5, fontWeight: 500 }} {...valProps}>
27+
{value}
28+
</label>
29+
</Stack>
30+
);
31+
};
32+
33+
export default LabelValuePair;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React from "react";
2+
import { Stack } from "@mui/material";
3+
4+
const StackRow = ({
5+
children = null,
6+
...restProps
7+
}: {
8+
children?: any;
9+
[x: string]: any;
10+
}) => {
11+
return (
12+
<Stack
13+
direction={{ xs: "column", sm: "row" }}
14+
justifyContent="space-between"
15+
margin={"5px 0 5px 0"}
16+
spacing={{ xs: 1, sm: 2, md: 4 }}
17+
{...restProps}
18+
>
19+
{children}
20+
</Stack>
21+
);
22+
};
23+
export default StackRow;
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
import React from "react";
2+
import { Theme } from "@mui/material/styles";
3+
import createStyles from "@mui/styles/createStyles";
4+
import withStyles from "@mui/styles/withStyles";
5+
import { LinearProgress, Stack } from "@mui/material";
6+
import Grid from "@mui/material/Grid";
7+
import CircularProgress from "@mui/material/CircularProgress";
8+
import ErrorBlock from "../../../shared/ErrorBlock";
9+
import { CircleIcon } from "../../../../icons";
10+
import LabelValuePair from "./LabelValuePair";
11+
12+
interface IProgressBar {
13+
maxValue: number;
14+
currValue: number;
15+
label: string;
16+
renderFunction?: (element: string) => any;
17+
error: string;
18+
loading: boolean;
19+
classes: any;
20+
labels?: boolean;
21+
healthStatus?: string;
22+
}
23+
24+
const styles = (theme: Theme) =>
25+
createStyles({
26+
allValue: {
27+
fontSize: 16,
28+
fontWeight: 700,
29+
marginBottom: 8,
30+
},
31+
currentUsage: {
32+
fontSize: 12,
33+
marginTop: 8,
34+
},
35+
centerItem: {
36+
textAlign: "center",
37+
},
38+
});
39+
40+
export const BorderLinearProgress = withStyles((theme) => ({
41+
root: {
42+
height: 10,
43+
borderRadius: 5,
44+
},
45+
colorPrimary: {
46+
backgroundColor: "#F4F4F4",
47+
},
48+
bar: {
49+
borderRadius: 5,
50+
backgroundColor: "#081C42",
51+
},
52+
padChart: {
53+
padding: "5px",
54+
},
55+
}))(LinearProgress);
56+
57+
const SummaryUsageBar = ({
58+
classes,
59+
maxValue,
60+
currValue,
61+
healthStatus,
62+
renderFunction,
63+
loading,
64+
error,
65+
}: IProgressBar) => {
66+
const porcentualValue = (currValue * 100) / maxValue;
67+
68+
const renderComponent = () => {
69+
if (!loading) {
70+
return error !== "" ? (
71+
<ErrorBlock errorMessage={error} withBreak={false} />
72+
) : (
73+
<Grid item xs={12}>
74+
<BorderLinearProgress variant="determinate" value={porcentualValue} />
75+
<Stack
76+
direction={{ xs: "column", sm: "row" }}
77+
spacing={{ xs: 1, sm: 2, md: 4 }}
78+
alignItems={"stretch"}
79+
margin={"15px 0 15px 0"}
80+
>
81+
<LabelValuePair
82+
label={"Storage Capacity:"}
83+
orientation={"row"}
84+
value={
85+
renderFunction ? renderFunction(maxValue.toString()) : maxValue
86+
}
87+
/>
88+
<LabelValuePair
89+
label={"Used:"}
90+
orientation={"row"}
91+
value={
92+
renderFunction
93+
? renderFunction(currValue.toString())
94+
: currValue
95+
}
96+
/>
97+
{healthStatus && (
98+
<LabelValuePair
99+
orientation={"row"}
100+
label={"Health:"}
101+
value={
102+
<span className={healthStatus}>
103+
<CircleIcon />
104+
</span>
105+
}
106+
/>
107+
)}
108+
</Stack>
109+
</Grid>
110+
);
111+
}
112+
113+
return null;
114+
};
115+
116+
return (
117+
<React.Fragment>
118+
{loading && (
119+
<div className={classes.padChart}>
120+
<Grid item xs={12} className={classes.centerItem}>
121+
<CircularProgress
122+
color="primary"
123+
size={40}
124+
variant="indeterminate"
125+
/>
126+
</Grid>
127+
</div>
128+
)}
129+
{renderComponent()}
130+
</React.Fragment>
131+
);
132+
};
133+
134+
export default withStyles(styles)(SummaryUsageBar);

portal-ui/src/screens/Console/Tenants/TenantDetails/PodsSummary.tsx

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import createStyles from "@mui/styles/createStyles";
2121
import withStyles from "@mui/styles/withStyles";
2222
import {
2323
containerForHeader,
24+
tableStyles,
2425
tenantDetailsStyles,
2526
} from "../../Common/FormComponents/common/styleLibrary";
2627
import { niceDays } from "../../../../common/utils";
@@ -32,6 +33,7 @@ import { AppState } from "../../../../store";
3233
import { setTenantDetailsLoad } from "../actions";
3334
import { ErrorResponseHandler } from "../../../../common/types";
3435
import DeletePod from "./DeletePod";
36+
import { Grid } from "@mui/material";
3537

3638
interface IPodsSummary {
3739
classes: any;
@@ -44,6 +46,7 @@ interface IPodsSummary {
4446
const styles = (theme: Theme) =>
4547
createStyles({
4648
...tenantDetailsStyles,
49+
...tableStyles,
4750
...containerForHeader(theme.spacing(4)),
4851
});
4952

@@ -126,27 +129,29 @@ const PodsSummary = ({
126129
/>
127130
)}
128131
<h1 className={classes.sectionTitle}>Pods</h1>
129-
<TableWrapper
130-
columns={[
131-
{ label: "Name", elementKey: "name" },
132-
{ label: "Status", elementKey: "status" },
133-
{ label: "Age", elementKey: "time" },
134-
{ label: "Pod IP", elementKey: "podIP" },
135-
{
136-
label: "Restarts",
137-
elementKey: "restarts",
138-
renderFunction: (input) => {
139-
return input !== null ? input : 0;
132+
<Grid item xs={12} className={classes.tableBlock}>
133+
<TableWrapper
134+
columns={[
135+
{ label: "Name", elementKey: "name" },
136+
{ label: "Status", elementKey: "status" },
137+
{ label: "Age", elementKey: "time" },
138+
{ label: "Pod IP", elementKey: "podIP" },
139+
{
140+
label: "Restarts",
141+
elementKey: "restarts",
142+
renderFunction: (input) => {
143+
return input !== null ? input : 0;
144+
},
140145
},
141-
},
142-
{ label: "Node", elementKey: "node" },
143-
]}
144-
isLoading={loadingPods}
145-
records={pods}
146-
itemActions={podTableActions}
147-
entityName="Servers"
148-
idField="name"
149-
/>
146+
{ label: "Node", elementKey: "node" },
147+
]}
148+
isLoading={loadingPods}
149+
records={pods}
150+
itemActions={podTableActions}
151+
entityName="Servers"
152+
idField="name"
153+
/>
154+
</Grid>
150155
</Fragment>
151156
);
152157
};

portal-ui/src/screens/Console/Tenants/TenantDetails/PoolsSummary.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import withStyles from "@mui/styles/withStyles";
2222
import {
2323
actionsTray,
2424
containerForHeader,
25+
tableStyles,
2526
tenantDetailsStyles,
2627
} from "../../Common/FormComponents/common/styleLibrary";
2728
import { Button, TextField } from "@mui/material";
@@ -48,6 +49,7 @@ const styles = (theme: Theme) =>
4849
createStyles({
4950
...tenantDetailsStyles,
5051
...actionsTray,
52+
...tableStyles,
5153
...containerForHeader(theme.spacing(4)),
5254
});
5355

@@ -130,7 +132,7 @@ const PoolsSummary = ({
130132
<br />
131133
</Grid>
132134

133-
<Grid item xs={12}>
135+
<Grid item xs={12} className={classes.tableBlock}>
134136
<TableWrapper
135137
itemActions={[]}
136138
columns={[

portal-ui/src/screens/Console/Tenants/TenantDetails/SubnetLicenseTenant.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ interface ISubnetLicenseTenant {
4040
const styles = (theme: Theme) =>
4141
createStyles({
4242
paperContainer: {
43-
padding: "15px 15px 15px 50px",
43+
padding: "15px",
44+
display: "flex",
45+
alignItems: "center",
46+
justifyContent: "center",
4447
},
4548
licenseInfoValue: {
4649
textTransform: "none",

0 commit comments

Comments
 (0)