From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 78B841FF15F for ; Sat, 26 Jul 2025 03:07:08 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A0DCD31DF5; Sat, 26 Jul 2025 03:07:10 +0200 (CEST) From: Aaron Lauterer To: pve-devel@lists.proxmox.com Date: Sat, 26 Jul 2025 03:06:04 +0200 Message-Id: <20250726010626.1496866-10-a.lauterer@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250726010626.1496866-1-a.lauterer@proxmox.com> References: <20250726010626.1496866-1-a.lauterer@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1753491982219 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.015 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH widget-toolkit v4 4/4] rrdchart: add dummy listener for legend clicks X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" This way we can define a listener when needed to react to any clicks in the legend. Usually enabling/disabling some data series. The event was nowhere documented, but by using the following snippet, right where we add the listener, it can be observed to happen. ``` Ext.mixin.Observable.capture(this, function(evname) {console.log(evname, arguments);}) ``` This would be `me.legend` in that scenario. Signed-off-by: Aaron Lauterer --- src/panel/RRDChart.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/panel/RRDChart.js b/src/panel/RRDChart.js index 7f0b923..c81e2e7 100644 --- a/src/panel/RRDChart.js +++ b/src/panel/RRDChart.js @@ -67,6 +67,8 @@ Ext.define('Proxmox.widget.RRDChart', { // set to empty string to suppress warning in debug mode downloadServerUrl: '-', + onLegendChange: Ext.emptyFn, // empty dummy function so we can add listener for legend events when needed + controller: { xclass: 'Ext.app.ViewController', @@ -261,6 +263,8 @@ Ext.define('Proxmox.widget.RRDChart', { me.updateHeader(); if (me.header && me.legend) { + // event itemclick is not documented for legend, but found it by printing all events happening + me.legend.addListener('itemclick', me.onLegendChange); me.header.padding = '4 9 4'; me.header.add(me.legend); me.legend = undefined; -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel