Fixed Drives offline card UI (#2732)

This commit is contained in:
jinapurapu
2023-03-23 08:53:21 -07:00
committed by GitHub
parent 1e345364cf
commit 5e65f2aced
7 changed files with 42 additions and 3 deletions

View File

@@ -37,6 +37,12 @@ type BackendProperties struct {
// backend type // backend type
BackendType string `json:"backendType,omitempty"` BackendType string `json:"backendType,omitempty"`
// offline drives
OfflineDrives int64 `json:"offlineDrives,omitempty"`
// online drives
OnlineDrives int64 `json:"onlineDrives,omitempty"`
// rr s c parity // rr s c parity
RrSCParity int64 `json:"rrSCParity,omitempty"` RrSCParity int64 `json:"rrSCParity,omitempty"`

View File

@@ -609,6 +609,8 @@ export interface BackendProperties {
backendType?: string; backendType?: string;
rrSCParity?: number; rrSCParity?: number;
standardSCParity?: number; standardSCParity?: number;
onlineDrives?: number;
offlineDrives?: number;
} }
export interface ArnsResponse { export interface ArnsResponse {

View File

@@ -201,8 +201,10 @@ const BasicDashboard = ({ usage }: IDashboardProps) => {
</BoxItem> </BoxItem>
<BoxItem> <BoxItem>
<StatusCountCard <StatusCountCard
offlineCount={offlineDrives.length} offlineCount={
onlineCount={onlineDrives.length} usage?.backend.offlineDrives || offlineDrives.length
}
onlineCount={usage?.backend.onlineDrives || onlineDrives.length}
label={"Drives"} label={"Drives"}
icon={<DrivesIcon />} icon={<DrivesIcon />}
/> />

View File

@@ -34,6 +34,8 @@ export interface Backend {
backendType: string; backendType: string;
standardSCParity: number; standardSCParity: number;
rrSCParity: number; rrSCParity: number;
onlineDrives: number;
offlineDrives: number;
} }
export interface ServerInfo { export interface ServerInfo {

View File

@@ -76,6 +76,8 @@ func GetAdminInfo(ctx context.Context, client MinioAdmin) (*UsageInfo, error) {
var backendType string var backendType string
var rrSCParity float64 var rrSCParity float64
var standardSCParity float64 var standardSCParity float64
var onlineDrives float64
var offlineDrives float64
if v, success := serverInfo.Backend.(map[string]interface{}); success { if v, success := serverInfo.Backend.(map[string]interface{}); success {
bt, ok := v["backendType"] bt, ok := v["backendType"]
@@ -90,6 +92,14 @@ func GetAdminInfo(ctx context.Context, client MinioAdmin) (*UsageInfo, error) {
if ok { if ok {
standardSCParity = sp.(float64) standardSCParity = sp.(float64)
} }
onDrives, ok := v["onlineDisks"]
if ok {
onlineDrives = onDrives.(float64)
}
offDrives, ok := v["offlineDisks"]
if ok {
offlineDrives = offDrives.(float64)
}
} }
var usedSpace int64 var usedSpace int64
@@ -132,8 +142,9 @@ func GetAdminInfo(ctx context.Context, client MinioAdmin) (*UsageInfo, error) {
BackendType: backendType, BackendType: backendType,
RrSCParity: int64(rrSCParity), RrSCParity: int64(rrSCParity),
StandardSCParity: int64(standardSCParity), StandardSCParity: int64(standardSCParity),
OnlineDrives: int64(onlineDrives),
OfflineDrives: int64(offlineDrives),
} }
return &UsageInfo{ return &UsageInfo{
Buckets: int64(serverInfo.Buckets.Count), Buckets: int64(serverInfo.Buckets.Count),
Objects: int64(serverInfo.Objects.Count), Objects: int64(serverInfo.Objects.Count),

View File

@@ -5301,6 +5301,12 @@ func init() {
"backendType": { "backendType": {
"type": "string" "type": "string"
}, },
"offlineDrives": {
"type": "integer"
},
"onlineDrives": {
"type": "integer"
},
"rrSCParity": { "rrSCParity": {
"type": "integer" "type": "integer"
}, },
@@ -14297,6 +14303,12 @@ func init() {
"backendType": { "backendType": {
"type": "string" "type": "string"
}, },
"offlineDrives": {
"type": "integer"
},
"onlineDrives": {
"type": "integer"
},
"rrSCParity": { "rrSCParity": {
"type": "integer" "type": "integer"
}, },

View File

@@ -4616,6 +4616,10 @@ definitions:
type: integer type: integer
standardSCParity: standardSCParity:
type: integer type: integer
onlineDrives:
type: integer
offlineDrives:
type: integer
arnsResponse: arnsResponse:
type: object type: object
properties: properties: