From: Dominik Csapak <d.csa...@proxmox.com> Signed-off-by: Dominik Csapak <d.csa...@proxmox.com> Reviewed-by: Thomas Lamprecht <t.lampre...@proxmox.com> --- www/manager6/Makefile | 2 -- www/manager6/ceph/Monitor.js | 2 +- www/manager6/ceph/Pool.js | 2 +- www/manager6/ceph/Status.js | 2 +- www/manager6/data/ObjectStore.js | 2 +- www/manager6/data/ResourceStore.js | 2 +- www/manager6/data/UpdateQueue.js | 67 ------------------------------------- www/manager6/data/UpdateStore.js | 68 -------------------------------------- www/manager6/dc/Health.js | 2 +- www/manager6/dc/Log.js | 2 +- www/manager6/dc/Summary.js | 2 +- www/manager6/dc/Tasks.js | 2 +- www/manager6/grid/Replication.js | 2 +- www/manager6/node/ServiceView.js | 2 +- 14 files changed, 11 insertions(+), 148 deletions(-) delete mode 100644 www/manager6/data/UpdateQueue.js delete mode 100644 www/manager6/data/UpdateStore.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile index 37d8144d..c81cbcae 100644 --- a/www/manager6/Makefile +++ b/www/manager6/Makefile @@ -19,8 +19,6 @@ JSSRC= \ VNCConsole.js \ data/TimezoneStore.js \ data/PVEProxy.js \ - data/UpdateQueue.js \ - data/UpdateStore.js \ data/DiffStore.js \ data/ObjectStore.js \ data/ResourceStore.js \ diff --git a/www/manager6/ceph/Monitor.js b/www/manager6/ceph/Monitor.js index 7e755425..c27b5d27 100644 --- a/www/manager6/ceph/Monitor.js +++ b/www/manager6/ceph/Monitor.js @@ -67,7 +67,7 @@ Ext.define('PVE.node.CephMonList', { var sm = Ext.create('Ext.selection.RowModel', {}); - var rstore = Ext.create('PVE.data.UpdateStore', { + var rstore = Ext.create('Proxmox.data.UpdateStore', { interval: 3000, storeid: 'ceph-mon-list' + nodename, model: 'ceph-mon-list', diff --git a/www/manager6/ceph/Pool.js b/www/manager6/ceph/Pool.js index 33726f9a..100e6777 100644 --- a/www/manager6/ceph/Pool.js +++ b/www/manager6/ceph/Pool.js @@ -152,7 +152,7 @@ Ext.define('PVE.node.CephPoolList', { var sm = Ext.create('Ext.selection.RowModel', {}); - var rstore = Ext.create('PVE.data.UpdateStore', { + var rstore = Ext.create('Proxmox.data.UpdateStore', { interval: 3000, storeid: 'ceph-pool-list' + nodename, model: 'ceph-pool-list', diff --git a/www/manager6/ceph/Status.js b/www/manager6/ceph/Status.js index cda97867..88e64bde 100644 --- a/www/manager6/ceph/Status.js +++ b/www/manager6/ceph/Status.js @@ -268,7 +268,7 @@ Ext.define('PVE.node.CephStatus', { } me.callParent(); - me.store = Ext.create('PVE.data.UpdateStore', { + me.store = Ext.create('Proxmox.data.UpdateStore', { storeid: 'ceph-status-' + nodename, interval: 5000, proxy: { diff --git a/www/manager6/data/ObjectStore.js b/www/manager6/data/ObjectStore.js index 6db1e6ce..f18c7a49 100644 --- a/www/manager6/data/ObjectStore.js +++ b/www/manager6/data/ObjectStore.js @@ -4,7 +4,7 @@ * Designed to work with the KeyValue model and the JsonObject data reader */ Ext.define('PVE.data.ObjectStore', { - extend: 'PVE.data.UpdateStore', + extend: 'Proxmox.data.UpdateStore', constructor: function(config) { var me = this; diff --git a/www/manager6/data/ResourceStore.js b/www/manager6/data/ResourceStore.js index ccf085e3..03e546c5 100644 --- a/www/manager6/data/ResourceStore.js +++ b/www/manager6/data/ResourceStore.js @@ -1,5 +1,5 @@ Ext.define('PVE.data.ResourceStore', { - extend: 'PVE.data.UpdateStore', + extend: 'Proxmox.data.UpdateStore', singleton: true, findVMID: function(vmid) { diff --git a/www/manager6/data/UpdateQueue.js b/www/manager6/data/UpdateQueue.js deleted file mode 100644 index d8c27980..00000000 --- a/www/manager6/data/UpdateQueue.js +++ /dev/null @@ -1,67 +0,0 @@ -// Serialize load (avoid too many parallel connections) -Ext.define('PVE.data.UpdateQueue', { - singleton: true, - - constructor : function(){ - var me = this; - - var queue = []; - var queue_idx = {}; - - var idle = true; - - var start_update = function() { - if (!idle) { - return; - } - - var storeid = queue.shift(); - if (!storeid) { - return; - } - var info = queue_idx[storeid]; - queue_idx[storeid] = null; - - info.updatestart = new Date(); - - idle = false; - info.store.load({ - callback: function(records, operation, success) { - idle = true; - if (info.callback) { - var runtime = (new Date()).getTime() - info.updatestart.getTime(); - info.callback(runtime, success); - } - start_update(); - } - }); - }; - - Ext.apply(me, { - queue: function(store, cb) { - var storeid = store.storeid; - if (!storeid) { - throw "unable to queue store without storeid"; - } - if (!queue_idx[storeid]) { - queue_idx[storeid] = { - store: store, - callback: cb - }; - queue.push(storeid); - } - start_update(); - }, - unqueue: function(store) { - var storeid = store.storeid; - if (!storeid) { - throw "unabel to unqueue store without storeid"; - } - if (queue_idx[storeid]) { - Ext.Array.remove(queue,storeid); - queue_idx[storeid] = null; - } - } - }); - } -}); diff --git a/www/manager6/data/UpdateStore.js b/www/manager6/data/UpdateStore.js deleted file mode 100644 index a8bc9efe..00000000 --- a/www/manager6/data/UpdateStore.js +++ /dev/null @@ -1,68 +0,0 @@ -/* Extends the Ext.data.Store type - * with startUpdate() and stopUpdate() methods - * to refresh the store data in the background - * Components using this store directly will flicker - * due to the redisplay of the element ater 'config.interval' ms - * - * Note that you have to call yourself startUpdate() for the background load - * to begin - */ -Ext.define('PVE.data.UpdateStore', { - extend: 'Ext.data.Store', - - isStopped: true, - - destroy: function() { - var me = this; - me.load_task.cancel(); - PVE.data.UpdateQueue.unqueue(me); - me.callParent(); - }, - - constructor: function(config) { - var me = this; - - config = config || {}; - - if (!config.interval) { - config.interval = 3000; - } - - if (!config.storeid) { - throw "no storeid specified"; - } - - var load_task = new Ext.util.DelayedTask(); - - var run_load_task = function() { - if (me.isStopped) { - return; - } - - if (PVE.Utils.authOK()) { - PVE.data.UpdateQueue.queue(me, function(runtime, success) { - var interval = config.interval + runtime*2; - load_task.delay(interval, run_load_task); - }); - } else { - load_task.delay(200, run_load_task); - } - }; - - Ext.apply(config, { - startUpdate: function() { - me.isStopped = false; - run_load_task(); - }, - stopUpdate: function() { - me.isStopped = true; - load_task.cancel(); - PVE.data.UpdateQueue.unqueue(me); - } - }); - - me.callParent([config]); - - me.load_task = load_task; - } -}); diff --git a/www/manager6/dc/Health.js b/www/manager6/dc/Health.js index 3e336a1b..cca31e08 100644 --- a/www/manager6/dc/Health.js +++ b/www/manager6/dc/Health.js @@ -167,7 +167,7 @@ Ext.define('PVE.dc.Health', { initComponent: function() { var me = this; - me.cephstore = Ext.create('PVE.data.UpdateStore', { + me.cephstore = Ext.create('Proxmox.data.UpdateStore', { interval: 3000, storeid: 'pve-cluster-ceph', proxy: { diff --git a/www/manager6/dc/Log.js b/www/manager6/dc/Log.js index 62370eca..72aa3e6a 100644 --- a/www/manager6/dc/Log.js +++ b/www/manager6/dc/Log.js @@ -10,7 +10,7 @@ Ext.define('PVE.dc.Log', { initComponent : function() { var me = this; - var logstore = new PVE.data.UpdateStore({ + var logstore = Ext.create('Proxmox.data.UpdateStore', { storeid: 'pve-cluster-log', model: 'pve-cluster-log', proxy: { diff --git a/www/manager6/dc/Summary.js b/www/manager6/dc/Summary.js index f93cc950..d593f0ba 100644 --- a/www/manager6/dc/Summary.js +++ b/www/manager6/dc/Summary.js @@ -57,7 +57,7 @@ Ext.define('PVE.dc.Summary', { initComponent: function() { var me = this; - var rstore = Ext.create('PVE.data.UpdateStore', { + var rstore = Ext.create('Proxmox.data.UpdateStore', { interval: 3000, storeid: 'pve-cluster-status', model: 'pve-dc-nodes', diff --git a/www/manager6/dc/Tasks.js b/www/manager6/dc/Tasks.js index 5d65bd2e..70798727 100644 --- a/www/manager6/dc/Tasks.js +++ b/www/manager6/dc/Tasks.js @@ -10,7 +10,7 @@ Ext.define('PVE.dc.Tasks', { initComponent : function() { var me = this; - var taskstore = new PVE.data.UpdateStore({ + var taskstore = Ext.create('Proxmox.data.UpdateStore', { storeid: 'pve-cluster-tasks', model: 'pve-tasks', proxy: { diff --git a/www/manager6/grid/Replication.js b/www/manager6/grid/Replication.js index 654a8368..035cba2d 100644 --- a/www/manager6/grid/Replication.js +++ b/www/manager6/grid/Replication.js @@ -448,7 +448,7 @@ Ext.define('PVE.grid.ReplicaView', { } ); - me.rstore = Ext.create('PVE.data.UpdateStore', { + me.rstore = Ext.create('Proxmox.data.UpdateStore', { storeid: 'pve-replica-' + me.nodename + me.vmid, model: (mode === 'dc')? 'pve-replication' : 'pve-replication-state', interval: 3000, diff --git a/www/manager6/node/ServiceView.js b/www/manager6/node/ServiceView.js index a676280a..b78d1766 100644 --- a/www/manager6/node/ServiceView.js +++ b/www/manager6/node/ServiceView.js @@ -13,7 +13,7 @@ Ext.define('PVE.node.ServiceView', { throw "no node name specified"; } - var rstore = Ext.create('PVE.data.UpdateStore', { + var rstore = Ext.create('Proxmox.data.UpdateStore', { interval: 1000, storeid: 'pve-services' + nodename, model: 'pve-services', -- 2.14.2 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel