mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-08-16 04:39:15 +00:00
feat: prevent users from selecting mounted devices (#987)
Signed-off-by: Jack Yu <jack.yu@suse.com>
This commit is contained in:
parent
560643d299
commit
7d09cb7142
@ -468,10 +468,15 @@ export default {
|
|||||||
const size = formatSi(sizeBytes, { increment: 1024, suffix: UNIT_SUFFIX });
|
const size = formatSi(sizeBytes, { increment: 1024, suffix: UNIT_SUFFIX });
|
||||||
const parentDevice = d.status?.deviceStatus?.parentDevice;
|
const parentDevice = d.status?.deviceStatus?.parentDevice;
|
||||||
const isChildAdded = this.newDisks.find((newDisk) => newDisk.blockDevice?.status?.deviceStatus?.parentDevice === devPath);
|
const isChildAdded = this.newDisks.find((newDisk) => newDisk.blockDevice?.status?.deviceStatus?.parentDevice === devPath);
|
||||||
|
const mountPoint = d.status?.deviceStatus?.fileSystem?.mountPoint;
|
||||||
const name = d.displayName;
|
const name = d.displayName;
|
||||||
|
|
||||||
let label = `${ name } (Type: ${ deviceType }, Size: ${ size })`;
|
let label = `${ name } (Type: ${ deviceType }, Size: ${ size })`;
|
||||||
|
|
||||||
|
if (mountPoint) {
|
||||||
|
label = `${ label } - ${ this.t('harvester.host.disk.mounted') }`;
|
||||||
|
}
|
||||||
|
|
||||||
if (parentDevice) {
|
if (parentDevice) {
|
||||||
label = `- ${ label }`;
|
label = `- ${ label }`;
|
||||||
}
|
}
|
||||||
@ -481,7 +486,7 @@ export default {
|
|||||||
value: d.id,
|
value: d.id,
|
||||||
action: this.addDisk,
|
action: this.addDisk,
|
||||||
kind: !parentDevice ? 'group' : '',
|
kind: !parentDevice ? 'group' : '',
|
||||||
disabled: !!isChildAdded,
|
disabled: !!isChildAdded || !!mountPoint,
|
||||||
group: parentDevice || devPath,
|
group: parentDevice || devPath,
|
||||||
isParent: !!parentDevice,
|
isParent: !!parentDevice,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -640,6 +640,7 @@ harvester:
|
|||||||
notification:
|
notification:
|
||||||
success: 'Update host "{name}" storage configurations successfully.'
|
success: 'Update host "{name}" storage configurations successfully.'
|
||||||
error: Host has unready or unschedulable disks.
|
error: Host has unready or unschedulable disks.
|
||||||
|
mounted: Already Mounted
|
||||||
fileSystem:
|
fileSystem:
|
||||||
info: Current file system is {system}, You can format it manually.
|
info: Current file system is {system}, You can format it manually.
|
||||||
formatting: Disk is formatting, please wait.
|
formatting: Disk is formatting, please wait.
|
||||||
|
|||||||
@ -53,7 +53,6 @@ export default {
|
|||||||
|
|
||||||
devices() {
|
devices() {
|
||||||
const inStore = this.$store.getters['currentProduct'].inStore;
|
const inStore = this.$store.getters['currentProduct'].inStore;
|
||||||
|
|
||||||
const data = this.$store.getters[`${ inStore }/all`](HCI.USB_DEVICE) || [];
|
const data = this.$store.getters[`${ inStore }/all`](HCI.USB_DEVICE) || [];
|
||||||
|
|
||||||
data.forEach((row) => {
|
data.forEach((row) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user