Commit b2c71ac9 authored by Dietmar Maurer's avatar Dietmar Maurer

PVE.window.Edit: add backgroundDelay option

This can be used for the new async qemu config API.
parent af5ed080
...@@ -448,6 +448,7 @@ Ext.define('PVE.Utils', { statics: { ...@@ -448,6 +448,7 @@ Ext.define('PVE.Utils', { statics: {
qmshutdown: [ 'VM', gettext('Shutdown') ], qmshutdown: [ 'VM', gettext('Shutdown') ],
qmsuspend: [ 'VM', gettext('Suspend') ], qmsuspend: [ 'VM', gettext('Suspend') ],
qmresume: [ 'VM', gettext('Resume') ], qmresume: [ 'VM', gettext('Resume') ],
qmconfig: [ 'VM', gettext('Configure') ],
vzcreate: ['CT', gettext('Create') ], vzcreate: ['CT', gettext('Create') ],
vzrestore: ['CT', gettext('Restore') ], vzrestore: ['CT', gettext('Restore') ],
vzdestroy: ['CT', gettext('Destroy') ], vzdestroy: ['CT', gettext('Destroy') ],
......
...@@ -148,6 +148,8 @@ Ext.define('PVE.qemu.MemoryEdit', { ...@@ -148,6 +148,8 @@ Ext.define('PVE.qemu.MemoryEdit', {
Ext.apply(me, { Ext.apply(me, {
subject: gettext('Memory'), subject: gettext('Memory'),
items: [ Ext.create('PVE.qemu.MemoryInputPanel') ], items: [ Ext.create('PVE.qemu.MemoryInputPanel') ],
// uncomment the following to use the async configiguration API
// backgroundDelay: 5,
width: 400 width: 400
}); });
......
...@@ -17,6 +17,8 @@ Ext.define('PVE.window.Edit', { ...@@ -17,6 +17,8 @@ Ext.define('PVE.window.Edit', {
// set to true if you want an Add button (instead of Create) // set to true if you want an Add button (instead of Create)
isAdd: false, isAdd: false,
backgroundDelay: 0,
isValid: function() { isValid: function() {
var me = this; var me = this;
...@@ -82,19 +84,30 @@ Ext.define('PVE.window.Edit', { ...@@ -82,19 +84,30 @@ Ext.define('PVE.window.Edit', {
values.digest = me.digest; values.digest = me.digest;
} }
if (me.backgroundDelay) {
values.background_delay = me.backgroundDelay;
}
PVE.Utils.API2Request({ PVE.Utils.API2Request({
url: me.url, url: me.url,
waitMsgTarget: me, waitMsgTarget: me,
method: me.method || 'PUT', method: me.method || (me.backgroundDelay ? 'POST' : 'PUT'),
params: values, params: values,
failure: function(response, options) { failure: function(response, options) {
if (response.result.errors) { if (response.result && response.result.errors) {
form.markInvalid(response.result.errors); form.markInvalid(response.result.errors);
} }
Ext.Msg.alert(gettext('Error'), response.htmlStatus); Ext.Msg.alert(gettext('Error'), response.htmlStatus);
}, },
success: function(response, options) { success: function(response, options) {
me.close(); me.close();
if (me.backgroundDelay && response.result.data) {
var upid = response.result.data;
var win = Ext.create('PVE.window.TaskProgress', {
upid: upid
});
win.show();
}
} }
}); });
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment