Skip to content

Commit 5e65f2a

Browse files
authored
Fixed Drives offline card UI (#2732)
1 parent 1e34536 commit 5e65f2a

File tree

7 files changed

+42
-3
lines changed

7 files changed

+42
-3
lines changed

models/backend_properties.go

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

portal-ui/src/api/consoleApi.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,8 @@ export interface BackendProperties {
609609
backendType?: string;
610610
rrSCParity?: number;
611611
standardSCParity?: number;
612+
onlineDrives?: number;
613+
offlineDrives?: number;
612614
}
613615

614616
export interface ArnsResponse {

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,10 @@ const BasicDashboard = ({ usage }: IDashboardProps) => {
201201
</BoxItem>
202202
<BoxItem>
203203
<StatusCountCard
204-
offlineCount={offlineDrives.length}
205-
onlineCount={onlineDrives.length}
204+
offlineCount={
205+
usage?.backend.offlineDrives || offlineDrives.length
206+
}
207+
onlineCount={usage?.backend.onlineDrives || onlineDrives.length}
206208
label={"Drives"}
207209
icon={<DrivesIcon />}
208210
/>

portal-ui/src/screens/Console/Dashboard/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ export interface Backend {
3434
backendType: string;
3535
standardSCParity: number;
3636
rrSCParity: number;
37+
onlineDrives: number;
38+
offlineDrives: number;
3739
}
3840

3941
export interface ServerInfo {

restapi/admin_info.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ func GetAdminInfo(ctx context.Context, client MinioAdmin) (*UsageInfo, error) {
7676
var backendType string
7777
var rrSCParity float64
7878
var standardSCParity float64
79+
var onlineDrives float64
80+
var offlineDrives float64
7981

8082
if v, success := serverInfo.Backend.(map[string]interface{}); success {
8183
bt, ok := v["backendType"]
@@ -90,6 +92,14 @@ func GetAdminInfo(ctx context.Context, client MinioAdmin) (*UsageInfo, error) {
9092
if ok {
9193
standardSCParity = sp.(float64)
9294
}
95+
onDrives, ok := v["onlineDisks"]
96+
if ok {
97+
onlineDrives = onDrives.(float64)
98+
}
99+
offDrives, ok := v["offlineDisks"]
100+
if ok {
101+
offlineDrives = offDrives.(float64)
102+
}
93103
}
94104

95105
var usedSpace int64
@@ -132,8 +142,9 @@ func GetAdminInfo(ctx context.Context, client MinioAdmin) (*UsageInfo, error) {
132142
BackendType: backendType,
133143
RrSCParity: int64(rrSCParity),
134144
StandardSCParity: int64(standardSCParity),
145+
OnlineDrives: int64(onlineDrives),
146+
OfflineDrives: int64(offlineDrives),
135147
}
136-
137148
return &UsageInfo{
138149
Buckets: int64(serverInfo.Buckets.Count),
139150
Objects: int64(serverInfo.Objects.Count),

restapi/embedded_spec.go

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

swagger.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4616,6 +4616,10 @@ definitions:
46164616
type: integer
46174617
standardSCParity:
46184618
type: integer
4619+
onlineDrives:
4620+
type: integer
4621+
offlineDrives:
4622+
type: integer
46194623
arnsResponse:
46204624
type: object
46214625
properties:

0 commit comments

Comments
 (0)