[pve-devel] [PATCH widget-toolkit] ui: repo status: Simplify logic for adding warnings

Maximiliano Sandoval m.sandoval at proxmox.com
Thu Dec 7 14:11:46 CET 2023


The strings were hard to translate and required some tricks like passing
'Ceph ' as an argument. The `/main` part was also removed to simplify
the flow and UX.

Suggested-by: Dietmar Maurer <dietmar at proxmox.com>
Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
 src/node/APTRepositories.js | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/node/APTRepositories.js b/src/node/APTRepositories.js
index 4e74da2..9dfd588 100644
--- a/src/node/APTRepositories.js
+++ b/src/node/APTRepositories.js
@@ -489,33 +489,31 @@ Ext.define('Proxmox.node.APTRepositories', {
 		addWarn(gettext('Detected mixed suites before upgrade'));
 	    }
 
-	    let productionReadyCheck = (repos, type, noSubAlternateName) => {
+	    let productionReadyCheck = (repos, name) => {
 		if (!activeSubscription && repos.enterprise) {
 		    addWarn(Ext.String.format(
-			gettext('The {0}enterprise repository is enabled, but there is no active subscription!'),
-			type,
+			gettext('The {0} enterprise repository is enabled, but there is no active subscription!'),
+			name,
 		    ));
 		}
 
 		if (repos.nosubscription) {
 		    addWarn(Ext.String.format(
-			gettext('The {0}no-subscription{1} repository is not recommended for production use!'),
-			type,
-			noSubAlternateName,
+			gettext('The {0} no-subscription repository is not recommended for production use!'),
+			name,
 		    ));
 		}
 
 		if (repos.test) {
 		    addWarn(Ext.String.format(
-			gettext('The {0}test repository may pull in unstable updates and is not recommended for production use!'),
-			type,
+			gettext('The {0} test repository may pull in unstable updates and is not recommended for production use!'),
+			name,
 		    ));
 		}
 	    };
 
-	    productionReadyCheck({ enterprise, nosubscription, test }, '', '');
-	    // TODO drop alternate 'main' name when no longer relevant
-	    productionReadyCheck(cephRepos, 'Ceph ', '/main');
+	    productionReadyCheck({ enterprise, nosubscription, test }, vm.get('product'));
+	    productionReadyCheck(cephRepos, 'Ceph');
 
 	    if (errors.length > 0) {
 		text = gettext('Fatal parsing error for at least one repository');
-- 
2.39.2





More information about the pve-devel mailing list