[pve-devel] [PATCH] task view, progress: add taskDone callback
Thomas Lamprecht
t.lamprecht at proxmox.com
Tue Mar 27 13:25:23 CEST 2018
and integrate it into the edit window
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
window/Edit.js | 5 +++++
window/TaskViewer.js | 6 ++++++
2 files changed, 11 insertions(+)
diff --git a/window/Edit.js b/window/Edit.js
index 75fce39..f72bee0 100644
--- a/window/Edit.js
+++ b/window/Edit.js
@@ -40,6 +40,10 @@ Ext.define('Proxmox.window.Edit', {
showTaskViewer: false,
+ // gets called if we have a progress bar or taskview and it detected that
+ // the task finished. function(success)
+ taskDone: Ext.emptyFn,
+
// assign a reference from docs, to add a help button docked to the
// bottom of the window. If undefined we magically fall back to the
// onlineHelp of our first item, if set.
@@ -144,6 +148,7 @@ Ext.define('Proxmox.window.Edit', {
var viewerClass = me.showTaskViewer ? 'Viewer' : 'Progress';
var win = Ext.create('Proxmox.window.Task' + viewerClass, {
upid: upid,
+ taskDone: me.taskDone,
listeners: {
destroy: function () {
me.close();
diff --git a/window/TaskViewer.js b/window/TaskViewer.js
index c6bb370..a3d4a37 100644
--- a/window/TaskViewer.js
+++ b/window/TaskViewer.js
@@ -2,6 +2,8 @@ Ext.define('Proxmox.window.TaskProgress', {
extend: 'Ext.window.Window',
alias: 'widget.proxmoxTaskProgress',
+ taskDone: Ext.emptyFn,
+
initComponent: function() {
var me = this;
@@ -44,6 +46,7 @@ Ext.define('Proxmox.window.TaskProgress', {
me.close();
Ext.Msg.alert('Task failed', exitstatus);
}
+ me.taskDone(exitstatus == 'OK');
}
});
@@ -87,6 +90,8 @@ Ext.define('Proxmox.window.TaskViewer', {
extraTitle: '', // string to prepend after the generic task title
+ taskDone: Ext.emptyFn,
+
initComponent: function() {
var me = this;
@@ -195,6 +200,7 @@ Ext.define('Proxmox.window.TaskViewer', {
logView.requestUpdate(undefined, true);
logView.scrollToEnd = false;
statstore.stopUpdate();
+ me.taskDone(statgrid.getObjectValue('exitstatus') == 'OK');
}
stop_btn1.setDisabled(status !== 'running');
--
2.14.2
More information about the pve-devel
mailing list