From: Thomas Lamprecht Date: Fri, 18 Nov 2016 16:14:34 +0000 (+0100) Subject: ha resource edit: adapt to new service state X-Git-Url: https://git.proxmox.com/?p=pve-manager.git;a=commitdiff_plain;h=ecd45352ab385c0ab4e50605a810710f8771159a ha resource edit: adapt to new service state 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 --- diff --git a/www/manager6/ha/ResourceEdit.js b/www/manager6/ha/ResourceEdit.js index 79a98367..3b1b51a2 100644 --- a/www/manager6/ha/ResourceEdit.js +++ b/www/manager6/ha/ResourceEdit.js @@ -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); diff --git a/www/manager6/ha/Resources.js b/www/manager6/ha/Resources.js index 999cf3d6..1d2bb12d 100644 --- a/www/manager6/ha/Resources.js +++ b/www/manager6/ha/Resources.js @@ -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) {