Skip to content

Commit

Permalink
Fixed Drives offline card UI (minio#2732)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinapurapu authored Mar 23, 2023
1 parent 1e34536 commit 5e65f2a
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 3 deletions.
6 changes: 6 additions & 0 deletions models/backend_properties.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions portal-ui/src/api/consoleApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,8 @@ export interface BackendProperties {
backendType?: string;
rrSCParity?: number;
standardSCParity?: number;
onlineDrives?: number;
offlineDrives?: number;
}

export interface ArnsResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,10 @@ const BasicDashboard = ({ usage }: IDashboardProps) => {
</BoxItem>
<BoxItem>
<StatusCountCard
offlineCount={offlineDrives.length}
onlineCount={onlineDrives.length}
offlineCount={
usage?.backend.offlineDrives || offlineDrives.length
}
onlineCount={usage?.backend.onlineDrives || onlineDrives.length}
label={"Drives"}
icon={<DrivesIcon />}
/>
Expand Down
2 changes: 2 additions & 0 deletions portal-ui/src/screens/Console/Dashboard/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export interface Backend {
backendType: string;
standardSCParity: number;
rrSCParity: number;
onlineDrives: number;
offlineDrives: number;
}

export interface ServerInfo {
Expand Down
13 changes: 12 additions & 1 deletion restapi/admin_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ func GetAdminInfo(ctx context.Context, client MinioAdmin) (*UsageInfo, error) {
var backendType string
var rrSCParity float64
var standardSCParity float64
var onlineDrives float64
var offlineDrives float64

if v, success := serverInfo.Backend.(map[string]interface{}); success {
bt, ok := v["backendType"]
Expand All @@ -90,6 +92,14 @@ func GetAdminInfo(ctx context.Context, client MinioAdmin) (*UsageInfo, error) {
if ok {
standardSCParity = sp.(float64)
}
onDrives, ok := v["onlineDisks"]
if ok {
onlineDrives = onDrives.(float64)
}
offDrives, ok := v["offlineDisks"]
if ok {
offlineDrives = offDrives.(float64)
}
}

var usedSpace int64
Expand Down Expand Up @@ -132,8 +142,9 @@ func GetAdminInfo(ctx context.Context, client MinioAdmin) (*UsageInfo, error) {
BackendType: backendType,
RrSCParity: int64(rrSCParity),
StandardSCParity: int64(standardSCParity),
OnlineDrives: int64(onlineDrives),
OfflineDrives: int64(offlineDrives),
}

return &UsageInfo{
Buckets: int64(serverInfo.Buckets.Count),
Objects: int64(serverInfo.Objects.Count),
Expand Down
12 changes: 12 additions & 0 deletions restapi/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4616,6 +4616,10 @@ definitions:
type: integer
standardSCParity:
type: integer
onlineDrives:
type: integer
offlineDrives:
type: integer
arnsResponse:
type: object
properties:
Expand Down

0 comments on commit 5e65f2a

Please sign in to comment.