[pve-devel] [PATCH manager] gui: expose lxc features

Dominik Csapak d.csapak at proxmox.com
Mon Oct 22 16:29:10 CEST 2018


but constrain editing to root at pam

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
i am not sure if the gettexts are ok, or if we want something like this
Ext.String.format(gettext('Allow {}'), gettext('filesystem types')), etc.

also, would it make sense to have an example in the fstypes fields emptytext?
e.g. 'nfs, smb' ?

 www/manager6/Makefile            |  1 +
 www/manager6/lxc/FeaturesEdit.js | 62 ++++++++++++++++++++++++++++++++++++++++
 www/manager6/lxc/Options.js      |  6 ++++
 3 files changed, 69 insertions(+)
 create mode 100644 www/manager6/lxc/FeaturesEdit.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 68b5227b..cc2f7203 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -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
index 00000000..4fb1595a
--- /dev/null
+++ b/www/manager6/lxc/FeaturesEdit.js
@@ -0,0 +1,62 @@
+Ext.define('PVE.lxc.FeaturesInputPanel', {
+    extend: 'Proxmox.panel.InputPanel',
+    xtype: 'pveLxcFeaturesInputPanel',
+
+    initComponent: function() {
+	var me = this;
+	me.items= [
+	    {
+		xtype: 'proxmoxcheckbox',
+		fieldLabel: gettext('Allow keyctl'),
+		name: 'keyctl'
+	    },
+	    {
+		xtype: 'proxmoxcheckbox',
+		fieldLabel: gettext('Allow nesting'),
+		name: 'nesting'
+	    },
+	    {
+		xtype: 'proxmoxtextfield',
+		fieldLabel: gettext('Allow filesystem types'),
+		name: 'mount'
+	    }
+	];
+	me.callParent();
+    },
+
+    onGetValues: function(values) {
+	var featuresstring = PVE.Parser.printPropertyString(values, undefined);
+	if (featuresstring == '') {
+	    return { 'delete': 'features' };
+	}
+	return { features: featuresstring };
+    },
+
+    setValues: function(values) {
+	var features = values.features;
+	if (features) {
+	    var res = PVE.Parser.parsePropertyString(features, undefined);
+	    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();
+    }
+});
+
diff --git a/www/manager6/lxc/Options.js b/www/manager6/lxc/Options.js
index 3a9959fe..e4a8d86b 100644
--- a/www/manager6/lxc/Options.js
+++ b/www/manager6/lxc/Options.js
@@ -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 at pam' ?
+		    'PVE.lxc.FeaturesEdit' : undefined
 	    }
 	};
 
-- 
2.11.0





More information about the pve-devel mailing list