From fec3ae0b639cef03c7a285cf76a4643e3e4f7c40 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 16 Mar 2016 09:12:23 +0100 Subject: [PATCH] copy qemu/StartupEdit.js from manager to manager6 --- www/manager6/qemu/StartupEdit.js | 84 ++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 www/manager6/qemu/StartupEdit.js diff --git a/www/manager6/qemu/StartupEdit.js b/www/manager6/qemu/StartupEdit.js new file mode 100644 index 000000000..6c7357db0 --- /dev/null +++ b/www/manager6/qemu/StartupEdit.js @@ -0,0 +1,84 @@ +Ext.define('PVE.qemu.StartupInputPanel', { + extend: 'PVE.panel.InputPanel', + + onGetValues: function(values) { + var me = this; + + var res = PVE.Parser.printStartup(values); + + if (res === undefined || res === '') { + return { 'delete': 'startup' }; + } + + return { startup: res }; + }, + + setStartup: function(value) { + var me = this; + + var startup = PVE.Parser.parseStartup(value); + if (startup) { + me.setValues(startup); + } + }, + + initComponent : function() { + var me = this; + + me.items = [ + { + xtype: 'textfield', + name: 'order', + defaultValue: '', + emptyText: 'any', + fieldLabel: gettext('Start/Shutdown order') + }, + { + xtype: 'textfield', + name: 'up', + defaultValue: '', + emptyText: 'default', + fieldLabel: gettext('Startup delay') + }, + { + xtype: 'textfield', + name: 'down', + defaultValue: '', + emptyText: 'default', + fieldLabel: gettext('Shutdown timeout') + } + ]; + + me.callParent(); + } +}); + +Ext.define('PVE.qemu.StartupEdit', { + extend: 'PVE.window.Edit', + + initComponent : function() { + /*jslint confusion: true */ + + var me = this; + + var ipanel = Ext.create('PVE.qemu.StartupInputPanel', {}); + + Ext.applyIf(me, { + subject: gettext('Start/Shutdown order'), + fieldDefaults: { + labelWidth: 120 + }, + items: ipanel + }); + + me.callParent(); + + me.load({ + success: function(response, options) { + var i, confid; + me.vmconfig = response.result.data; + ipanel.setStartup(me.vmconfig.startup); + } + }); + } +});