ui/qemu: Extend Qemu Guest agent
Change to agent now being a property_string, and including fstrim_cloned_disks. Co-Authored-By: Thomas Lamprecht <t.lamprecht@proxmox.com> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
This commit is contained in:
parent
8007aaaf87
commit
1662ccdbfd
@ -50,6 +50,7 @@ JSSRC= \
|
||||
form/SnapshotSelector.js \
|
||||
form/ContentTypeSelector.js \
|
||||
form/HotplugFeatureSelector.js \
|
||||
form/AgentFeatureSelector.js \
|
||||
form/iScsiProviderSelector.js \
|
||||
form/DayOfWeekSelector.js \
|
||||
form/BackupModeSelector.js \
|
||||
|
@ -175,6 +175,32 @@ Ext.define('PVE.Utils', { utilities: {
|
||||
return fa.join(', ');
|
||||
},
|
||||
|
||||
render_qga_features: function(value) {
|
||||
if (!value) {
|
||||
return Proxmox.Utils.defaultText + ' (' + Proxmox.Utils.disabledText + ')';
|
||||
}
|
||||
var props = PVE.Parser.parsePropertyString(value, 'enabled');
|
||||
if (!PVE.Parser.parseBoolean(props.enabled)) {
|
||||
return Proxmox.Utils.disabledText;
|
||||
}
|
||||
|
||||
delete props.enabled;
|
||||
var agentstring = Proxmox.Utils.enabledText;
|
||||
|
||||
Ext.Object.each(props, function(key, value) {
|
||||
var keystring = '' ;
|
||||
agentstring += ', ' + key + ': ';
|
||||
|
||||
if (PVE.Parser.parseBoolean(value)) {
|
||||
agentstring += Proxmox.Utils.enabledText;
|
||||
} else {
|
||||
agentstring += Proxmox.Utils.disabledText;
|
||||
}
|
||||
});
|
||||
|
||||
return agentstring;
|
||||
},
|
||||
|
||||
render_qemu_bios: function(value) {
|
||||
if (!value) {
|
||||
return Proxmox.Utils.defaultText + ' (SeaBIOS)';
|
||||
|
44
www/manager6/form/AgentFeatureSelector.js
Normal file
44
www/manager6/form/AgentFeatureSelector.js
Normal file
@ -0,0 +1,44 @@
|
||||
Ext.define('PVE.form.AgentFeatureSelector', {
|
||||
extend: 'Proxmox.panel.InputPanel',
|
||||
alias: ['widget.pveAgentFeatureSelector'],
|
||||
|
||||
initComponent: function() {
|
||||
var me = this;
|
||||
me.items= [
|
||||
{
|
||||
xtype: 'proxmoxcheckbox',
|
||||
boxLabel: gettext('Qemu Agent'),
|
||||
name: 'enabled',
|
||||
uncheckedValue: 0,
|
||||
listeners: {
|
||||
change: function(f, value, old) {
|
||||
var gtcb = me.down('proxmoxcheckbox[name=fstrim_cloned_disks]');
|
||||
if (value) {
|
||||
gtcb.setDisabled(false);
|
||||
} else {
|
||||
gtcb.setDisabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
xtype: 'proxmoxcheckbox',
|
||||
boxLabel: gettext('Run guest-trim after clone disk'),
|
||||
name: 'fstrim_cloned_disks',
|
||||
disabled: true
|
||||
}
|
||||
];
|
||||
me.callParent();
|
||||
},
|
||||
|
||||
onGetValues: function(values) {
|
||||
var agentstr = PVE.Parser.printPropertyString(values, 'enabled');
|
||||
return { agent: agentstr };
|
||||
},
|
||||
|
||||
setValues: function(values) {
|
||||
var agent = values.agent || '';
|
||||
var res = PVE.Parser.parsePropertyString(agent, 'enabled');
|
||||
this.callParent([res]);
|
||||
}
|
||||
});
|
@ -266,17 +266,13 @@ Ext.define('PVE.qemu.Options', {
|
||||
agent: {
|
||||
header: gettext('Qemu Agent'),
|
||||
defaultValue: false,
|
||||
renderer: Proxmox.Utils.format_boolean,
|
||||
renderer: PVE.Utils.render_qga_features,
|
||||
editor: caps.vms['VM.Config.Options'] ? {
|
||||
xtype: 'proxmoxWindowEdit',
|
||||
subject: gettext('Qemu Agent'),
|
||||
items: {
|
||||
xtype: 'proxmoxcheckbox',
|
||||
name: 'agent',
|
||||
uncheckedValue: 0,
|
||||
defaultValue: 0,
|
||||
deleteDefaultValue: true,
|
||||
fieldLabel: gettext('Enabled')
|
||||
xtype: 'pveAgentFeatureSelector',
|
||||
name: 'agent'
|
||||
}
|
||||
} : undefined
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user