[pmg-devel] [PATCH pmg-gui 1/1] ActionList: add info about editable state

Dominik Csapak d.csapak at proxmox.com
Wed Oct 23 13:56:07 CEST 2019


and set state of the buttons accordingly

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 js/ActionList.js | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/js/ActionList.js b/js/ActionList.js
index af5e2e3..99f1dc7 100644
--- a/js/ActionList.js
+++ b/js/ActionList.js
@@ -2,7 +2,7 @@
 Ext.define('pmg-action-list', {
     extend: 'Ext.data.Model',
     fields: [
-	'id', 'name', 'info', 'descr',
+	'id', 'name', 'info', 'descr', 'editable',
 	{ name: 'otype', type: 'integer' }
     ],
     idProperty: 'id'
@@ -69,6 +69,7 @@ Ext.define('PMG.ActionList', {
 	    getUrl: function(rec) {
 		return me.baseurl + '/objects/' + rec.data.id;
 	    },
+	    enableFn: rec => !!rec.data.editable,
 	    callback: reload,
 	    getRecordName: function(rec) { return rec.data.descr; },
 	    waitMsgTarget: me
@@ -109,6 +110,7 @@ Ext.define('PMG.ActionList', {
 		text: gettext('Edit'),
 		disabled: true,
 		selModel: me.selModel,
+		enableFn: rec => !!rec.data.editable,
 		handler: run_editor
             },
 	    remove_btn
@@ -143,6 +145,11 @@ Ext.define('PMG.ActionList', {
 		    flex: 1,
 		    dataIndex: 'info',
 		    renderer: Ext.String.htmlEncode
+		},
+		{
+		    header: gettext('Editable'),
+		    dataIndex: 'editable',
+		    renderer: Proxmox.Utils.format_boolean,
 		}
 	    ],
 	    listeners: {
-- 
2.20.1




More information about the pmg-devel mailing list