add 'max_{relocate, restart}' fields to UI

The 'max_reloacte' and 'max_restart' properties can be set via CLI
and API for about a year, expose them to the user alsow via web
interface

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2016-10-31 11:07:00 +01:00 committed by Dietmar Maurer
parent b4167ff221
commit db0c652e1b
2 changed files with 52 additions and 2 deletions

View File

@ -25,7 +25,20 @@ Ext.define('PVE.ha.VMResourceInputPanel', {
values.state = 'disabled';
}
delete values.enable;
if (values.max_restart == '1') {
if (!me.create) {
values['delete'] = values['delete'] ? values['delete'] + ',max_restart' : 'max_restart';
}
delete values.max_restart;
}
if (values.max_relocate == '1') {
if (!me.create) {
values['delete'] = values['delete'] ? values['delete'] + ',max_relocate' : 'max_relocate';
}
delete values.max_relocate;
}
return values;
},
@ -48,6 +61,24 @@ Ext.define('PVE.ha.VMResourceInputPanel', {
value: me.vmid,
loadNextFreeVMID: false,
validateExists: true
},
{
xtype: 'numberfield',
name: 'max_restart',
fieldLabel: gettext('Max. Restart'),
value: 1,
minValue: 0,
maxValue: 10,
allowBlank: false
},
{
xtype: 'numberfield',
name: 'max_relocate',
fieldLabel: gettext('Max. Relocate'),
value: 1,
minValue: 0,
maxValue: 10,
allowBlank: false
}
];

View File

@ -123,6 +123,24 @@ Ext.define('PVE.ha.ResourcesView', {
},
dataIndex: 'state'
},
{
header: gettext('Max. Restart'),
width: 100,
sortable: true,
renderer: function(v) {
return v || '1';
},
dataIndex: 'max_restart'
},
{
header: gettext('Max. Relocate'),
width: 100,
sortable: true,
renderer: function(v) {
return v || '1';
},
dataIndex: 'max_relocate'
},
{
header: gettext('Group'),
width: 200,
@ -157,7 +175,8 @@ Ext.define('PVE.ha.ResourcesView', {
Ext.define('pve-ha-resources', {
extend: 'Ext.data.Model',
fields: [
'sid', 'state', 'digest', 'errors', 'group', 'comment'
'sid', 'state', 'digest', 'errors', 'group', 'comment',
'max_restart', 'max_relocate',
],
idProperty: 'sid'
});