[PATCH manager] ui: pool: dynamic status update in members screen

Theodor Fumics theodor.fumics at gmx.net
Wed Jul 31 11:41:48 CEST 2024


Added an UpdateStore to the PVE.grid.PoolMembers component
to dynamically refresh the members' overview every 10 seconds.
This ensures that the displayed data is up-to-date,
reflecting the current state of the pool members.

Signed-off-by: Theodor Fumics <theodor.fumics at gmx.net>
---
 www/manager6/grid/PoolMembers.js | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/www/manager6/grid/PoolMembers.js b/www/manager6/grid/PoolMembers.js
index 75f20cab..34e66759 100644
--- a/www/manager6/grid/PoolMembers.js
+++ b/www/manager6/grid/PoolMembers.js
@@ -148,8 +148,6 @@ Ext.define('PVE.grid.PoolMembers', {
     extend: 'Ext.grid.GridPanel',
     alias: ['widget.pvePoolMembers'],

-    // fixme: dynamic status update ?
-
     stateful: true,
     stateId: 'grid-pool-members',

@@ -160,19 +158,25 @@ Ext.define('PVE.grid.PoolMembers', {
 	    throw "no pool specified";
 	}

-	var store = Ext.create('Ext.data.Store', {
+	me.rstore = Ext.create('Proxmox.data.UpdateStore', {
+	    interval: 10000,
 	    model: 'PVEResources',
+	    proxy: {
+		type: 'proxmox',
+		root: 'data[0].members',
+		url: `/api2/json/pools/?poolid=${me.pool}`,
+	    },
+	    autoStart: true,
+	});
+
+	let store = Ext.create('Proxmox.data.DiffStore', {
+	    rstore: me.rstore,
 	    sorters: [
 		{
 		    property: 'type',
 		    direction: 'ASC',
 		},
 	    ],
-	    proxy: {
-		type: 'proxmox',
-		root: 'data[0].members',
-		url: "/api2/json/pools/?poolid=" + me.pool,
-	    },
 	});

 	var coldef = PVE.data.ResourceStore.defaultColumns().filter((c) =>
@@ -260,6 +264,7 @@ Ext.define('PVE.grid.PoolMembers', {
 		    ws.selectById(record.data.id);
 		},
 		activate: reload,
+		destroy: () => me.rstore.stopUpdate(),
 	    },
 	});

--
2.39.2




More information about the pve-devel mailing list