]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
apt repositories: add classifyOrigin helper
authorFiona Ebner <f.ebner@proxmox.com>
Mon, 5 Jun 2023 15:43:11 +0000 (17:43 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 9 Jun 2023 11:00:04 +0000 (13:00 +0200)
to be used again to detect mixed repositories before upgrade.

Needed to convert into an actual function for the 'this' usage.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
(cherry picked from commit 3d6b76ee2b562e9de2db0c08a9b31af31a100e21)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/node/APTRepositories.js

index a6f4c9fda16fa59425fcf0c9e3db1936d84230c3..5e3a904ff62b4220f9fee9e681cc533e94f5f0f4 100644 (file)
@@ -343,14 +343,15 @@ Ext.define('Proxmox.node.APTRepositoriesGrid', {
            header: gettext('Origin'),
            dataIndex: 'Origin',
            width: 120,
-           renderer: (value, meta, rec) => {
+           renderer: function(value, meta, rec) {
                if (typeof value !== 'string' || value.length === 0) {
                    value = gettext('Other');
                }
                let cls = 'fa fa-fw fa-question-circle-o';
-               if (value.match(/^\s*Proxmox\s*$/i)) {
+               let originType = this.up('proxmoxNodeAPTRepositories').classifyOrigin(value);
+               if (originType === 'Proxmox') {
                    cls = 'pmx-itype-icon pmx-itype-icon-proxmox-x';
-               } else if (value.match(/^\s*Debian\s*(:?Backports)?$/i)) {
+               } else if (originType === 'Debian') {
                    cls = 'pmx-itype-icon pmx-itype-icon-debian-swirl';
                }
                return `<i class='${cls}'></i> ${value}`;
@@ -404,6 +405,15 @@ Ext.define('Proxmox.node.APTRepositories', {
 
     product: 'Proxmox VE', // default
 
+    classifyOrigin: function(origin) {
+       if (origin.match(/^\s*Proxmox\s*$/i)) {
+           return 'Proxmox';
+       } else if (origin.match(/^\s*Debian\s*(:?Backports)?$/i)) {
+           return 'Debian';
+       }
+       return 'Other';
+    },
+
     controller: {
        xclass: 'Ext.app.ViewController',