matchFieldWidth: false,
listConfig: {
loadingText: gettext('Scanning...'),
- width: 350
+ width: 350,
},
doRawQuery: function() {
+ // do nothing
},
onTriggerClick: function() {
me.nfsServer = server;
},
- initComponent : function() {
+ initComponent: function() {
var me = this;
if (!me.nodename) {
}
var store = Ext.create('Ext.data.Store', {
- fields: [ 'path', 'options' ],
+ fields: ['path', 'options'],
proxy: {
- type: 'pve',
- url: '/api2/json/nodes/' + me.nodename + '/scan/nfs'
- }
+ type: 'proxmox',
+ url: '/api2/json/nodes/' + me.nodename + '/scan/nfs',
+ },
});
store.sort('path', 'ASC');
Ext.apply(me, {
- store: store
+ store: store,
});
me.callParent();
- }
+ },
});
Ext.define('PVE.storage.NFSInputPanel', {
- extend: 'PVE.panel.InputPanel',
- controller: 'storageEdit',
+ extend: 'PVE.panel.StorageBase',
+
+ onlineHelp: 'storage_nfs',
+
+ options: [],
onGetValues: function(values) {
var me = this;
- if (me.isCreate) {
- values.type = 'nfs';
- // hack: for now we always create nvf v3
- // fixme: make this configurable
- values.options = 'vers=3';
- } else {
- delete values.storage;
+ var i;
+ var res = [];
+ for (i = 0; i < me.options.length; i++) {
+ var item = me.options[i];
+ if (!item.match(/^vers=(.*)$/)) {
+ res.push(item);
+ }
+ }
+ if (values.nfsversion && values.nfsversion !== '__default__') {
+ res.push('vers=' + values.nfsversion);
+ }
+ delete values.nfsversion;
+ values.options = res.join(',');
+ if (values.options === '') {
+ delete values.options;
+ if (!me.isCreate) {
+ values.delete = "options";
+ }
}
- values.disable = values.enable ? 0 : 1;
- delete values.enable;
+ return me.callParent([values]);
+ },
- return values;
+ setValues: function(values) {
+ var me = this;
+ if (values.options) {
+ me.options = values.options.split(',');
+ me.options.forEach(function(item) {
+ var match = item.match(/^vers=(.*)$/);
+ if (match) {
+ values.nfsversion = match[1];
+ }
+ });
+ }
+ return me.callParent([values]);
},
- initComponent : function() {
+ initComponent: function() {
var me = this;
me.column1 = [
- {
- xtype: me.isCreate ? 'textfield' : 'displayfield',
- name: 'storage',
- value: me.storageId || '',
- fieldLabel: 'ID',
- vtype: 'StorageId',
- allowBlank: false
- },
{
xtype: me.isCreate ? 'textfield' : 'displayfield',
name: 'server',
exportField.setServer(value);
exportField.setValue('');
}
- }
- }
+ },
+ },
},
{
xtype: me.isCreate ? 'pveNFSScan' : 'displayfield',
name: 'export',
value: '',
fieldLabel: 'Export',
- allowBlank: false
+ allowBlank: false,
},
{
xtype: 'pveContentTypeSelector',
value: 'images',
multiSelect: true,
fieldLabel: gettext('Content'),
- allowBlank: false
- }
+ allowBlank: false,
+ },
];
- me.column2 = [
+ me.advancedColumn2 = [
{
- xtype: 'pveNodeSelector',
- name: 'nodes',
- fieldLabel: gettext('Nodes'),
- emptyText: gettext('All') + ' (' +
- gettext('No restrictions') +')',
- multiSelect: true,
- autoSelect: false
+ xtype: 'proxmoxKVComboBox',
+ fieldLabel: gettext('NFS Version'),
+ name: 'nfsversion',
+ value: '__default__',
+ deleteEmpty: false,
+ comboItems: [
+ ['__default__', Proxmox.Utils.defaultText],
+ ['3', '3'],
+ ['4', '4'],
+ ['4.1', '4.1'],
+ ['4.2', '4.2'],
+ ],
},
- {
- xtype: 'proxmoxcheckbox',
- name: 'enable',
- checked: true,
- uncheckedValue: 0,
- fieldLabel: gettext('Enable')
- },
- {
- xtype: 'proxmoxintegerfield',
- fieldLabel: gettext('Max Backups'),
- disabled: true,
- name: 'maxfiles',
- reference: 'maxfiles',
- minValue: 0,
- maxValue: 365,
- value: me.isCreate ? '1' : undefined,
- allowBlank: false
- }
];
me.callParent();
- }
-});
-
-Ext.define('PVE.storage.NFSEdit', {
- extend: 'PVE.window.Edit',
-
- initComponent : function() {
- var me = this;
-
- me.isCreate = !me.storageId;
-
- if (me.isCreate) {
- me.url = '/api2/extjs/storage';
- me.method = 'POST';
- } else {
- me.url = '/api2/extjs/storage/' + me.storageId;
- me.method = 'PUT';
- }
-
- var ipanel = Ext.create('PVE.storage.NFSInputPanel', {
- isCreate: me.isCreate,
- storageId: me.storageId
- });
-
- Ext.apply(me, {
- subject: 'NFS',
- isAdd: true,
- items: [ ipanel ]
- });
-
- me.callParent();
-
- if (!me.isCreate) {
- me.load({
- success: function(response, options) {
- var values = response.result.data;
- var ctypes = values.content || '';
-
- values.content = ctypes.split(',');
-
- if (values.nodes) {
- values.nodes = values.nodes.split(',');
- }
- values.enable = values.disable ? 0 : 1;
- ipanel.setValues(values);
- }
- });
- }
- }
+ },
});