Fetch block devices for volumes

This commit is contained in:
Johannes Zellner
2025-01-02 23:39:01 +01:00
parent 8c8ae57103
commit 8a5e7accaf

View File

@@ -34,7 +34,7 @@
<FormGroup v-if="volumeDialogData.mountType === 'ext4' || volumeDialogData.mountType === 'xfs'">
<label for="volumeDiskPath">{{ $t('volumes.addVolumeDialog.diskPath') }}</label>
<select id="volumeDiskPath" v-model="volumeDialogData.diskPath" ng-options="item as item.label for item in ext4BlockDevices track by item.path"></select>
<!-- <select id="volumeDiskPath" v-model="volumeDialogData.diskPath" ng-options="item as item.label for item in ext4BlockDevices track by item.path"></select> -->
<!-- <select id="volumeXfsDisk" v-model="volumeDialogData.xfsDisk" ng-options="item as item.label for item in xfsBlockDevices track by item.path"></select> -->
</FormGroup>
@@ -221,7 +221,7 @@ export default {
v.message = status.message;
}
},
openVolumeDialog(volume) {
async openVolumeDialog(volume) {
this.volumeDialogData.error = null;
this.volumeDialogData.mode = volume ? 'edit' : 'new';
this.volumeDialogData.id = volume ? volume.id : '';
@@ -236,6 +236,19 @@ export default {
this.volumeDialogData.diskPath = volume ? volume.mountOptions.diskPath : '';
this.volumeDialogData.hostPath = volume ? volume.mountOptions.hostPath : '';
let blockDevices = await volumesModel.getBlockDevices();
// only offer unmounted disks
blockDevices = blockDevices.filter(d => !d.mountpoint);
// amend label for UI
blockDevices.forEach(d => d.label = d.path);
this.volumeDialogData.ext4BlockDevices = blockDevices.filter(d => d.type === 'ext4');
this.volumeDialogData.xfsBlockDevices = blockDevices.filter(d => d.type === 'xfs');
console.log(this.volumeDialogData.ext4BlockDevices, this.volumeDialogData.xfsBlockDevices)
this.$refs.volumeDialog.open();
},
async submitVolumeDialog() {