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 <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2016-11-18 17:14:34 +01:00 committed by Dietmar Maurer
parent 766998b1ae
commit ecd45352ab
2 changed files with 14 additions and 19 deletions

View 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);

View 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) {