]> git.proxmox.com Git - pve-manager.git/commitdiff
ha resource edit: adapt to new service state
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 18 Nov 2016 16:14:34 +0000 (17:14 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Sat, 19 Nov 2016 09:20:04 +0000 (10:20 +0100)
Add the new stopped state to the ResourceEdit panel.
Rename enabled state to started as done in ha-manager.

As 'enabled' is now the wrong label use the more correct label
'Request state', for both the resource edit window and the grid
column.

Do this by replacing the checkbox with a KVCombogrid.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
www/manager6/ha/ResourceEdit.js
www/manager6/ha/Resources.js

index 79a9836763f483903ff81bdc8c3115d847221619..3b1b51a204c05ce6b118ab41aa4ac59e9a02c590 100644 (file)
@@ -13,13 +13,6 @@ Ext.define('PVE.ha.VMResourceInputPanel', {
 
        delete values.vmid;
 
-       if (values.enable) {
-           values.state = 'enabled';
-       } else {
-           values.state = 'disabled';
-       }
-       delete values.enable;
-
        PVE.Utils.delete_if_default(values, 'group', '', me.create);
        PVE.Utils.delete_if_default(values, 'max_restart', '1', me.create);
        PVE.Utils.delete_if_default(values, 'max_relocate', '1', me.create);
@@ -67,6 +60,8 @@ Ext.define('PVE.ha.VMResourceInputPanel', {
            }
        ];
 
+       // value is expected to be integer as it's above, ignore that
+       /*jslint confusion: true */
        me.column2 = [
            {
                xtype: 'pveHAGroupSelector',
@@ -74,14 +69,18 @@ Ext.define('PVE.ha.VMResourceInputPanel', {
                fieldLabel: gettext('Group')
            },
            {
-               xtype: 'pvecheckbox',
-               name: 'enable',
-               checked: true,
-               uncheckedValue: 0,
-               fieldLabel: gettext('enabled'),
+               xtype: 'pveKVComboBox',
+               name: 'state',
+               value: 'started',
+               fieldLabel: gettext('Request State'),
+               comboItems: [
+                   ['started', gettext('Started')],
+                   ['stopped', gettext('Stopped')],
+                   ['disabled', gettext('Disabled')]
+               ],
                listeners: {
                    'change': function(field, newValue) {
-                       if (newValue === false) {
+                       if (newValue === 'disabled') {
                            disabledHint.setVisible(true);
                        }
                        else {
@@ -94,6 +93,7 @@ Ext.define('PVE.ha.VMResourceInputPanel', {
            },
            disabledHint
        ];
+       /*jslint confusion: false */
 
        me.columnB = [
            {
@@ -143,11 +143,6 @@ Ext.define('PVE.ha.VMResourceEdit', {
                success:  function(response, options) {
                    var values = response.result.data;
 
-                   values.enable = true;
-                   if (values.state === 'disabled') {
-                       values.enable = false;
-                   }
-
                    var regex =  /^(\S+):(\S+)$/;
                    var res = regex.exec(values.sid);
 
index 999cf3d638d08b257f2fa7a5f38e8bfed5bc069c..1d2bb12d4393c285dd1cae566ac1c1043f9b7178 100644 (file)
@@ -119,7 +119,7 @@ Ext.define('PVE.ha.ResourcesView', {
                    dataIndex: 'sid'
                },
                {
-                   header: gettext('State'),
+                   header: gettext('Request State'),
                    width: 100,
                    sortable: true,
                    renderer: function(v) {