From: Aaron Lauterer <a.lauterer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 manager 2/2] ui: ceph status: add tooltip with details to warnings
Date: Fri, 3 Mar 2023 16:59:25 +0100 [thread overview]
Message-ID: <20230303155925.1142116-3-a.lauterer@proxmox.com> (raw)
In-Reply-To: <20230303155925.1142116-1-a.lauterer@proxmox.com>
This is another step to make it easier for admins to discover more
information for a warning or problem that is shown in the Ceph health
panel.
The length is limited to give a first glimpse. For the full details one
can click on the info/detail button.
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
---
changes since v1:
* only destroy it when leaving the whole grid, use show/hide for all
other situations
* factor out text handling of newlines and max lines
* factor out updating and destroying into their own functions
* add more listeners
* hide it when hovering the info button
* auto update it whenever the store is updated to either hide it
(nothing under the mouse) or set the content
www/manager6/ceph/Status.js | 69 +++++++++++++++++++++++++++++++++++++
1 file changed, 69 insertions(+)
diff --git a/www/manager6/ceph/Status.js b/www/manager6/ceph/Status.js
index b223ab35..9de89df5 100644
--- a/www/manager6/ceph/Status.js
+++ b/www/manager6/ceph/Status.js
@@ -76,6 +76,66 @@ Ext.define('PVE.node.CephStatus', {
trackRemoved: false,
data: [],
},
+ generateTooltipText: (text) => {
+ text = text?.trimStart();
+ if (text.length > 500) {
+ text = `${text.substring(0, 500)}…`;
+ }
+ return text.replaceAll('\n', '<br>');
+ },
+ updateTooltip: (view, isLeave) => {
+ if (!view.tooltip) {
+ return;
+ }
+ if (view.store.data.length - 1 < view.tooltip.gridIndex || isLeave) {
+ view.tooltip.hide();
+ } else {
+ let data = view.store.getData().items[view.tooltip.gridIndex].data;
+ if (!data.detail) {
+ return;
+ }
+ let text = view.up('#warnings').generateTooltipText(data.detail);
+ view.tooltip.setData({ text });
+ }
+ },
+ destroyTooltip(view) {
+ view.tooltip?.destroy();
+ delete view.tooltip;
+ },
+
+ listeners: {
+ destroy: function() {
+ let view = this.getView();
+ this.destroyTooltip(view);
+ },
+ itemmouseenter: function(view, record, item, index) {
+ if (!view) {
+ return;
+ }
+ if (!record.data.detail) {
+ return;
+ }
+ let text = this.generateTooltipText(record.data.detail);
+ if (!view.tooltip) {
+ view.tooltip = Ext.create('Ext.tip.ToolTip', {
+ target: view,
+ trackMouse: true,
+ dismissDelay: 0,
+ tpl: '{text}',
+ renderTo: Ext.getBody(),
+ });
+ }
+ view.tooltip.gridIndex = index;
+ view.tooltip.setData({ text });
+ view.tooltip.show();
+ },
+ itemmouseleave: function(view, record, item) {
+ this.updateTooltip(view, true);
+ },
+ containermouseout: function(view) {
+ this.destroyTooltip(view);
+ },
+ },
emptyText: gettext('No Warnings/Errors'),
columns: [
{
@@ -133,6 +193,14 @@ Ext.define('PVE.node.CephStatus', {
}],
});
},
+ listeners: {
+ mouseover: (view) => {
+ view.up('#warnings').getView().tooltip.hide();
+ },
+ mouseout: (view) => {
+ view.up('#warnings').getView().tooltip.show();
+ },
+ },
},
},
],
@@ -286,6 +354,7 @@ Ext.define('PVE.node.CephStatus', {
me.down('#overallhealth').updateHealth(PVE.Utils.render_ceph_health(rec.data.health || {}));
// add errors to gridstore
me.down('#warnings').getStore().loadRawData(me.generateCheckData(rec.data.health || {}), false);
+ me.down('#warnings').updateTooltip(me.down('#warnings').getView());
// update services
me.getComponent('services').updateAll(me.metadata || {}, rec.data);
--
2.30.2
next prev parent reply other threads:[~2023-03-03 15:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-03 15:59 [pve-devel] [PATCH v2 manager 0/2] ui: ceph: improve discoverability of warning details Aaron Lauterer
2023-03-03 15:59 ` [pve-devel] [PATCH v2 manager 1/2] ui: ceph: make the warning detail button stand out more Aaron Lauterer
2023-03-03 15:59 ` Aaron Lauterer [this message]
2023-03-08 9:27 ` [pve-devel] [PATCH v2 manager 2/2] ui: ceph status: add tooltip with details to warnings Dominik Csapak
2023-03-08 12:03 ` Aaron Lauterer
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=20230303155925.1142116-3-a.lauterer@proxmox.com \
--to=a.lauterer@proxmox.com \
--cc=pve-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox