Skip to content

Commit 6cb8c51

Browse files
bexsoftBenjamin Perez
andauthored
Restructured basic dashboard elements (#988)
Co-authored-by: Benjamin Perez <[email protected]>
1 parent 48313d6 commit 6cb8c51

File tree

14 files changed

+448
-146
lines changed

14 files changed

+448
-146
lines changed

models/server_drives.go

Lines changed: 70 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

models/server_properties.go

Lines changed: 70 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

portal-ui/src/icons/DeleteIcon.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ import React from "react";
1818
import { SvgIcon } from "@material-ui/core";
1919
import { IIcon } from "./props";
2020

21-
interface IDeleteIcon {
22-
width?: number;
23-
}
24-
2521
const DeleteIcon = ({ width = 24 }: IIcon) => {
2622
return (
2723
<SvgIcon style={{ width: width, height: width }}>

portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ListObjects/ListObjects.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ import {
6262
Route,
6363
} from "../../../../ObjectBrowser/reducers";
6464
import CreateFolderModal from "./CreateFolderModal";
65-
import UploadFile from "../../../../../../icons/UploadFile";
6665
import { download } from "../utils";
6766
import {
6867
setErrorSnackMessage,

portal-ui/src/screens/Console/Common/TableWrapper/TableActionButton.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ import { createStyles, withStyles } from "@material-ui/core/styles";
2020
import { IconButton } from "@material-ui/core";
2121
import ViewIcon from "./TableActionIcons/ViewIcon";
2222
import ShareIcon from "./TableActionIcons/ShareIcon";
23-
import DeleteIcon from "./TableActionIcons/DeleteIcon";
24-
import DescriptionIcon from "./TableActionIcons/DescriptionIcon";
2523
import CloudIcon from "./TableActionIcons/CloudIcon";
2624
import ConsoleIcon from "./TableActionIcons/ConsoleIcon";
2725
import DownloadIcon from "./TableActionIcons/DownloadIcon";

portal-ui/src/screens/Console/Dashboard/BasicDashboard/BasicDashboard.tsx

Lines changed: 60 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ import Grid from "@material-ui/core/Grid";
2121
import Paper from "@material-ui/core/Paper";
2222
import Typography from "@material-ui/core/Typography";
2323
import { Usage } from "../types";
24-
import { niceBytes, niceDays } from "../../../../common/utils";
24+
import { niceBytes } from "../../../../common/utils";
2525
import DnsIcon from "@material-ui/icons/Dns";
2626
import EgressIcon from "../../../../icons/EgressIcon";
2727
import ReportedUsageIcon from "../../../../icons/ReportedUsageIcon";
28+
import ServerInfoCard from "./ServerInfoCard";
2829
import { BucketsIcon } from "../../../../icons";
29-
import {ServerInfoCard} from "./ServerInfoCard"
3030

3131
const styles = (theme: Theme) =>
3232
createStyles({
@@ -38,17 +38,22 @@ const styles = (theme: Theme) =>
3838
border: "#eaedee 1px solid",
3939
borderRadius: 5,
4040
boxShadow: "none",
41+
marginBottom: 15,
4142
},
4243
fixedHeight: {
4344
height: 165,
4445
minWidth: 247,
4546
marginRight: 20,
4647
padding: "25px 28px",
47-
"& svg": {
48+
"& svg:not(.computerIcon)": {
4849
maxHeight: 18,
4950
},
5051
},
51-
infoHeight: {
52+
serversContainer: {
53+
height: 250,
54+
overflow: "hidden" as const,
55+
},
56+
infoHeight: {
5257
height: 180,
5358
minWidth: 247,
5459
marginRight: 20,
@@ -67,7 +72,7 @@ const styles = (theme: Theme) =>
6772
fontSize: "20px",
6873
fontWeight: "bold",
6974
},
70-
infoValue: {
75+
infoValue: {
7176
fontWeight: 500,
7277
color: "#777777",
7378
fontSize: 14,
@@ -80,23 +85,20 @@ const styles = (theme: Theme) =>
8085
notationContainer: {
8186
display: "flex",
8287
flexWrap: "wrap",
88+
marginTop: 20,
8389
},
8490
dashboardBG: {
8591
width: 390,
8692
height: 255,
87-
zIndex: 500,
88-
position: "absolute",
93+
zIndex: -1,
94+
position: "fixed",
8995
backgroundSize: "fill",
9096
backgroundImage: "url(/images/BG_IllustrationDarker.svg)",
9197
backgroundPosition: "right bottom",
9298
right: 0,
9399
bottom: 0,
94100
backgroundRepeat: "no-repeat",
95101
},
96-
dashboardContainer: {
97-
zIndex: 600,
98-
position: "absolute",
99-
},
100102
elementTitle: {
101103
fontWeight: 500,
102104
color: "#777777",
@@ -106,6 +108,19 @@ const styles = (theme: Theme) =>
106108
smallUnit: {
107109
fontSize: 20,
108110
},
111+
serversListContainer: {
112+
overflowY: "auto",
113+
height: 200,
114+
width: "100%",
115+
},
116+
cardsContainer: {
117+
display: "flex",
118+
flexWrap: "wrap",
119+
justifyContent: "center",
120+
},
121+
serversAdj: {
122+
maxWidth: 1380,
123+
},
109124
});
110125

111126
interface IDashboardProps {
@@ -115,7 +130,11 @@ interface IDashboardProps {
115130

116131
const BasicDashboard = ({ classes, usage }: IDashboardProps) => {
117132
const fixedHeightPaper = clsx(classes.paper, classes.fixedHeight);
118-
133+
const serversPaperContainer = clsx(
134+
classes.paper,
135+
classes.fixedHeight,
136+
classes.serversContainer
137+
);
119138

120139
const prettyUsage = (usage: string | undefined) => {
121140
if (usage === undefined) {
@@ -144,13 +163,11 @@ const BasicDashboard = ({ classes, usage }: IDashboardProps) => {
144163
return usage.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
145164
};
146165

147-
148166
const makeServerArray = (usage: Usage | null) => {
149167
if (usage != null) {
150-
usage.servers.forEach((s) => (s.uptime = niceDays(s.uptime)));
151168
return usage.servers.sort(function (a, b) {
152-
var nameA = a.endpoint.toUpperCase();
153-
var nameB = b.endpoint.toUpperCase();
169+
var nameA = a.endpoint.toLowerCase();
170+
var nameB = b.endpoint.toLowerCase();
154171
if (nameA < nameB) {
155172
return -1;
156173
}
@@ -169,7 +186,7 @@ const BasicDashboard = ({ classes, usage }: IDashboardProps) => {
169186
<div className={classes.dashboardBG} />
170187
<Grid container className={classes.dashboardContainer}>
171188
<Grid container spacing={3} className={classes.container}>
172-
<Grid item className={classes.notationContainer}>
189+
<Grid item xs={12} className={classes.notationContainer}>
173190
<Paper className={fixedHeightPaper}>
174191
<Grid container direction="row" alignItems="center">
175192
<Grid item className={classes.icon}>
@@ -216,25 +233,33 @@ const BasicDashboard = ({ classes, usage }: IDashboardProps) => {
216233
{usage ? prettyNumber(usage.objects) : 0}
217234
</Typography>
218235
</Paper>
219-
<Paper className={classes.paper}>
220-
<Grid item className={classes.notationContainer}>
221-
<Grid item className={classes.icon}>
222-
<DnsIcon />
223-
<Typography className={classes.elementTitle}>
224-
Servers
225-
</Typography>
236+
</Grid>
237+
<Grid item xs={12} className={classes.serversAdj}>
238+
<Paper className={serversPaperContainer}>
239+
<div>
240+
<Grid container direction="row" alignItems="center">
241+
<Grid item className={classes.icon}>
242+
<DnsIcon />
243+
</Grid>
244+
<Grid item>
245+
<Typography className={classes.elementTitle}>
246+
{" "}
247+
Servers
248+
</Typography>
249+
</Grid>
226250
</Grid>
227-
<Grid item className={classes.notationContainer}>
228-
{serverArray.map((server) => {
229-
return(
230-
<ServerInfoCard server={server} classes={classes}/>
231-
)
232-
})}
233-
234-
</Grid>
235-
236-
</Grid>
237-
</Paper>
251+
</div>
252+
<div className={classes.serversListContainer}>
253+
<div className={classes.cardsContainer}>
254+
{serverArray.map((server, index) => (
255+
<ServerInfoCard
256+
server={server}
257+
key={`serverDS-${index.toString()}`}
258+
/>
259+
))}
260+
</div>
261+
</div>
262+
</Paper>
238263
</Grid>
239264
</Grid>
240265
</Grid>

0 commit comments

Comments
 (0)