]> git.proxmox.com Git - proxmox-backup.git/commitdiff
ui: add RunningTasksStore
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 9 Jul 2020 11:38:20 +0000 (13:38 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 9 Jul 2020 12:26:57 +0000 (14:26 +0200)
so that we have a global store for running tasks

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
www/MainView.js
www/Makefile
www/dashboard/RunningTasks.js
www/data/RunningTasksStore.js [new file with mode: 0644]

index 062d78e0ff53223f1a5b2e4eb795620f4b4c01f6..cb7a81df7843908b02c542a9f2656f3868be1756 100644 (file)
@@ -133,6 +133,7 @@ Ext.define('PBS.MainView', {
        init: function(view) {
            var me = this;
 
+           PBS.data.RunningTasksStore.startUpdate();
            me.lookupReference('usernameinfo').update({username:Proxmox.UserName});
 
            // show login on requestexception
index 29a356190d5fbc3d5692100a91cb370e0d75d471..b205f6775cda5174f4e8f46271ed6cafbb5a3022 100644 (file)
@@ -8,6 +8,7 @@ JSSRC=                                                  \
        form/UserSelector.js                            \
        form/RemoteSelector.js                          \
        form/DataStoreSelector.js                       \
+       data/RunningTasksStore.js                       \
        config/UserView.js                              \
        config/RemoteView.js                            \
        config/ACLView.js                               \
index 9b53d1becc18bc482fbc1a827ba960ed8a660e3b..e31218efaf4bce3f80d4f1aceec2a38fce3655e3 100644 (file)
@@ -54,20 +54,8 @@ Ext.define('PBS.RunningTasks', {
     store: {
        type: 'diff',
        autoDestroy: true,
-       autoDestroyRstore: true,
        sorters: 'starttime',
-       rstore: {
-           type: 'update',
-           autoStart: true,
-           interval: 3000,
-           storeid: 'pbs-running-tasks-dash',
-           model: 'proxmox-tasks',
-           proxy: {
-               type: 'proxmox',
-               // maybe separate api call?
-               url: '/api2/json/nodes/localhost/tasks?running=1'
-           },
-       },
+       rstore: PBS.data.RunningTasksStore,
     },
 
     columns: [
diff --git a/www/data/RunningTasksStore.js b/www/data/RunningTasksStore.js
new file mode 100644 (file)
index 0000000..d78c44e
--- /dev/null
@@ -0,0 +1,21 @@
+Ext.define('PBS.data.RunningTasksStore', {
+    extend: 'Proxmox.data.UpdateStore',
+
+    singleton: true,
+
+    constructor: function(config) {
+       let me = this;
+       config = config || {};
+       Ext.apply(config, {
+           interval: 3000,
+           storeid: 'pbs-running-tasks-dash',
+           model: 'proxmox-tasks',
+           proxy: {
+               type: 'proxmox',
+               // maybe separate api call?
+               url: '/api2/json/nodes/localhost/tasks?running=1',
+           },
+       });
+       me.callParent([config]);
+    },
+});