[pve-devel] [PATCH widget-toolkit 3/5] apt repositories: add classifyOrigin helper
Fiona Ebner
f.ebner at proxmox.com
Mon Jun 5 17:43:11 CEST 2023
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 at proxmox.com>
---
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 ed58e5b..5971bd8 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 `<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',
--
2.39.2
More information about the pve-devel
mailing list