public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH proxmox-widget-toolkit 1/2] node: repos: properly ignore warnings for other properties
Date: Mon,  5 Jul 2021 15:50:31 +0200	[thread overview]
Message-ID: <20210705135033.101390-5-f.ebner@proxmox.com> (raw)
In-Reply-To: <20210705135033.101390-1-f.ebner@proxmox.com>

Previously, if there were some warnings, but no warnings for the
'Suites' property, it would still display as a warning (without
additional text).

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 src/node/APTRepositories.js | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/node/APTRepositories.js b/src/node/APTRepositories.js
index e8f807d..e9e8d92 100644
--- a/src/node/APTRepositories.js
+++ b/src/node/APTRepositories.js
@@ -275,14 +275,18 @@ Ext.define('Proxmox.node.APTRepositoriesGrid', {
 	    header: gettext('Suites'),
 	    dataIndex: 'Suites',
 	    renderer: function(suites, metaData, record) {
+		if (!record.data.warnings) {
+		    return suites.join(' ');
+		}
+
+		const warningTexts = record.data.warnings.filter(
+		    warning => warning.property === 'Suites',
+		).map(warning => warning.message);
+
 		let err = '';
-		if (record.data.warnings && record.data.warnings.length > 0) {
-		    let txt = [gettext('Warning')];
-		    record.data.warnings.forEach((warning) => {
-			if (warning.property === 'Suites') {
-			    txt.push(warning.message);
-			}
-		    });
+		if (warningTexts.length > 0) {
+		    const txt = [gettext('Warning')].concat(warningTexts);
+
 		    metaData.tdAttr = `data-qtip="${Ext.htmlEncode(txt.join('<br>'))}"`;
 		    if (record.data.Enabled) {
 			metaData.tdCls = 'proxmox-invalid-row';
-- 
2.30.2





  parent reply	other threads:[~2021-07-05 13:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-05 13:50 [pve-devel] [PATCH-SERIES apt/widget-toolkit/manager] small refinements for APT repositories Fabian Ebner
2021-07-05 13:50 ` [pve-devel] [PATCH proxmox-apt 1/3] code cleanup: use contains() Fabian Ebner
2021-07-16 14:19   ` [pve-devel] applied: " Thomas Lamprecht
2021-07-05 13:50 ` [pve-devel] [PATCH proxmox-apt 2/3] repository check: limit 'stable' to Proxmox and Debian origin Fabian Ebner
2021-07-05 13:50 ` [pve-devel] [RFC proxmox-apt 3/3] repository check: check components for Proxmox repositories Fabian Ebner
2021-07-05 13:50 ` Fabian Ebner [this message]
2021-07-05 13:50 ` [pve-devel] [RFC proxmox-widget-toolkit 2/2] node: repos: show components warnings from the backend Fabian Ebner
2021-07-05 13:50 ` [pve-devel] [PATCH manager 1/1] api: apt: repositories: add description to return schema Fabian Ebner

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=20210705135033.101390-5-f.ebner@proxmox.com \
    --to=f.ebner@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal