Introduce tabs for Dashboard (#785)

Also fixes the sync button

Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
This commit is contained in:
Daniel Valdivia
2021-06-03 16:02:45 -07:00
committed by GitHub
parent a9e82eb909
commit 76bdd9dded
17 changed files with 204 additions and 62 deletions

View File

@@ -1,25 +1,25 @@
{
"files": {
"main.css": "/static/css/main.a19f3d53.chunk.css",
"main.js": "/static/js/main.ed3c7e50.chunk.js",
"main.js.map": "/static/js/main.ed3c7e50.chunk.js.map",
"main.js": "/static/js/main.84931b31.chunk.js",
"main.js.map": "/static/js/main.84931b31.chunk.js.map",
"runtime-main.js": "/static/js/runtime-main.f48e99e5.js",
"runtime-main.js.map": "/static/js/runtime-main.f48e99e5.js.map",
"static/css/2.6b0fc1a4.chunk.css": "/static/css/2.6b0fc1a4.chunk.css",
"static/js/2.1fe0b485.chunk.js": "/static/js/2.1fe0b485.chunk.js",
"static/js/2.1fe0b485.chunk.js.map": "/static/js/2.1fe0b485.chunk.js.map",
"static/js/2.d6ec6486.chunk.js": "/static/js/2.d6ec6486.chunk.js",
"static/js/2.d6ec6486.chunk.js.map": "/static/js/2.d6ec6486.chunk.js.map",
"index.html": "/index.html",
"static/css/2.6b0fc1a4.chunk.css.map": "/static/css/2.6b0fc1a4.chunk.css.map",
"static/css/main.a19f3d53.chunk.css.map": "/static/css/main.a19f3d53.chunk.css.map",
"static/js/2.1fe0b485.chunk.js.LICENSE.txt": "/static/js/2.1fe0b485.chunk.js.LICENSE.txt",
"static/js/2.d6ec6486.chunk.js.LICENSE.txt": "/static/js/2.d6ec6486.chunk.js.LICENSE.txt",
"static/media/minio_console_logo.0837460e.svg": "/static/media/minio_console_logo.0837460e.svg",
"static/media/minio_operator_logo.1312b7c9.svg": "/static/media/minio_operator_logo.1312b7c9.svg"
},
"entrypoints": [
"static/js/runtime-main.f48e99e5.js",
"static/css/2.6b0fc1a4.chunk.css",
"static/js/2.1fe0b485.chunk.js",
"static/js/2.d6ec6486.chunk.js",
"static/css/main.a19f3d53.chunk.css",
"static/js/main.ed3c7e50.chunk.js"
"static/js/main.84931b31.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 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.6b0fc1a4.chunk.css" rel="stylesheet"><link href="/static/css/main.a19f3d53.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></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.1fe0b485.chunk.js"></script><script src="/static/js/main.ed3c7e50.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 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.6b0fc1a4.chunk.css" rel="stylesheet"><link href="/static/css/main.a19f3d53.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></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.d6ec6486.chunk.js"></script><script src="/static/js/main.84931b31.chunk.js"></script></body></html>

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

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

@@ -43,6 +43,9 @@ import SingleRepWidget from "./Widgets/SingleRepWidget";
import DateTimePickerWrapper from "../../Common/FormComponents/DateTimePickerWrapper/DateTimePickerWrapper";
import api from "../../../../common/api";
import SyncIcon from "../../../../icons/SyncIcon";
import Tabs from "@material-ui/core/Tabs";
import Tab from "@material-ui/core/Tab";
import { TabPanel } from "../../../shared/tabs";
interface IPrDashboard {
classes: any;
@@ -74,6 +77,7 @@ const PrDashboard = ({ classes, displayErrorMessage }: IPrDashboard) => {
const [loading, setLoading] = useState<boolean>(true);
const [panelInformation, setPanelInformation] =
useState<IDashboardPanel[]>(panelsConfiguration);
const [curTab, setCurTab] = useState<number>(0);
const minHeight = 600;
const colsInGrid = 8;
@@ -89,7 +93,7 @@ const PrDashboard = ({ classes, displayErrorMessage }: IPrDashboard) => {
};
const panels = useCallback(
(width: number) => {
(width: number, filterPanels?: number[] | null) => {
const singlePanelWidth = width / colsInGrid + xSpacing / 2;
const componentToUse = (value: IDashboardPanel, index: number) => {
@@ -101,6 +105,7 @@ const PrDashboard = ({ classes, displayErrorMessage }: IPrDashboard) => {
panelItem={value}
timeStart={timeStart}
timeEnd={timeEnd}
propLoading={loading}
/>
);
case widgetType.pieChart:
@@ -110,6 +115,7 @@ const PrDashboard = ({ classes, displayErrorMessage }: IPrDashboard) => {
panelItem={value}
timeStart={timeStart}
timeEnd={timeEnd}
propLoading={loading}
/>
);
case widgetType.linearGraph:
@@ -119,6 +125,7 @@ const PrDashboard = ({ classes, displayErrorMessage }: IPrDashboard) => {
panelItem={value}
timeStart={timeStart}
timeEnd={timeEnd}
propLoading={loading}
hideYAxis={value.disableYAxis}
xAxisFormatter={value.xAxisFormatter}
yAxisFormatter={value.yAxisFormatter}
@@ -136,6 +143,7 @@ const PrDashboard = ({ classes, displayErrorMessage }: IPrDashboard) => {
panelItem={value}
timeStart={timeStart}
timeEnd={timeEnd}
propLoading={loading}
/>
);
case widgetType.singleRep:
@@ -146,6 +154,7 @@ const PrDashboard = ({ classes, displayErrorMessage }: IPrDashboard) => {
panelItem={value}
timeStart={timeStart}
timeEnd={timeEnd}
propLoading={loading}
color={value.color as string}
fillColor={fillColor as string}
/>
@@ -155,13 +164,21 @@ const PrDashboard = ({ classes, displayErrorMessage }: IPrDashboard) => {
}
};
return panelInformation.map((val, index) => {
return (
<div key={val.layoutIdentifier}>{componentToUse(val, index)}</div>
);
});
return panelInformation
.filter((val) => {
if (filterPanels) {
return filterPanels.indexOf(val.id) > -1;
} else {
return true;
}
})
.map((val, index) => {
return (
<div key={val.layoutIdentifier}>{componentToUse(val, index)}</div>
);
});
},
[panelInformation, dashboardDistr, timeEnd, timeStart]
[panelInformation, dashboardDistr, timeEnd, timeStart, loading]
);
const fetchUsage = useCallback(() => {
@@ -211,6 +228,19 @@ const PrDashboard = ({ classes, displayErrorMessage }: IPrDashboard) => {
}
}, [loading, fetchUsage]);
const a11yProps = (index: any) => {
return {
id: `simple-tab-${index}`,
"aria-controls": `simple-tabpanel-${index}`,
};
};
const summaryPanels = [
1, 64, 65, 68, 52, 44, 61, 80, 81, 66, 62, 53, 63, 50, 69, 70, 9, 78,
];
const resourcesPanels = [76, 77, 11, 8, 82, 74];
const requestsPanels = [60, 71, 17, 73];
return (
<Grid container className={classes.container}>
<Grid
@@ -233,29 +263,97 @@ const PrDashboard = ({ classes, displayErrorMessage }: IPrDashboard) => {
Sync
</Button>
</Grid>
<Grid item xs={12} className={classes.widgetsContainer}>
<AutoSizer style={autoSizerStyleProp}>
{({ width, height }: any) => {
let hpanel = height < minHeight ? minHeight : height;
if (hpanel > 380) {
hpanel = 480;
}
const totalWidth = width > 1920 ? 1920 : width;
return (
<ReactGridLayout
width={totalWidth}
cols={colsInGrid}
containerPadding={[xSpacing, ySpacing]}
onLayoutChange={saveDashboardDistribution}
layout={dashboardDistr}
rowHeight={hpanel / 6}
style={{ margin: "0 auto", width: totalWidth }}
>
{panels(width)}
</ReactGridLayout>
);
<Grid item xs={12}>
<Tabs
indicatorColor="primary"
textColor="primary"
aria-label="cluster-tabs"
variant="scrollable"
scrollButtons="auto"
value={curTab}
onChange={(e: React.ChangeEvent<{}>, newValue: number) => {
console.log(newValue);
setCurTab(newValue);
}}
</AutoSizer>
>
<Tab label="Summary" {...a11yProps(0)} />
<Tab label="Traffic" {...a11yProps(1)} />
<Tab label="Resources" {...a11yProps(2)} />
</Tabs>
</Grid>
<Grid item xs={12} className={classes.widgetsContainer}>
<TabPanel index={0} value={curTab}>
<AutoSizer style={autoSizerStyleProp}>
{({ width, height }: any) => {
let hpanel = height < minHeight ? minHeight : height;
if (hpanel > 380) {
hpanel = 480;
}
const totalWidth = width > 1920 ? 1920 : width;
return (
<ReactGridLayout
width={totalWidth}
cols={colsInGrid}
containerPadding={[xSpacing, ySpacing]}
onLayoutChange={saveDashboardDistribution}
layout={dashboardDistr}
rowHeight={hpanel / 6}
style={{ margin: "0 auto", width: totalWidth }}
>
{panels(width, summaryPanels)}
</ReactGridLayout>
);
}}
</AutoSizer>
</TabPanel>
<TabPanel index={1} value={curTab}>
<AutoSizer style={autoSizerStyleProp}>
{({ width, height }: any) => {
let hpanel = height < minHeight ? minHeight : height;
if (hpanel > 380) {
hpanel = 480;
}
const totalWidth = width > 1920 ? 1920 : width;
return (
<ReactGridLayout
width={totalWidth}
cols={colsInGrid}
containerPadding={[xSpacing, ySpacing]}
onLayoutChange={saveDashboardDistribution}
layout={dashboardDistr}
rowHeight={hpanel / 6}
style={{ margin: "0 auto", width: totalWidth }}
>
{panels(width, requestsPanels)}
</ReactGridLayout>
);
}}
</AutoSizer>
</TabPanel>
<TabPanel index={2} value={curTab}>
<AutoSizer style={autoSizerStyleProp}>
{({ width, height }: any) => {
let hpanel = height < minHeight ? minHeight : height;
if (hpanel > 380) {
hpanel = 480;
}
const totalWidth = width > 1920 ? 1920 : width;
return (
<ReactGridLayout
width={totalWidth}
cols={colsInGrid}
containerPadding={[xSpacing, ySpacing]}
onLayoutChange={saveDashboardDistribution}
layout={dashboardDistr}
rowHeight={hpanel / 6}
style={{ margin: "0 auto", width: totalWidth }}
>
{panels(width, resourcesPanels)}
</ReactGridLayout>
);
}}
</AutoSizer>
</TabPanel>
</Grid>
</Grid>
);

View File

@@ -41,6 +41,7 @@ interface IBarChartWidget {
panelItem: IDashboardPanel;
timeStart: MaterialUiPickersDate;
timeEnd: MaterialUiPickersDate;
propLoading: boolean;
displayErrorMessage: any;
}
@@ -76,11 +77,19 @@ const BarChartWidget = ({
panelItem,
timeStart,
timeEnd,
propLoading,
displayErrorMessage,
}: IBarChartWidget) => {
const [loading, setLoading] = useState<boolean>(true);
const [data, setData] = useState<any>([]);
const [result, setResult] = useState<IDashboardPanel | null>(null);
useEffect(() => {
if (propLoading) {
setLoading(true);
}
}, [propLoading]);
useEffect(() => {
if (loading) {
let stepCalc = 0;

View File

@@ -42,6 +42,7 @@ interface ILinearGraphWidget {
panelItem: IDashboardPanel;
timeStart: MaterialUiPickersDate;
timeEnd: MaterialUiPickersDate;
propLoading: boolean;
displayErrorMessage: any;
hideYAxis?: boolean;
yAxisFormatter?: (item: string) => string;
@@ -84,6 +85,7 @@ const LinearGraphWidget = ({
displayErrorMessage,
timeStart,
timeEnd,
propLoading,
panelItem,
hideYAxis = false,
yAxisFormatter = (item: string) => item,
@@ -93,6 +95,13 @@ const LinearGraphWidget = ({
const [loading, setLoading] = useState<boolean>(true);
const [data, setData] = useState<object[]>([]);
const [result, setResult] = useState<IDashboardPanel | null>(null);
useEffect(() => {
if (propLoading) {
setLoading(true);
}
}, [propLoading]);
useEffect(() => {
if (loading) {
let stepCalc = 0;

View File

@@ -34,6 +34,7 @@ interface IPieChartWidget {
panelItem: IDashboardPanel;
timeStart: MaterialUiPickersDate;
timeEnd: MaterialUiPickersDate;
propLoading: boolean;
displayErrorMessage: any;
}
@@ -54,6 +55,7 @@ const PieChartWidget = ({
panelItem,
timeStart,
timeEnd,
propLoading,
displayErrorMessage,
}: IPieChartWidget) => {
const [loading, setLoading] = useState<boolean>(true);
@@ -61,6 +63,12 @@ const PieChartWidget = ({
const [dataOuter, setDataOuter] = useState<object[]>([]);
const [result, setResult] = useState<IDashboardPanel | null>(null);
useEffect(() => {
if (propLoading) {
setLoading(true);
}
}, [propLoading]);
useEffect(() => {
if (loading) {
let stepCalc = 0;

View File

@@ -33,6 +33,7 @@ interface ISingleRepWidget {
panelItem: IDashboardPanel;
timeStart: MaterialUiPickersDate;
timeEnd: MaterialUiPickersDate;
propLoading: boolean;
displayErrorMessage: any;
color: string;
fillColor: string;
@@ -55,6 +56,7 @@ const SingleRepWidget = ({
panelItem,
timeStart,
timeEnd,
propLoading,
displayErrorMessage,
color,
fillColor,
@@ -62,6 +64,13 @@ const SingleRepWidget = ({
const [loading, setLoading] = useState<boolean>(true);
const [data, setData] = useState<IDataSRep[]>([]);
const [result, setResult] = useState<IDashboardPanel | null>(null);
useEffect(() => {
if (propLoading) {
setLoading(true);
}
}, [propLoading]);
useEffect(() => {
if (loading) {
let stepCalc = 0;

View File

@@ -30,6 +30,7 @@ interface ISingleValueWidget {
panelItem: IDashboardPanel;
timeStart: MaterialUiPickersDate;
timeEnd: MaterialUiPickersDate;
propLoading: boolean;
displayErrorMessage: any;
classes: any;
}
@@ -57,11 +58,19 @@ const SingleValueWidget = ({
panelItem,
timeStart,
timeEnd,
propLoading,
displayErrorMessage,
classes,
}: ISingleValueWidget) => {
const [loading, setLoading] = useState<boolean>(true);
const [loading, setLoading] = useState<boolean>(false);
const [data, setData] = useState<string>("");
useEffect(() => {
if (propLoading) {
setLoading(true);
}
}, [propLoading]);
useEffect(() => {
if (loading) {
let stepCalc = 0;

View File

@@ -68,19 +68,19 @@ export const defaultWidgetsLayout: Layout[] = [
static: false,
},
{
w: 2,
w: 4,
h: 2,
x: 3,
y: 0,
x: 4,
y: 2,
i: "panel-4",
minW: 2,
moved: false,
static: false,
},
{
w: 2,
w: 4,
h: 2,
x: 5,
x: 4,
y: 0,
i: "panel-5",
minW: 2,
@@ -128,10 +128,10 @@ export const defaultWidgetsLayout: Layout[] = [
static: false,
},
{
w: 2,
h: 2,
x: 3,
y: 2,
w: 4,
h: 3,
x: 0,
y: 4,
i: "panel-10",
minW: 2,
moved: false,
@@ -140,7 +140,7 @@ export const defaultWidgetsLayout: Layout[] = [
{
w: 1,
h: 1,
x: 7,
x: 3,
y: 0,
i: "panel-11",
minW: 1,
@@ -150,7 +150,7 @@ export const defaultWidgetsLayout: Layout[] = [
{
w: 1,
h: 1,
x: 7,
x: 3,
y: 1,
i: "panel-12",
minW: 1,
@@ -178,10 +178,10 @@ export const defaultWidgetsLayout: Layout[] = [
static: false,
},
{
w: 2,
h: 2,
x: 5,
y: 2,
w: 4,
h: 3,
x: 4,
y: 4,
i: "panel-15",
minW: 2,
moved: false,
@@ -210,7 +210,7 @@ export const defaultWidgetsLayout: Layout[] = [
{
w: 1,
h: 1,
x: 7,
x: 3,
y: 2,
i: "panel-20",
minW: 1,
@@ -220,7 +220,7 @@ export const defaultWidgetsLayout: Layout[] = [
{
w: 1,
h: 1,
x: 7,
x: 3,
y: 3,
i: "panel-21",
minW: 1,