[pve-devel] [PATCH proxmox-widget-toolkit 1/2] node: repos: properly ignore warnings for other properties

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


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






More information about the pve-devel mailing list