public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Theodor Fumics via pve-devel <pve-devel@lists.proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Theodor Fumics <theodor.fumics@gmx.net>
Subject: [pve-devel] [PATCH manager] ui: pool: dynamic status update in members screen
Date: Wed, 31 Jul 2024 11:41:48 +0200	[thread overview]
Message-ID: <mailman.68.1722418997.302.pve-devel@lists.proxmox.com> (raw)

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

                 reply	other threads:[~2024-07-31  9:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mailman.68.1722418997.302.pve-devel@lists.proxmox.com \
    --to=pve-devel@lists.proxmox.com \
    --cc=theodor.fumics@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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