PVE.window.Edit: add backgroundDelay option
This can be used for the new async qemu config API.
This commit is contained in:
parent
23699d1eee
commit
9fb3048588
@ -448,6 +448,7 @@ Ext.define('PVE.Utils', { statics: {
|
||||
qmshutdown: [ 'VM', gettext('Shutdown') ],
|
||||
qmsuspend: [ 'VM', gettext('Suspend') ],
|
||||
qmresume: [ 'VM', gettext('Resume') ],
|
||||
qmconfig: [ 'VM', gettext('Configure') ],
|
||||
vzcreate: ['CT', gettext('Create') ],
|
||||
vzrestore: ['CT', gettext('Restore') ],
|
||||
vzdestroy: ['CT', gettext('Destroy') ],
|
||||
|
@ -148,6 +148,8 @@ Ext.define('PVE.qemu.MemoryEdit', {
|
||||
Ext.apply(me, {
|
||||
subject: gettext('Memory'),
|
||||
items: [ Ext.create('PVE.qemu.MemoryInputPanel') ],
|
||||
// uncomment the following to use the async configiguration API
|
||||
// backgroundDelay: 5,
|
||||
width: 400
|
||||
});
|
||||
|
||||
|
@ -17,6 +17,8 @@ Ext.define('PVE.window.Edit', {
|
||||
// set to true if you want an Add button (instead of Create)
|
||||
isAdd: false,
|
||||
|
||||
backgroundDelay: 0,
|
||||
|
||||
isValid: function() {
|
||||
var me = this;
|
||||
|
||||
@ -82,19 +84,30 @@ Ext.define('PVE.window.Edit', {
|
||||
values.digest = me.digest;
|
||||
}
|
||||
|
||||
if (me.backgroundDelay) {
|
||||
values.background_delay = me.backgroundDelay;
|
||||
}
|
||||
|
||||
PVE.Utils.API2Request({
|
||||
url: me.url,
|
||||
waitMsgTarget: me,
|
||||
method: me.method || 'PUT',
|
||||
method: me.method || (me.backgroundDelay ? 'POST' : 'PUT'),
|
||||
params: values,
|
||||
failure: function(response, options) {
|
||||
if (response.result.errors) {
|
||||
if (response.result && response.result.errors) {
|
||||
form.markInvalid(response.result.errors);
|
||||
}
|
||||
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
|
||||
},
|
||||
success: function(response, options) {
|
||||
me.close();
|
||||
if (me.backgroundDelay && response.result.data) {
|
||||
var upid = response.result.data;
|
||||
var win = Ext.create('PVE.window.TaskProgress', {
|
||||
upid: upid
|
||||
});
|
||||
win.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user