Skip to content

Commit 437c56c

Browse files
Vonngclaude
andcommitted
fix(ui): make the dashboard and bucket list usable on narrow screens
Mobile metrics and bucket panels now scroll instead of clipping, and the dashboard stat cards and action menus pick up the spacing, overflow, and alignment rules the rest of the console already used. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 8764f5d commit 437c56c

8 files changed

Lines changed: 110 additions & 13 deletions

File tree

api/admin_info.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ var widgets = []Metric{
668668
Targets: []Target{
669669
{
670670
Expr: `sum by (server,api) (increase(minio_s3_requests_total{$__query}[$__rate_interval]))`,
671-
LegendFormat: "{{server,api}}",
671+
LegendFormat: "{{server}}, {{api}}",
672672
},
673673
},
674674
},
@@ -685,7 +685,7 @@ var widgets = []Metric{
685685
Targets: []Target{
686686
{
687687
Expr: `sum by (server,api) (increase(minio_s3_requests_errors_total{$__query}[$__rate_interval]))`,
688-
LegendFormat: "{{server,api}}",
688+
LegendFormat: "{{server}}, {{api}}",
689689
},
690690
},
691691
},

web-app/public/styles/root-styles.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,8 @@ body {
1818
justify-content: center;
1919
align-items: center;
2020
}
21+
22+
#download-widget-main-menu,
23+
#upload-files-main-menu {
24+
min-width: 180px;
25+
}

web-app/src/screens/Console/Buckets/ListBuckets/UploadFilesButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ const UploadFilesButton = ({
113113
>
114114
<Button
115115
id={"upload-main"}
116-
aria-controls={`upload-main-menu`}
116+
aria-controls={`upload-files-main-menu`}
117117
aria-haspopup="true"
118118
aria-expanded={openUploadMenu ? "true" : undefined}
119119
onClick={handleClick}
@@ -125,7 +125,7 @@ const UploadFilesButton = ({
125125
/>
126126
</TooltipWrapper>
127127
<DropdownSelector
128-
id={"upload-main-menu"}
128+
id={"upload-files-main-menu"}
129129
options={[
130130
{
131131
label: "Upload File",

web-app/src/screens/Console/Dashboard/BasicDashboard/BasicDashboard.tsx

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ import {
3232
TotalObjectsIcon,
3333
UptimeIcon,
3434
} from "mds";
35-
import { calculateBytes, representationNumber } from "../../../../common/utils";
35+
import {
36+
calculateBytes,
37+
niceDays,
38+
representationNumber,
39+
} from "../../../../common/utils";
3640
import StatusCountCard from "./StatusCountCard";
3741
import groupBy from "lodash/groupBy";
3842
import ServersList from "./ServersList";
@@ -42,7 +46,11 @@ import { Link } from "react-router-dom";
4246
import { IAM_PAGES } from "../../../../common/SecureComponent/permissions";
4347
import TimeStatItem from "../TimeStatItem";
4448
import TooltipWrapper from "../../Common/TooltipWrapper/TooltipWrapper";
45-
import { AdminInfoResponse, ServerDrives } from "api/consoleApi";
49+
import {
50+
AdminInfoResponse,
51+
ServerDrives,
52+
ServerProperties,
53+
} from "api/consoleApi";
4654

4755
const BoxItem = ({ children }: { children: any }) => {
4856
return (
@@ -94,13 +102,30 @@ const prettyUsage = (usage: string | undefined) => {
94102
return calculateBytes(usage);
95103
};
96104

105+
const getClusterUptime = (servers: ServerProperties[]) => {
106+
const onlineUptimes = servers
107+
.filter(
108+
(server) =>
109+
server.state === "online" &&
110+
typeof server.uptime === "number" &&
111+
server.uptime >= 0,
112+
)
113+
.map((server) => server.uptime as number);
114+
115+
if (!onlineUptimes.length) {
116+
return "n/a";
117+
}
118+
119+
return niceDays(Math.min(...onlineUptimes).toString()).trim() || "0 seconds";
120+
};
121+
97122
const BasicDashboard = ({ usage }: IDashboardProps) => {
98123
const usageValue = usage && usage.usage ? usage.usage.toString() : "0";
99124
const usageToRepresent = prettyUsage(usageValue);
100-
101-
const { lastScan = "n/a", lastHeal = "n/a", upTime = "n/a" } = {};
102-
103125
const serverList = getServersList(usage);
126+
const lastScan = "n/a";
127+
const lastHeal = "n/a";
128+
const upTime = getClusterUptime(serverList);
104129

105130
let allDrivesArray: ServerDrives[] = [];
106131

web-app/src/screens/Console/Dashboard/DashboardItemBox.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ const DashboardItemBox = ({ children }: { children: any }) => {
2222
<Box
2323
withBorders
2424
sx={{
25-
borderRadius: "3px",
26-
padding: 15,
25+
borderRadius: 12,
26+
padding: "16px 20px",
2727
height: 136,
2828
maxWidth: "100%",
2929
[`@media (max-width: ${breakPoints.sm}px)`]: {
30-
padding: 5,
30+
padding: 10,
3131
height: "auto",
3232
},
3333
[`@media (max-width: ${breakPoints.md}px)`]: {

web-app/src/screens/Console/Dashboard/DownloadWidgetDataButton.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,17 @@ const DownloadWidgetDataButton = ({
119119
backgroundColor: "transparent",
120120
border: 0,
121121
padding: 0,
122+
width: 32,
123+
height: 32,
124+
display: "flex",
125+
alignItems: "center",
126+
justifyContent: "center",
127+
borderRadius: 4,
122128
cursor: "pointer",
123129
"& svg": {
124130
color: "#D0D0D0",
125-
height: 16,
131+
width: 18,
132+
height: 18,
126133
},
127134
"&:hover": {
128135
"& svg": {

web-app/src/screens/Console/Dashboard/Prometheus/PrDashboard.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import React, { Fragment, useState } from "react";
1818
import {
1919
Box,
20+
breakPoints,
2021
Button,
2122
Grid,
2223
HelpBox,
@@ -337,6 +338,27 @@ const PrDashboard = ({ apiPrefix = "admin", usage }: IPrDashboard) => {
337338
horizontal
338339
options={tabsOptions}
339340
currentTabOrPath={curTab}
341+
sx={{
342+
[`@media (max-width: ${breakPoints.sm}px)`]: {
343+
minWidth: 0,
344+
"& > .optionsContainer": {
345+
minWidth: 0,
346+
},
347+
"& > .optionsContainer > .optionsList": {
348+
minWidth: 0,
349+
overflowX: "auto",
350+
overflowY: "hidden",
351+
scrollbarWidth: "thin",
352+
},
353+
"& .optionsList > button": {
354+
flex: "0 0 auto",
355+
},
356+
"& > .tabsPanels": {
357+
boxSizing: "border-box",
358+
minWidth: 0,
359+
},
360+
},
361+
}}
340362
onTabClick={(newValue) => {
341363
setCurTab(newValue);
342364
}}

web-app/src/screens/Console/ObjectBrowser/OBBucketList.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import React, { Fragment, useEffect, useState } from "react";
1919
import { useNavigate } from "react-router-dom";
2020
import {
2121
ActionLink,
22+
breakPoints,
2223
BucketsIcon,
2324
Button,
2425
DataTable,
@@ -195,6 +196,43 @@ const OBListBuckets = () => {
195196
records={filteredRecords}
196197
entityName={"Buckets"}
197198
idField={"name"}
199+
sx={{
200+
[`@media (max-width: ${breakPoints.sm}px)`]: {
201+
paddingLeft: 8,
202+
paddingRight: 8,
203+
scrollbarWidth: "thin",
204+
"#root &&": {
205+
overflowX: "auto",
206+
},
207+
"& .ReactVirtualized__Table": {
208+
minWidth: 470,
209+
},
210+
"& .ReactVirtualized__Table__headerColumn, & .ReactVirtualized__Table__rowColumn":
211+
{
212+
flexShrink: "0 !important",
213+
},
214+
"& .ReactVirtualized__Table__headerColumn:nth-child(1), & .ReactVirtualized__Table__rowColumn:nth-child(1)":
215+
{
216+
flexBasis: "180px !important",
217+
width: "180px !important",
218+
},
219+
"& .ReactVirtualized__Table__headerColumn:nth-child(2), & .ReactVirtualized__Table__rowColumn:nth-child(2)":
220+
{
221+
flexBasis: "75px !important",
222+
width: "75px !important",
223+
},
224+
"& .ReactVirtualized__Table__headerColumn:nth-child(3), & .ReactVirtualized__Table__rowColumn:nth-child(3)":
225+
{
226+
flexBasis: "85px !important",
227+
width: "85px !important",
228+
},
229+
"& .ReactVirtualized__Table__headerColumn:nth-child(4), & .ReactVirtualized__Table__rowColumn:nth-child(4)":
230+
{
231+
flexBasis: "70px !important",
232+
width: "70px !important",
233+
},
234+
},
235+
}}
198236
columns={[
199237
{
200238
label: "Name",

0 commit comments

Comments
 (0)