public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager] ui: pool: dynamic status update in members screen
@ 2024-07-31  9:41 Theodor Fumics via pve-devel
  2024-11-12  9:13 ` [pve-devel] applied: " Dominik Csapak
  0 siblings, 1 reply; 2+ messages in thread
From: Theodor Fumics via pve-devel @ 2024-07-31  9:41 UTC (permalink / raw)
  To: pve-devel; +Cc: Theodor Fumics

[-- Attachment #1: Type: message/rfc822, Size: 6904 bytes --]

From: Theodor Fumics <theodor.fumics@gmx.net>
To: pve-devel@lists.proxmox.com
Subject: [PATCH manager] ui: pool: dynamic status update in members screen
Date: Wed, 31 Jul 2024 11:41:48 +0200
Message-ID: <20240731094149.121402-1-theodor.fumics@gmx.net>

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@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



[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-12  9:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-31  9:41 [pve-devel] [PATCH manager] ui: pool: dynamic status update in members screen Theodor Fumics via pve-devel
2024-11-12  9:13 ` [pve-devel] applied: " Dominik Csapak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal