feat: prevent users from selecting mounted devices (#987)

Signed-off-by: Jack Yu <jack.yu@suse.com>
This commit is contained in:
Jack Yu
2026-07-14 11:29:41 +08:00
committed by GitHub
parent 560643d299
commit 7d09cb7142
3 changed files with 7 additions and 2 deletions
@@ -468,10 +468,15 @@ export default {
const size = formatSi(sizeBytes, { increment: 1024, suffix: UNIT_SUFFIX });
const parentDevice = d.status?.deviceStatus?.parentDevice;
const isChildAdded = this.newDisks.find((newDisk) => newDisk.blockDevice?.status?.deviceStatus?.parentDevice === devPath);
const mountPoint = d.status?.deviceStatus?.fileSystem?.mountPoint;
const name = d.displayName;
let label = `${ name } (Type: ${ deviceType }, Size: ${ size })`;
if (mountPoint) {
label = `${ label } - ${ this.t('harvester.host.disk.mounted') }`;
}
if (parentDevice) {
label = `- ${ label }`;
}
@@ -481,7 +486,7 @@ export default {
value: d.id,
action: this.addDisk,
kind: !parentDevice ? 'group' : '',
disabled: !!isChildAdded,
disabled: !!isChildAdded || !!mountPoint,
group: parentDevice || devPath,
isParent: !!parentDevice,
};