]> git.proxmox.com Git - pmg-gui.git/commitdiff
ActionList: add info about editable state
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 23 Oct 2019 11:56:07 +0000 (13:56 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 23 Oct 2019 17:18:39 +0000 (19:18 +0200)
and set state of the buttons accordingly

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
js/ActionList.js

index af5e2e3cb23ef39b9a73f3cd7d29065b8c7ed192..99f1dc7fa381cafb91ab01e13333d034a94ba8ee 100644 (file)
@@ -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: {