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] [RFC proxmox-widget-toolkit 2/2] node: repos: show components warnings from the backend
Date: Mon,  5 Jul 2021 15:50:32 +0200	[thread overview]
Message-ID: <20210705135033.101390-6-f.ebner@proxmox.com> (raw)
In-Reply-To: <20210705135033.101390-1-f.ebner@proxmox.com>

There's no need to show anything new in the top status, as the test
and no-subscription repository already trigger a message.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---

Depends on the new backend behavior.

I felt like this was a good fit for using the existing info/warnings
mechanism again, so I didn't go for what the FIXME suggested, but I
can switch and use that approach if preferred.

 src/node/APTRepositories.js | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/src/node/APTRepositories.js b/src/node/APTRepositories.js
index e9e8d92..13e19a1 100644
--- a/src/node/APTRepositories.js
+++ b/src/node/APTRepositories.js
@@ -307,21 +307,23 @@ Ext.define('Proxmox.node.APTRepositoriesGrid', {
 		if (components === undefined) {
 		    return '';
 		}
-		let err = '';
-		if (components.length === 1) {
-		    // FIXME: this should be a flag set to the actual repsotiories, i.e., a tristate
-		    // like production-ready = <yes|no|other> (Option<bool>)
-		    if (components[0].match(/\w+(-no-subscription|test)\s*$/i)) {
-			metaData.tdCls = 'proxmox-warning-row';
-			err = '<i class="fa fa-fw warning fa-exclamation-circle"></i> ';
 
-			let qtip = components[0].match(/no-subscription/)
-			    ? gettext('The no-subscription repository is NOT production-ready')
-			    : gettext('The test repository may contain unstable updates')
-			    ;
-			    metaData.tdAttr = `data-qtip="${Ext.htmlEncode(qtip)}"`;
-		    }
+		if (!record.data.warnings) {
+		    return components.join(' ');
 		}
+
+		const warningTexts = record.data.warnings.filter(
+		    warning => warning.property === 'Components',
+		).map(warning => warning.message);
+
+		let err = '';
+		if (warningTexts.length > 0) {
+		    const qtip = warningTexts.join('<br>');
+		    metaData.tdCls = 'proxmox-warning-row';
+		    err = '<i class="fa fa-fw warning fa-exclamation-circle"></i> ';
+		    metaData.tdAttr = `data-qtip="${Ext.htmlEncode(qtip)}"`;
+		}
+
 		return components.join(' ') + err;
 	    },
 	    width: 170,
-- 
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 ` [pve-devel] [PATCH proxmox-widget-toolkit 1/2] node: repos: properly ignore warnings for other properties Fabian Ebner
2021-07-05 13:50 ` Fabian Ebner [this message]
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-6-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