fix 3850: ui: storage: using PreallocationSelector for file based storage types

Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
Tested-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
Lorenz Stechauner 2021-10-12 14:32:34 +02:00 committed by Thomas Lamprecht
parent 418e9c13ae
commit bb157f5d6d
3 changed files with 27 additions and 1 deletions

View File

@ -4,6 +4,12 @@ Ext.define('PVE.controller.StorageEdit', {
control: {
'field[name=content]': {
change: function(field, value) {
const hasImages = Ext.Array.contains(value, 'images');
const prealloc = field.up('form').getForm().findField('preallocation');
if (prealloc) {
prealloc.setDisabled(!hasImages);
}
var hasBackups = Ext.Array.contains(value, 'backup');
var maxfiles = this.lookupReference('maxfiles');
if (!maxfiles) {

View File

@ -51,6 +51,26 @@ Ext.define('PVE.panel.StorageBase', {
},
);
const qemuImgStorageTypes = ['dir', 'btrfs', 'nfs', 'cifs', 'glusterfs'];
if (qemuImgStorageTypes.includes(me.type)) {
const preallocSelector = {
xtype: 'pvePreallocationSelector',
name: 'preallocation',
fieldLabel: gettext('Preallocation'),
allowBlank: false,
value: '__default__',
};
me.advancedColumn1 = me.advancedColumn1 || [];
me.advancedColumn2 = me.advancedColumn2 || [];
if (me.advancedColumn2.length < me.advancedColumn1.length) {
me.advancedColumn2.unshift(preallocSelector);
} else {
me.advancedColumn1.unshift(preallocSelector);
}
}
me.callParent();
},
});

View File

@ -143,7 +143,7 @@ Ext.define('PVE.storage.NFSInputPanel', {
},
];
me.advancedColumn1 = [
me.advancedColumn2 = [
{
xtype: 'proxmoxKVComboBox',
fieldLabel: gettext('NFS Version'),