]> git.proxmox.com Git - pve-manager-legacy.git/commitdiff
gui: expose lxc features
authorDominik Csapak <d.csapak@proxmox.com>
Mon, 5 Nov 2018 09:07:56 +0000 (10:07 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 5 Nov 2018 09:37:57 +0000 (10:37 +0100)
but constrain editing to root@pam
give a checkbox (for now) for nfs and cifs, but keep all that are manually set

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
www/manager6/Makefile
www/manager6/lxc/FeaturesEdit.js [new file with mode: 0644]
www/manager6/lxc/Options.js

index 68b5227b022ae3821747c9eab17cac39a76aed46..cc2f72037ad49a53d77c2dbe3571714131ac2a85 100644 (file)
@@ -146,6 +146,7 @@ JSSRC=                                                      \
        lxc/Summary.js                                  \
        lxc/Network.js                                  \
        lxc/Resources.js                                \
+       lxc/FeaturesEdit.js                             \
        lxc/Options.js                                  \
        lxc/DNS.js                                      \
        lxc/Config.js                                   \
diff --git a/www/manager6/lxc/FeaturesEdit.js b/www/manager6/lxc/FeaturesEdit.js
new file mode 100644 (file)
index 0000000..02ce0a1
--- /dev/null
@@ -0,0 +1,93 @@
+Ext.define('PVE.lxc.FeaturesInputPanel', {
+    extend: 'Proxmox.panel.InputPanel',
+    xtype: 'pveLxcFeaturesInputPanel',
+
+    // used to save the mounts fstypes until sending
+    mounts: [],
+
+    fstypes: ['nfs', 'cifs'],
+
+    items: [
+       {
+           xtype: 'proxmoxcheckbox',
+           fieldLabel: gettext('keyctl'),
+           name: 'keyctl'
+       },
+       {
+           xtype: 'proxmoxcheckbox',
+           fieldLabel: gettext('Nesting'),
+           name: 'nesting'
+       },
+       {
+           xtype: 'proxmoxcheckbox',
+           name: 'nfs',
+           fieldLabel: 'NFS'
+       },
+       {
+           xtype: 'proxmoxcheckbox',
+           name: 'cifs',
+           fieldLabel: 'CIFS'
+       }
+    ],
+
+    onGetValues: function(values) {
+       var me = this;
+       var mounts = me.mounts;
+       me.fstypes.forEach(function(fs) {
+           if (values[fs]) {
+               mounts.push(fs);
+           }
+           delete values[fs];
+       });
+
+       if (mounts.length) {
+           values.mount = mounts.join(';');
+       }
+
+       var featuresstring = PVE.Parser.printPropertyString(values, undefined);
+       if (featuresstring == '') {
+           return { 'delete': 'features' };
+       }
+       return { features: featuresstring };
+    },
+
+    setValues: function(values) {
+       var me = this;
+
+       me.down('field[name=keyctl]').setDisabled(!values.unprivileged);
+
+       if (values.features) {
+           var res = PVE.Parser.parsePropertyString(values.features);
+           me.mounts = [];
+           if (res.mount) {
+               res.mount.split(/[; ]/).forEach(function(item) {
+                   if (me.fstypes.indexOf(item) === -1) {
+                       me.mounts.push(item);
+                   } else {
+                       res[item] = 1;
+                   }
+               });
+           }
+           this.callParent([res]);
+       }
+    }
+});
+
+Ext.define('PVE.lxc.FeaturesEdit', {
+    extend: 'Proxmox.window.Edit',
+    xtype: 'pveLxcFeaturesEdit',
+
+    subject: gettext('Features'),
+
+    items: [{
+       xtype: 'pveLxcFeaturesInputPanel'
+    }],
+
+    initComponent : function() {
+       var me = this;
+
+       me.callParent();
+
+       me.load();
+    }
+});
index 3a9959fed2b45a65bd6b838a33d62a285f4f9d99..e4a8d86be20c967368452b16bc975897e66d7de9 100644 (file)
@@ -134,6 +134,12 @@ Ext.define('PVE.lxc.Options', {
                header: gettext('Unprivileged container'),
                renderer: Proxmox.Utils.format_boolean,
                defaultValue: 0
+           },
+           features: {
+               header: gettext('Features'),
+               defaultValue: Proxmox.Utils.noneText,
+               editor: Proxmox.UserName === 'root@pam' ?
+                   'PVE.lxc.FeaturesEdit' : undefined
            }
        };