Basic dashboard drives (#998)

* Added Disk properties to admin_info

* Added Disk properties to admin_info

* Created DriveInfo cards

* Fixed drive card formatting

* Added Disk properties to admin_info

Created DriveInfo cards

Added Disk properties to admin_info

Fixed drive card formatting

Co-authored-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
This commit is contained in:
jinapurapu
2021-09-01 17:07:15 -07:00
committed by GitHub
parent 2fd4be91ad
commit 7bf3a6e3f1
14 changed files with 599 additions and 19 deletions

View File

@@ -34,9 +34,33 @@ import (
// swagger:model serverDrives // swagger:model serverDrives
type ServerDrives struct { type ServerDrives struct {
// available space
AvailableSpace int64 `json:"availableSpace,omitempty"`
// drive path
DrivePath string `json:"drivePath,omitempty"`
// endpoint
Endpoint string `json:"endpoint,omitempty"`
// healing
Healing bool `json:"healing,omitempty"`
// model
Model string `json:"model,omitempty"`
// root disk
RootDisk bool `json:"rootDisk,omitempty"`
// state // state
State string `json:"state,omitempty"` State string `json:"state,omitempty"`
// total space
TotalSpace int64 `json:"totalSpace,omitempty"`
// used space
UsedSpace int64 `json:"usedSpace,omitempty"`
// uuid // uuid
UUID string `json:"uuid,omitempty"` UUID string `json:"uuid,omitempty"`
} }

View File

@@ -1,23 +1,23 @@
{ {
"files": { "files": {
"main.css": "./static/css/main.8cfac526.chunk.css", "main.css": "./static/css/main.8cfac526.chunk.css",
"main.js": "./static/js/main.db2f3b23.chunk.js", "main.js": "./static/js/main.4cd0e515.chunk.js",
"main.js.map": "./static/js/main.db2f3b23.chunk.js.map", "main.js.map": "./static/js/main.4cd0e515.chunk.js.map",
"runtime-main.js": "./static/js/runtime-main.3fe0c1ac.js", "runtime-main.js": "./static/js/runtime-main.3fe0c1ac.js",
"runtime-main.js.map": "./static/js/runtime-main.3fe0c1ac.js.map", "runtime-main.js.map": "./static/js/runtime-main.3fe0c1ac.js.map",
"static/css/2.20c81d8d.chunk.css": "./static/css/2.20c81d8d.chunk.css", "static/css/2.60e04a19.chunk.css": "./static/css/2.60e04a19.chunk.css",
"static/js/2.015f2e34.chunk.js": "./static/js/2.015f2e34.chunk.js", "static/js/2.acaecd2d.chunk.js": "./static/js/2.acaecd2d.chunk.js",
"static/js/2.015f2e34.chunk.js.map": "./static/js/2.015f2e34.chunk.js.map", "static/js/2.acaecd2d.chunk.js.map": "./static/js/2.acaecd2d.chunk.js.map",
"index.html": "./index.html", "index.html": "./index.html",
"static/css/2.20c81d8d.chunk.css.map": "./static/css/2.20c81d8d.chunk.css.map", "static/css/2.20c81d8d.chunk.css.map": "./static/css/2.20c81d8d.chunk.css.map",
"static/css/main.8cfac526.chunk.css.map": "./static/css/main.8cfac526.chunk.css.map", "static/css/main.8cfac526.chunk.css.map": "./static/css/main.8cfac526.chunk.css.map",
"static/js/2.015f2e34.chunk.js.LICENSE.txt": "./static/js/2.015f2e34.chunk.js.LICENSE.txt" "static/js/2.acaecd2d.chunk.js.LICENSE.txt": "./static/js/2.acaecd2d.chunk.js.LICENSE.txt"
}, },
"entrypoints": [ "entrypoints": [
"static/js/runtime-main.3fe0c1ac.js", "static/js/runtime-main.3fe0c1ac.js",
"static/css/2.20c81d8d.chunk.css", "static/css/2.60e04a19.chunk.css",
"static/js/2.015f2e34.chunk.js", "static/js/2.acaecd2d.chunk.js",
"static/css/main.8cfac526.chunk.css", "static/css/main.8cfac526.chunk.css",
"static/js/main.db2f3b23.chunk.js" "static/js/main.4cd0e515.chunk.js"
] ]
} }

View File

@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="MinIO Console"/><link href="https://fonts.googleapis.com/css2?family=Lato:wght@400;500;700;900&display=swap" rel="stylesheet"/><link href="./styles/root-styles.css" rel="stylesheet"/><link rel="apple-touch-icon" sizes="180x180" href="./apple-icon-180x180.png"/><link rel="icon" type="image/png" sizes="32x32" href="./favicon-32x32.png"/><link rel="icon" type="image/png" sizes="96x96" href="./favicon-96x96.png"/><link rel="icon" type="image/png" sizes="16x16" href="./favicon-16x16.png"/><link rel="manifest" href="./manifest.json"/><link rel="mask-icon" href="./safari-pinned-tab.svg" color="#3a4e54"/><title>MinIO Console</title><link href="./static/css/2.20c81d8d.chunk.css" rel="stylesheet"><link href="./static/css/main.8cfac526.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"><div id="loader-block"><svg class="loader-svg-container" viewBox="22 22 44 44"><circle class="loader-style MuiCircularProgress-circle MuiCircularProgress-circleIndeterminate" cx="44" cy="44" r="20.2" fill="none" stroke-width="3.6"></circle></svg></div></div><script>!function(e){function r(r){for(var n,l,i=r[0],a=r[1],p=r[2],c=0,s=[];c<i.length;c++)l=i[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(f&&f(r);s.length;)s.shift()();return u.push.apply(u,p||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var a=t[i];0!==o[a]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="./";var i=this["webpackJsonpportal-ui"]=this["webpackJsonpportal-ui"]||[],a=i.push.bind(i);i.push=r,i=i.slice();for(var p=0;p<i.length;p++)r(i[p]);var f=a;t()}([])</script><script src="./static/js/2.015f2e34.chunk.js"></script><script src="./static/js/main.db2f3b23.chunk.js"></script></body></html> <!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="MinIO Console"/><link href="https://fonts.googleapis.com/css2?family=Lato:wght@400;500;700;900&display=swap" rel="stylesheet"/><link href="./styles/root-styles.css" rel="stylesheet"/><link rel="apple-touch-icon" sizes="180x180" href="./apple-icon-180x180.png"/><link rel="icon" type="image/png" sizes="32x32" href="./favicon-32x32.png"/><link rel="icon" type="image/png" sizes="96x96" href="./favicon-96x96.png"/><link rel="icon" type="image/png" sizes="16x16" href="./favicon-16x16.png"/><link rel="manifest" href="./manifest.json"/><link rel="mask-icon" href="./safari-pinned-tab.svg" color="#3a4e54"/><title>MinIO Console</title><link href="./static/css/2.60e04a19.chunk.css" rel="stylesheet"><link href="./static/css/main.8cfac526.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"><div id="loader-block"><svg class="loader-svg-container" viewBox="22 22 44 44"><circle class="loader-style MuiCircularProgress-circle MuiCircularProgress-circleIndeterminate" cx="44" cy="44" r="20.2" fill="none" stroke-width="3.6"></circle></svg></div></div><script>!function(e){function r(r){for(var n,l,i=r[0],a=r[1],p=r[2],c=0,s=[];c<i.length;c++)l=i[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(f&&f(r);s.length;)s.shift()();return u.push.apply(u,p||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var a=t[i];0!==o[a]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="./";var i=this["webpackJsonpportal-ui"]=this["webpackJsonpportal-ui"]||[],a=i.push.bind(i);i.push=r,i=i.slice();for(var p=0;p<i.length;p++)r(i[p]);var f=a;t()}([])</script><script src="./static/js/2.acaecd2d.chunk.js"></script><script src="./static/js/main.4cd0e515.chunk.js"></script></body></html>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,280 @@
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/*!
* Chart.js v2.9.4
* https://www.chartjs.org
* (c) 2020 Chart.js Contributors
* Released under the MIT License
*/
/*!
* cookie
* Copyright(c) 2012-2014 Roman Shtylman
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/
/*! Conditions:: INITIAL */
/*! Moment Duration Format v2.2.2
* https://github.com/jsmreese/moment-duration-format
* Date: 2018-02-16
*
* Duration format plugin function for the Moment.js library
* http://momentjs.com/
*
* Copyright 2018 John Madhavan-Reese
* Released under the MIT license
*/
/*! Production:: $accept : expression $end */
/*! Production:: css_value : ANGLE */
/*! Production:: css_value : CHS */
/*! Production:: css_value : EMS */
/*! Production:: css_value : EXS */
/*! Production:: css_value : FREQ */
/*! Production:: css_value : LENGTH */
/*! Production:: css_value : PERCENTAGE */
/*! Production:: css_value : REMS */
/*! Production:: css_value : RES */
/*! Production:: css_value : SUB css_value */
/*! Production:: css_value : TIME */
/*! Production:: css_value : VHS */
/*! Production:: css_value : VMAXS */
/*! Production:: css_value : VMINS */
/*! Production:: css_value : VWS */
/*! Production:: css_variable : CSS_VAR LPAREN CSS_CPROP COMMA math_expression RPAREN */
/*! Production:: css_variable : CSS_VAR LPAREN CSS_CPROP RPAREN */
/*! Production:: expression : math_expression EOF */
/*! Production:: math_expression : LPAREN math_expression RPAREN */
/*! Production:: math_expression : NESTED_CALC LPAREN math_expression RPAREN */
/*! Production:: math_expression : SUB PREFIX SUB NESTED_CALC LPAREN math_expression RPAREN */
/*! Production:: math_expression : css_value */
/*! Production:: math_expression : css_variable */
/*! Production:: math_expression : math_expression ADD math_expression */
/*! Production:: math_expression : math_expression DIV math_expression */
/*! Production:: math_expression : math_expression MUL math_expression */
/*! Production:: math_expression : math_expression SUB math_expression */
/*! Production:: math_expression : value */
/*! Production:: value : NUMBER */
/*! Production:: value : SUB NUMBER */
/*! Rule:: $ */
/*! Rule:: (--[0-9a-z-A-Z-]*) */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)% */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)Hz\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)ch\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)cm\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)deg\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)dpcm\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)dpi\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)dppx\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)em\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)ex\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)grad\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)in\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)kHz\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)mm\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)ms\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)pc\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)pt\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)px\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)rad\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)rem\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)s\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)turn\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)vh\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)vmax\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)vmin\b */
/*! Rule:: ([0-9]+(\.[0-9]*)?|\.[0-9]+)vw\b */
/*! Rule:: ([a-z]+) */
/*! Rule:: (calc) */
/*! Rule:: (var) */
/*! Rule:: , */
/*! Rule:: - */
/*! Rule:: \( */
/*! Rule:: \) */
/*! Rule:: \* */
/*! Rule:: \+ */
/*! Rule:: \/ */
/*! Rule:: \s+ */
/*! decimal.js-light v2.5.1 https://github.com/MikeMcl/decimal.js-light/LICENCE */
/**
* A better abstraction over CSS.
*
* @copyright Oleg Isonen (Slobodskoi) / Isonen 2014-present
* @website https://github.com/cssinjs/jss
* @license MIT
*/
/** @license React v0.20.2
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v16.10.2
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v17.0.1
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v17.0.2
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v17.0.2
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v17.0.2
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**!
* @fileOverview Kickass library to create and place poppers near their reference elements.
* @version 1.16.1-lts
* @license
* Copyright (c) 2016 Federico Zivolo and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
//! moment.js

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -55,9 +55,12 @@ const styles = (theme: Theme) =>
}, },
}, },
serversContainer: { serversContainer: {
height: 250, height: "auto",
overflow: "hidden" as const, overflow: "hidden" as const,
}, },
drivesContainer: {
overflow: "flex",
},
infoHeight: { infoHeight: {
height: 180, height: 180,
minWidth: 247, minWidth: 247,
@@ -140,6 +143,10 @@ const BasicDashboard = ({ classes, usage }: IDashboardProps) => {
classes.fixedHeight, classes.fixedHeight,
classes.serversContainer classes.serversContainer
); );
const expandedServersPaperContainer = clsx(
classes.paper,
classes.serversContainer
);
const prettyUsage = (usage: string | undefined) => { const prettyUsage = (usage: string | undefined) => {
if (usage === undefined) { if (usage === undefined) {
@@ -240,7 +247,7 @@ const BasicDashboard = ({ classes, usage }: IDashboardProps) => {
</Paper> </Paper>
</Grid> </Grid>
<Grid item xs={12} className={classes.serversAdj}> <Grid item xs={12} className={classes.serversAdj}>
<Paper className={serversPaperContainer}> <Paper className={expandedServersPaperContainer}>
<div> <div>
<Grid container direction="row" alignItems="center"> <Grid container direction="row" alignItems="center">
<Grid item className={classes.icon}> <Grid item className={classes.icon}>
@@ -254,20 +261,41 @@ const BasicDashboard = ({ classes, usage }: IDashboardProps) => {
</Grid> </Grid>
</Grid> </Grid>
</div> </div>
<div className={classes.serversListContainer}>
<div >
<div className={classes.cardsContainer}> <div className={classes.cardsContainer}>
{serverArray.map((server, index) => ( {serverArray.map((server, index) => (
<ServerInfoCard <ServerInfoCard
server={server} server={server}
key={`serverDS-${index.toString()}`} key={`serverDS-${index.toString()}`}
/> />
))} ))}
</div> </div>
</div>
<div>
<Grid container direction="row" alignItems="center">
<Grid item className={classes.icon}>
<StorageIcon />
</Grid>
<Grid item>
<Typography className={classes.elementTitle}>
{" "}
Drives
</Typography>
</Grid>
</Grid>
</div> </div>
</Paper> <div className={classes.cardsContainer}>
</Grid> {serverArray.map((server, index) => (
</Grid> server.drives.map((drive) => (
<DriveInfoCard drive={drive}/>
))) )}
</div>
</Paper>
</Grid>
</Grid>
</Grid> </Grid>
</Fragment> </Fragment>
); );
}; };

View File

@@ -0,0 +1,157 @@
// This file is part of MinIO Console Server
// Copyright (c) 2021 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import React from "react";
import { createStyles, Theme, withStyles } from "@material-ui/core/styles";
import ComputerIcon from "@material-ui/icons/Computer";
import HealIcon from "../../../../icons/HealIcon";
import Grid from "@material-ui/core/Grid";
import Paper from "@material-ui/core/Paper";
import { IDriveInfo } from "../types";
import { niceBytes } from "../../../../common/utils";
import { Tooltip } from "@material-ui/core";
import HelpIcon from "../../../../icons/HelpIcon";
const styles = (theme: Theme) =>
createStyles({
serverCard: {
padding: 15,
margin: 8,
width: "100%",
maxWidth: 620,
"& .computerIcon": {
marginRight: 10,
},
},
titleContainer: {
display: "flex",
},
cardIconContainer: {
display: "flex",
position: "relative",
alignItems: "center",
},
endpoint: {
color: "#000000",
fontSize: 20,
fontWeight: "bold",
position: "relative" as const,
textOverflow: "ellipsis",
whiteSpace: "nowrap",
overflow: "hidden",
},
stateContainer: {
display: "flex",
flexWrap: "wrap",
justifyContent: "space-between",
},
infoValue: {
fontWeight: 500,
color: "#777777",
fontSize: 14,
margin: "5px 4px",
display: "inline-flex",
"& strong": {
marginRight: 4,
},
},
redState: {
color: theme.palette.error.main,
},
greenState: {
color: theme.palette.success.main,
},
yellowState: {
color: theme.palette.warning.main,
},
greyState: {
color: "grey",
},
healthStatusIcon: {
position: "absolute",
fontSize: 10,
left: 18,
height: 10,
bottom: 5,
},
innerState: {
fontSize: 10,
marginLeft: 5,
display: "flex",
alignItems: "center",
marginTop: -3,
},
});
interface ICardProps {
classes: any;
drive: IDriveInfo;
}
const DriveInfoCard = ({ classes, drive }: ICardProps) => {
console.log(drive);
const driveStatusToClass = (health_status: string) => {
switch (health_status) {
case "offline":
return classes.redState;
case "ok":
return classes.greenState;
default:
return classes.greyState;
}
};
return (
<Paper className={classes.serverCard}>
<Grid container direction="row" alignItems="center">
<Grid item xs={12}>
<div className={classes.titleContainer}>
<div className={classes.cardIconContainer}>
<ComputerIcon className="computerIcon" />
<div className={classes.healthStatusIcon}>
{drive.state && (
<span className={driveStatusToClass(drive.state)}></span>
)}
</div>
</div>{" "}
<Tooltip title={drive.endpoint} placement="bottom">
<div className={classes.endpoint}>{drive.endpoint}</div>
</Tooltip>
<span className={classes.infoValue}>
{drive.healing && <HealIcon />}
{drive.rootDisk && <HelpIcon />}
</span>
</div>
</Grid>
<Grid item xs={12} className={classes.stateContainer}>
<span className={classes.infoValue}>
<strong>Total Space:</strong> {niceBytes(drive.totalSpace.toString())}
</span>
<span className={classes.infoValue}>
<strong>Used Space:</strong> {niceBytes(drive.usedSpace.toString())}
</span>
<span className={classes.infoValue}>
<strong>Available Space:</strong> {niceBytes(drive.availableSpace.toString())}
</span>
</Grid>
</Grid>
</Paper>
);
};
export default withStyles(styles)(DriveInfoCard);

View File

@@ -36,4 +36,13 @@ export interface ServerInfo {
export interface IDriveInfo { export interface IDriveInfo {
state: string; state: string;
uuid: string; uuid: string;
endpoint: string;
drivePath: string;
rootDisk: boolean;
healing: boolean;
model: string;
totalSpace: number;
usedSpace: number;
availableSpace: number;
} }

View File

@@ -87,7 +87,18 @@ func GetAdminInfo(ctx context.Context, client MinioAdmin) (*UsageInfo, error) {
var drives = []*models.ServerDrives{} var drives = []*models.ServerDrives{}
for _, drive := range serv.Disks { for _, drive := range serv.Disks {
drives = append(drives, &models.ServerDrives{State: drive.State, UUID: drive.UUID}) drives = append(drives, &models.ServerDrives{
State: drive.State,
UUID: drive.UUID,
Endpoint: drive.Endpoint,
RootDisk: drive.RootDisk,
DrivePath: drive.DrivePath,
Healing: drive.Healing,
Model: drive.Model,
TotalSpace: int64(drive.TotalSpace),
UsedSpace: int64(drive.UsedSpace),
AvailableSpace: int64(drive.AvailableSpace),
})
} }
var newServer = &models.ServerProperties{ var newServer = &models.ServerProperties{

View File

@@ -4950,9 +4950,33 @@ func init() {
"serverDrives": { "serverDrives": {
"type": "object", "type": "object",
"properties": { "properties": {
"availableSpace": {
"type": "integer"
},
"drivePath": {
"type": "string"
},
"endpoint": {
"type": "string"
},
"healing": {
"type": "boolean"
},
"model": {
"type": "string"
},
"rootDisk": {
"type": "boolean"
},
"state": { "state": {
"type": "string" "type": "string"
}, },
"totalSpace": {
"type": "integer"
},
"usedSpace": {
"type": "integer"
},
"uuid": { "uuid": {
"type": "string" "type": "string"
} }
@@ -10521,9 +10545,33 @@ func init() {
"serverDrives": { "serverDrives": {
"type": "object", "type": "object",
"properties": { "properties": {
"availableSpace": {
"type": "integer"
},
"drivePath": {
"type": "string"
},
"endpoint": {
"type": "string"
},
"healing": {
"type": "boolean"
},
"model": {
"type": "string"
},
"rootDisk": {
"type": "boolean"
},
"state": { "state": {
"type": "string" "type": "string"
}, },
"totalSpace": {
"type": "integer"
},
"usedSpace": {
"type": "integer"
},
"uuid": { "uuid": {
"type": "string" "type": "string"
} }

View File

@@ -3170,6 +3170,22 @@ definitions:
type: string type: string
state: state:
type: string type: string
endpoint:
type: string
drivePath:
type: string
rootDisk:
type: boolean
healing:
type: boolean
model:
type: string
totalSpace:
type: integer
usedSpace:
type: integer
availableSpace:
type: integer
arnsResponse: arnsResponse:
type: object type: object
properties: properties: