]> git.proxmox.com Git - pve-manager.git/blobdiff - www/manager6/storage/LvmThinEdit.js
ui: eslint: fix trailing comma and comma related whitespaces errors
[pve-manager.git] / www / manager6 / storage / LvmThinEdit.js
index a2c3ee751da6f41f4be186be350d6f8ae32c4123..238c8c1765955edff1ed4b664efb8332688cc104 100644 (file)
@@ -3,6 +3,9 @@ Ext.define('PVE.storage.TPoolSelector', {
     alias: 'widget.pveTPSelector',
 
     queryParam: 'vg',
+    valueField: 'lv',
+    displayField: 'lv',
+    editable: false,
 
     doRawQuery: function() {
     },
@@ -35,37 +38,32 @@ Ext.define('PVE.storage.TPoolSelector', {
        var store = Ext.create('Ext.data.Store', {
            fields: [ 'lv' ],
            proxy: {
-               type: 'pve',
-               url: '/api2/json/nodes/' + me.nodename + '/scan/lvmthin'
-           }
+               type: 'proxmox',
+               url: '/api2/json/nodes/' + me.nodename + '/scan/lvmthin',
+           },
        });
 
+       store.sort('lv', 'ASC');
+
        Ext.apply(me, {
            store: store,
-           valueField: 'lv',
-           displayField: 'lv',
-           editable: false,
            listConfig: {
                loadingText: gettext('Scanning...'),
-               listeners: {
-                   // hack: call setHeight to show scroll bars correctly
-                   refresh: function(list) {
-                       var lh = PVE.Utils.gridLineHeigh();
-                       var count = store.getCount();
-                       list.setHeight(lh * ((count > 10) ? 10 : count));
-                   }
-               }
-           }
+           },
        });
 
        me.callParent();
-    }
+    },
 });
 
 Ext.define('PVE.storage.BaseVGSelector', {
     extend: 'Ext.form.field.ComboBox',
     alias: 'widget.pveBaseVGSelector',
 
+    valueField: 'vg',
+    displayField: 'vg',
+    queryMode: 'local',
+    editable: false,
     initComponent : function() {
        var me = this;
 
@@ -77,107 +75,69 @@ Ext.define('PVE.storage.BaseVGSelector', {
            autoLoad: {},
            fields: [ 'vg', 'size', 'free'],
            proxy: {
-               type: 'pve',
-               url: '/api2/json/nodes/' + me.nodename + '/scan/lvm'
-           }
+               type: 'proxmox',
+               url: '/api2/json/nodes/' + me.nodename + '/scan/lvm',
+           },
        });
 
        Ext.apply(me, {
            store: store,
-           valueField: 'vg',
-           displayField: 'vg',
-           queryMode: 'local',
-           editable: false,
            listConfig: {
                loadingText: gettext('Scanning...'),
-               listeners: {
-                   // hack: call setHeight to show scroll bars correctly
-                   refresh: function(list) {
-                       var lh = PVE.Utils.gridLineHeigh();
-                       var count = store.getCount();
-                       list.setHeight(lh * ((count > 10) ? 10 : count));
-                   }
-               }
-           }
+           },
        });
 
        me.callParent();
-    }
+    },
 });
 
 Ext.define('PVE.storage.LvmThinInputPanel', {
-    extend: 'PVE.panel.InputPanel',
+    extend: 'PVE.panel.StorageBase',
 
-    onGetValues: function(values) {
-       var me = this;
-
-       if (me.create) {
-           values.type = 'lvmthin';
-       } else {
-           delete values.storage;
-       }
-
-       values.disable = values.enable ? 0 : 1;
-       delete values.enable;
-
-       return values;
-    },
+    onlineHelp: 'storage_lvmthin',
 
     initComponent : function() {
        var me = this;
 
-       me.column1 = [
-           {
-               xtype: me.create ? 'textfield' : 'displayfield',
-               name: 'storage',
-               height: 22, // hack: set same height as text fields
-               value: me.storageId || '',
-               fieldLabel: 'ID',
-               vtype: 'StorageId',
-               submitValue: !!me.create,
-               allowBlank: false
-           }
-       ];
-
-       var vgnameField = Ext.createWidget(me.create ? 'textfield' : 'displayfield', {
-           height: 22, // hack: set same height as text fields
+       me.column1 = [];
+
+       var vgnameField = Ext.createWidget(me.isCreate ? 'textfield' : 'displayfield', {
            name: 'vgname',
-           hidden: !!me.create,
-           disabled: !!me.create,
+           hidden: !!me.isCreate,
+           disabled: !!me.isCreate,
            value: '',
            fieldLabel: gettext('Volume group'),
-           allowBlank: false
+           allowBlank: false,
        });
 
-       var thinpoolField = Ext.createWidget(me.create ? 'textfield' : 'displayfield', {
-           height: 22, // hack: set same height as text fields
+       var thinpoolField = Ext.createWidget(me.isCreate ? 'textfield' : 'displayfield', {
            name: 'thinpool',
-           hidden: !!me.create,
-           disabled: !!me.create,
+           hidden: !!me.isCreate,
+           disabled: !!me.isCreate,
            value: '',
            fieldLabel: gettext('Thin Pool'),
-           allowBlank: false
+           allowBlank: false,
        });
 
-       if (me.create) {
+       if (me.isCreate) {
            var vgField = Ext.create('PVE.storage.TPoolSelector', {
                name: 'thinpool',
                fieldLabel: gettext('Thin Pool'),
-               allowBlank: false
+               allowBlank: false,
            });
 
            me.column1.push({
                xtype: 'pveBaseVGSelector',
                name: 'vgname',
-               fieldLabel: gettext('Volume Group'),
+               fieldLabel: gettext('Volume group'),
                listeners: {
                    change: function(f, value) {
-                       if (me.create) {
+                       if (me.isCreate) {
                            vgField.setVG(value);
                            vgField.setValue('');
                        }
-                   }
-               }
+                   },
+               },
            });
 
            me.column1.push(vgField);
@@ -187,6 +147,8 @@ Ext.define('PVE.storage.LvmThinInputPanel', {
 
        me.column1.push(thinpoolField);
 
+       // here value is an array,
+       // while before it was a string
        me.column1.push({
            xtype: 'pveContentTypeSelector',
            cts: ['images', 'rootdir'],
@@ -194,76 +156,11 @@ Ext.define('PVE.storage.LvmThinInputPanel', {
            name: 'content',
            value: ['images', 'rootdir'],
            multiSelect: true,
-           allowBlank: false
+           allowBlank: false,
        });
 
-       me.column2 = [
-           {
-               xtype: 'pveNodeSelector',
-               name: 'nodes',
-               fieldLabel: gettext('Nodes'),
-               emptyText: gettext('All') + ' (' +
-                   gettext('No restrictions') +')',
-               multiSelect: true,
-               autoSelect: false
-           },
-           {
-               xtype: 'pvecheckbox',
-               name: 'enable',
-               checked: true,
-               uncheckedValue: 0,
-               fieldLabel: gettext('Enable')
-           }
-       ];
+       me.column2 = [];
 
        me.callParent();
-    }
-});
-
-Ext.define('PVE.storage.LvmThinEdit', {
-    extend: 'PVE.window.Edit',
-
-    initComponent : function() {
-       var me = this;
-
-       me.create = !me.storageId;
-
-       if (me.create) {
-            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.LvmThinInputPanel', {
-           create: me.create,
-           storageId: me.storageId
-       });
-
-       Ext.apply(me, {
-            subject: PVE.Utils.format_storage_type('lvmthin'),
-           isAdd: true,
-           items: [ ipanel ]
-       });
-
-       me.callParent();
-
-       if (!me.create) {
-           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);
-               }
-           });
-       }
-    }
+    },
 });