@@ -21,12 +21,12 @@ import Grid from "@material-ui/core/Grid";
2121import Paper from "@material-ui/core/Paper" ;
2222import Typography from "@material-ui/core/Typography" ;
2323import { Usage } from "../types" ;
24- import { niceBytes , niceDays } from "../../../../common/utils" ;
24+ import { niceBytes } from "../../../../common/utils" ;
2525import DnsIcon from "@material-ui/icons/Dns" ;
2626import EgressIcon from "../../../../icons/EgressIcon" ;
2727import ReportedUsageIcon from "../../../../icons/ReportedUsageIcon" ;
28+ import ServerInfoCard from "./ServerInfoCard" ;
2829import { BucketsIcon } from "../../../../icons" ;
29- import { ServerInfoCard } from "./ServerInfoCard"
3030
3131const 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
111126interface IDashboardProps {
@@ -115,7 +130,11 @@ interface IDashboardProps {
115130
116131const 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