mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-06 07:20:36 +00:00
ui: dc/options: allow to edit HA shutdown policy
add some helpers handling this, can be re used for adding the migration field, maybe we want to move this to widget-toolkits parent ObjectGrid class, a bit cleaned up. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
d42ef8da91
commit
8f17b4965a
@ -244,6 +244,14 @@ Ext.define('PVE.Utils', { utilities: {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
render_dc_ha_opts: function(value) {
|
||||||
|
if (!value) {
|
||||||
|
return Proxmox.Utils.defaultText + ' (conditional)';
|
||||||
|
} else {
|
||||||
|
return PVE.Parser.printPropertyString(value);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
render_scsihw: function(value) {
|
render_scsihw: function(value) {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return Proxmox.Utils.defaultText + ' (LSI 53C895A)';
|
return Proxmox.Utils.defaultText + ' (LSI 53C895A)';
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/*jslint confusion: true*/
|
||||||
Ext.define('PVE.dc.OptionView', {
|
Ext.define('PVE.dc.OptionView', {
|
||||||
extend: 'Proxmox.grid.ObjectGrid',
|
extend: 'Proxmox.grid.ObjectGrid',
|
||||||
alias: ['widget.pveDcOptionView'],
|
alias: ['widget.pveDcOptionView'],
|
||||||
@ -6,9 +7,53 @@ Ext.define('PVE.dc.OptionView', {
|
|||||||
|
|
||||||
monStoreErrors: true,
|
monStoreErrors: true,
|
||||||
|
|
||||||
|
add_inputpanel_row: function(name, text, opts) {
|
||||||
|
var me = this;
|
||||||
|
|
||||||
|
opts = opts || {};
|
||||||
|
me.rows = me.rows || {};
|
||||||
|
|
||||||
|
var canEdit = (opts.caps === undefined || opts.caps);
|
||||||
|
me.rows[name] = {
|
||||||
|
required: true,
|
||||||
|
defaultValue: opts.defaultValue,
|
||||||
|
header: text,
|
||||||
|
renderer: opts.renderer,
|
||||||
|
editor: canEdit ? {
|
||||||
|
xtype: 'proxmoxWindowEdit',
|
||||||
|
width: 350,
|
||||||
|
subject: text,
|
||||||
|
fieldDefaults: {
|
||||||
|
labelWidth: opts.labelWidth || 100
|
||||||
|
},
|
||||||
|
setValues: function(values) {
|
||||||
|
var edit_value = values[name];
|
||||||
|
Ext.Array.each(this.query('inputpanel'), function(panel) {
|
||||||
|
panel.setValues(edit_value);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
url: opts.url,
|
||||||
|
items: [{
|
||||||
|
xtype: 'inputpanel',
|
||||||
|
onGetValues: function(values) {
|
||||||
|
if (values === undefined || Object.keys(values).length === 0) {
|
||||||
|
return { 'delete': name };
|
||||||
|
}
|
||||||
|
var ret_val = {};
|
||||||
|
ret_val[name] = PVE.Parser.printPropertyString(values);
|
||||||
|
return ret_val;
|
||||||
|
},
|
||||||
|
items: opts.items
|
||||||
|
}]
|
||||||
|
} : undefined
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
initComponent : function() {
|
initComponent : function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
|
var caps = Ext.state.Manager.get('GuiCap');
|
||||||
|
|
||||||
me.add_combobox_row('keyboard', gettext('Keyboard Layout'), {
|
me.add_combobox_row('keyboard', gettext('Keyboard Layout'), {
|
||||||
renderer: PVE.Utils.render_kvm_language,
|
renderer: PVE.Utils.render_kvm_language,
|
||||||
comboItems: PVE.Utils.kvm_keymap_array(),
|
comboItems: PVE.Utils.kvm_keymap_array(),
|
||||||
@ -36,6 +81,28 @@ Ext.define('PVE.dc.OptionView', {
|
|||||||
vtype: 'MacPrefix',
|
vtype: 'MacPrefix',
|
||||||
defaultValue: Proxmox.Utils.noneText
|
defaultValue: Proxmox.Utils.noneText
|
||||||
});
|
});
|
||||||
|
me.add_inputpanel_row('ha', gettext('HA Settings'), {
|
||||||
|
renderer: PVE.Utils.render_dc_ha_opts,
|
||||||
|
caps: caps.vms['Sys.Modify'],
|
||||||
|
labelWidth: 120,
|
||||||
|
url: "/api2/extjs/cluster/options",
|
||||||
|
items: [{
|
||||||
|
xtype: 'proxmoxKVComboBox',
|
||||||
|
name: 'shutdown_policy',
|
||||||
|
fieldLabel: gettext('Shutdown Policy'),
|
||||||
|
deleteEmpty: false,
|
||||||
|
value: '__default__',
|
||||||
|
comboItems: [
|
||||||
|
['__default__', PVE.Utils.render_dc_ha_opts('')],
|
||||||
|
['freeze', 'freeze'],
|
||||||
|
['failover', 'failover'],
|
||||||
|
['conditional', 'conditional']
|
||||||
|
],
|
||||||
|
defaultValue: '__default__'
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO: bwlimits, migration net, u2f?
|
||||||
|
|
||||||
me.selModel = Ext.create('Ext.selection.RowModel', {});
|
me.selModel = Ext.create('Ext.selection.RowModel', {});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user