]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
apt repos: add product config-option and rework warning renderer
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 23 Jun 2021 17:42:08 +0000 (19:42 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 23 Jun 2021 17:42:14 +0000 (19:42 +0200)
product defaults to PVE. It is added in the warnings and should be
set by any instance correctly.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/node/APTRepositories.js

index 7cacd78161bb7daade22a66266eb41809cd79b8b..fd4a35003d7fee0bb60b5fe46893fbdec1dfff1b 100644 (file)
@@ -318,8 +318,11 @@ Ext.define('Proxmox.node.APTRepositories', {
 
     digest: undefined,
 
+    product: 'Proxmox VE', // default
+
     viewModel: {
        data: {
+           product: 'Proxmox VE', // default
            errorCount: 0,
            subscriptionActive: '',
            noSubscriptionRepo: '',
@@ -334,21 +337,20 @@ Ext.define('Proxmox.node.APTRepositories', {
                    return '';
                }
 
-               let withStyle = (msg) => "<div style='color:red;'><i class='fa fa-fw " +
-                   "fa-exclamation-triangle'></i>" + gettext('Warning') + ': ' + msg + "</div>";
+               let icon = `<i class='fa fa-fw fa-exclamation-triangle critical'></i>`;
+               let fmt = (msg) => `<div class="black">${icon}${gettext('Warning')}: ${msg}</div>`;
 
                if (!get('subscriptionActive') && get('enterpriseRepo')) {
-                   return withStyle(gettext('The enterprise repository is ' +
-                       'enabled, but there is no active subscription!'));
+                   return fmt(gettext('The enterprise repository is enabled, but there is no active subscription!'));
                }
 
                if (get('noSubscriptionRepo')) {
-                   return withStyle(gettext('The no-subscription repository is ' +
-                       'not recommended for production use!'));
+                   return fmt(gettext('The no-subscription repository is not recommended for production use!'));
                }
 
                if (!get('enterpriseRepo') && !get('noSubscriptionRepo')) {
-                   return withStyle(gettext('No Proxmox repository is enabled!'));
+                   let msg = Ext.String.format(gettext('No {0} repository is enabled!'), get('product'));
+                   return fmt(msg);
                }
 
                return '';
@@ -532,5 +534,7 @@ Ext.define('Proxmox.node.APTRepositories', {
        Proxmox.Utils.monStoreErrors(me, me.store, true);
 
        me.callParent();
+
+       me.getViewModel().set('product', me.product);
     },
 });