[pve-devel] [RFC proxmox-widget-toolkit 2/2] node: repos: show components warnings from the backend

Fabian Ebner f.ebner at proxmox.com
Mon Jul 5 15:50:32 CEST 2021


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 at 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






More information about the pve-devel mailing list