Skip to content

Commit

Permalink
ui/volume: rephrase the volume status from availble to ready
Browse files Browse the repository at this point in the history
Refs: #2245
  • Loading branch information
ChengYanJin committed Feb 18, 2020
1 parent 8ba6b40 commit c77366b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
1 change: 1 addition & 0 deletions ui/src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const STATUS_FAILED = 'Failed';
export const STATUS_AVAILABLE = 'Available';
export const STATUS_RELEASED = 'Released';
export const STATUS_UNKNOWN = 'Unknown';
export const STATUS_READY = 'Ready';

export const SPARSE_LOOP_DEVICE = 'sparseLoopDevice';
export const RAW_BLOCK_DEVICE = 'rawBlockDevice';
38 changes: 19 additions & 19 deletions ui/src/services/NodeVolumesUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
STATUS_AVAILABLE,
STATUS_BOUND,
STATUS_RELEASED,
STATUS_READY,
} from '../constants';

export const isVolumeDeletable = (rowData, persistentVolumes) => {
Expand Down Expand Up @@ -54,7 +55,6 @@ export const isVolumeDeletable = (rowData, persistentVolumes) => {
}
};


// Compute the global status of a volume from its conditions.
//
// Arguments
Expand All @@ -78,28 +78,28 @@ export const computeVolumeGlobalStatus = (name, status) => {
const condStatus = condition?.status;
const condReason = condition?.reason;

switch(condStatus) {
case 'True':
return STATUS_AVAILABLE;
case 'False':
return STATUS_FAILED;
case 'Unknown':
switch(condReason) {
case 'Pending':
return STATUS_PENDING;
case 'Terminating':
return STATUS_TERMINATING;
switch (condStatus) {
case 'True':
return STATUS_READY;
case 'False':
return STATUS_FAILED;
case 'Unknown':
switch (condReason) {
case 'Pending':
return STATUS_PENDING;
case 'Terminating':
return STATUS_TERMINATING;
default:
console.error(
`Unexpected Ready reason for Volume ${name}: ${condReason}`,
);
return STATUS_UNKNOWN;
}
default:
console.error(
`Unexpected Ready reason for Volume ${name}: ${condReason}`,
`Unexpected Ready status for Volume ${name}: ${condStatus}`,
);
return STATUS_UNKNOWN;
}
default:
console.error(
`Unexpected Ready status for Volume ${name}: ${condStatus}`,
);
return STATUS_UNKNOWN;
}
};

Expand Down

0 comments on commit c77366b

Please sign in to comment.