all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup v2 6/6] ui: add tooltip to datastore in maintenance mode
Date: Tue, 26 Apr 2022 06:23:35 +0000	[thread overview]
Message-ID: <20220426062335.6215-7-h.laimer@proxmox.com> (raw)
In-Reply-To: <20220426062335.6215-1-h.laimer@proxmox.com>

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
Tooltips are already used in pve-manager, but in a TreePanel. For some
reason qtips are not available 'out of the box' for TreeList, therefore
the custom 'qtiptreelistitem' is needed here.

 www/NavigationTree.js | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/www/NavigationTree.js b/www/NavigationTree.js
index 4f451148..28323c53 100644
--- a/www/NavigationTree.js
+++ b/www/NavigationTree.js
@@ -121,9 +121,26 @@ Ext.define('PBS.store.NavigationStore', {
     },
 });
 
+Ext.define('CustomTreeListItem', {
+    extend: 'Ext.list.TreeItem',
+    xtype: 'qtiptreelistitem',
+    updateNode: function(node, oldNode) {
+	const qtip = node ? node.get('qtip') : null;
+	this.callParent([node, oldNode]);
+	if (qtip) {
+	    this.element.dom.setAttribute('data-qtip', qtip);
+	} else {
+	    this.element.dom.removeAttribute('data-qtip');
+	}
+    },
+});
+
 Ext.define('PBS.view.main.NavigationTree', {
     extend: 'Ext.list.Tree',
     xtype: 'navigationtree',
+    defaults: {
+	xtype: 'qtiptreelistitem',
+    },
 
     controller: {
 	xclass: 'Ext.app.ViewController',
@@ -230,14 +247,17 @@ Ext.define('PBS.view.main.NavigationTree', {
 		    j++;
 		}
 
-		let iconCls = 'fa fa-database';
+		let [qtip, iconCls] = ['', 'fa fa-database'];
 		const maintenance = records[i].data.maintenance;
 		if (maintenance) {
+		    const [type, message] = PBS.Utils.parseMaintenanceMode(maintenance);
+		    qtip = `${type}${message ? ': ' + message : ''}`;
 		    iconCls = 'fa fa-database pmx-tree-icon-custom maintenance';
 		}
 
 		const child = {
 		    text: name,
+		    qtip,
 		    path: `DataStore-${name}`,
 		    iconCls,
 		    leaf: true,
-- 
2.30.2





  parent reply	other threads:[~2022-04-26  6:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-26  6:23 [pbs-devel] [PATCH proxmox-backup v2 0/6] improve UI for " Hannes Laimer
2022-04-26  6:23 ` [pbs-devel] [PATCH proxmox-backup v2 1/6] ui: add summary mask when in " Hannes Laimer
2022-04-26  6:23 ` [pbs-devel] [PATCH proxmox-backup v2 2/6] api2: DataStoreListItem add maintenance info Hannes Laimer
2022-04-26  6:23 ` [pbs-devel] [PATCH proxmox-backup v2 3/6] ui: update icon in datastore list when in maintenance mode Hannes Laimer
2022-04-26  6:23 ` [pbs-devel] [PATCH proxmox-backup v2 4/6][optional] ui: update datastore list more often Hannes Laimer
2022-04-26  6:23 ` [pbs-devel] [PATCH proxmox-backup v2 5/6] ui: utils: add function for parsing maintenance mode Hannes Laimer
2022-04-26  6:23 ` Hannes Laimer [this message]
2022-04-27 17:40 ` [pbs-devel] applied-series: [PATCH proxmox-backup v2 0/6] improve UI for " Thomas Lamprecht

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=20220426062335.6215-7-h.laimer@proxmox.com \
    --to=h.laimer@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal