-/*jslint confusion: true*/
/* hidden: boolean and string
* bind: function and object
* disabled: boolean and string
onGetValues: function(values) {
var me = this;
- var confid = me.confid || values.mpsel;
- values.file = me.down('field[name=file]').getValue();
+ var confid = me.confid || "mp"+values.mpid;
+ me.mp.file = me.down('field[name=file]').getValue();
if (me.unused) {
- confid = values.mpsel;
+ confid = "mp"+values.mpid;
} else if (me.isCreate) {
- values.file = values.hdstorage + ':' + values.disksize;
+ me.mp.file = values.hdstorage + ':' + values.disksize;
}
// delete unnecessary fields
- delete values.mpsel;
+ delete values.mpid;
delete values.hdstorage;
delete values.disksize;
delete values.diskformat;
+ let mountopts = (values.mountoptions || []).join(';');
+ PVE.Utils.propertyStringSet(me.mp, values.mp, 'mp');
+ PVE.Utils.propertyStringSet(me.mp, values.mountoptions, 'mountoptions', mountopts);
+ PVE.Utils.propertyStringSet(me.mp, values.backup, 'backup');
+ PVE.Utils.propertyStringSet(me.mp, values.quota, 'quota');
+ PVE.Utils.propertyStringSet(me.mp, values.ro, 'ro');
+ PVE.Utils.propertyStringSet(me.mp, values.acl, 'acl');
+ PVE.Utils.propertyStringSet(me.mp, values.replicate, 'replicate');
+
var res = {};
- res[confid] = PVE.Parser.printLxcMountPoint(values);
+ res[confid] = PVE.Parser.printLxcMountPoint(me.mp);
return res;
},
var me = this;
var vm = this.getViewModel();
vm.set('mptype', mp.type);
+ if (mp.mountoptions) {
+ mp.mountoptions = mp.mountoptions.split(';');
+ }
+ me.mp = mp;
+
+ if (this.confid === 'rootfs') {
+ var field = me.down('field[name=mountoptions]');
+ var forbidden = ['nodev', 'noexec'];
+ var filtered = field.comboItems.filter(e => !forbidden.includes(e[0]));
+ field.setComboItems(filtered);
+ }
+
me.setValues(mp);
},
var vm = me.getViewModel();
me.vmconfig = vmconfig;
vm.set('unpriv', vmconfig.unprivileged);
- vm.notify();
PVE.Utils.forEachMP(function(bus, i) {
var name = "mp" + i.toString();
if (!Ext.isDefined(vmconfig[name])) {
- me.down('field[name=mpsel]').setValue(name);
+ me.down('field[name=mpid]').setValue(i);
return false;
}
});
var me = this;
var vm = me.getViewModel();
vm.set('node', nodename);
- vm.notify();
me.down('#diskstorage').setNodename(nodename);
},
xclass: 'Ext.app.ViewController',
control: {
- 'field[name=mpsel]': {
+ 'field[name=mpid]': {
change: function(field, value) {
field.validate();
}
var vm = me.getViewModel();
vm.set('type', rec.data.type);
- vm.notify();
}
}
},
init: function(view) {
var me = this;
var vm = this.getViewModel();
+ view.mp = {};
vm.set('confid', view.confid);
vm.set('unused', view.unused);
vm.set('node', view.nodename);
vm.set('unpriv', view.unprivileged);
vm.set('hideStorSelector', view.unused || !view.isCreate);
- vm.notify();
+
+ // can be array if created from unused disk
+ if (view.isCreate) {
+ vm.set('isIncludedInBackup', true);
+ }
}
},
column1: [
{
- xtype: 'proxmoxKVComboBox',
- name: 'mpsel',
- fieldLabel: gettext('Mount Point'),
- matchFieldWidth: false,
+ xtype: 'proxmoxintegerfield',
+ name: 'mpid',
+ fieldLabel: gettext('Mount Point ID'),
+ minValue: 0,
+ maxValue: PVE.Utils.mp_counts.mps - 1,
hidden: true,
allowBlank: false,
+ disabled: true,
bind: {
hidden: '{hasMP}',
disabled: '{hasMP}'
},
- comboItems: (function(){
- var mps = [];
- PVE.Utils.forEachMP(function(bus,i) {
- var name = 'mp' + i.toString();
- mps.push([name,name]);
- });
- return mps;
- }()),
validator: function(value) {
var me = this.up('inputpanel');
if (!me.rendered) {
return;
}
- if (Ext.isDefined(me.vmconfig[value])) {
+ if (Ext.isDefined(me.vmconfig["mp"+value])) {
return "Mount point is already in use.";
}
- /*jslint confusion: true*/
/* returns a string above */
return true;
}
value: '',
emptyText: gettext('/some/path'),
allowBlank: false,
+ disabled: true,
fieldLabel: gettext('Path'),
bind: {
hidden: '{isRoot}',
xtype: 'proxmoxcheckbox',
name: 'backup',
fieldLabel: gettext('Backup'),
+ autoEl: {
+ tag: 'div',
+ 'data-qtip': gettext('Include volume in backup job'),
+ },
bind: {
hidden: '{isRoot}',
- disabled: '{isBindOrRoot}'
+ disabled: '{isBindOrRoot}',
+ value: '{isIncludedInBackup}'
}
}
],
disabled: '{isRoot}'
},
fieldLabel: gettext('Read-only')
- }
+ },
+ {
+ xtype: 'proxmoxKVComboBox',
+ name: 'mountoptions',
+ fieldLabel: gettext('Mount options'),
+ deleteEmpty: false,
+ comboItems: [
+ ['noatime', 'noatime'],
+ ['nodev', 'nodev'],
+ ['noexec', 'noexec'],
+ ['nosuid', 'nosuid']
+ ],
+ multiSelect: true,
+ value: [],
+ allowBlank: true
+ },
],
advancedColumn2: [
Ext.apply(me, {
subject: subject,
+ defaultFocus: me.confid !== 'rootfs' ? 'textfield[name=mp]' : 'tool',
items: ipanel
});
success: function(response, options) {
ipanel.setVMConfig(response.result.data);
if (me.confid) {
- /*jslint confusion: true*/
/*data is defined as array above*/
var value = response.result.data[me.confid];
- /*jslint confusion: false*/
var mp = PVE.Parser.parseLxcMountPoint(value);
if (!mp) {