From 3d6b76ee2b562e9de2db0c08a9b31af31a100e21 Mon Sep 17 00:00:00 2001 From: Fiona Ebner Date: Mon, 5 Jun 2023 17:43:11 +0200 Subject: [PATCH] apt repositories: add classifyOrigin helper 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 Signed-off-by: Thomas Lamprecht --- src/node/APTRepositories.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/node/APTRepositories.js b/src/node/APTRepositories.js index cb08bb6..c57d74d 100644 --- a/src/node/APTRepositories.js +++ b/src/node/APTRepositories.js @@ -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 ` ${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',