mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-05-22 22:00:18 +00:00
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 <f.ebner@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
f6f29f8c1c
commit
3d6b76ee2b
@ -343,14 +343,15 @@ Ext.define('Proxmox.node.APTRepositoriesGrid', {
|
|||||||
header: gettext('Origin'),
|
header: gettext('Origin'),
|
||||||
dataIndex: 'Origin',
|
dataIndex: 'Origin',
|
||||||
width: 120,
|
width: 120,
|
||||||
renderer: (value, meta, rec) => {
|
renderer: function(value, meta, rec) {
|
||||||
if (typeof value !== 'string' || value.length === 0) {
|
if (typeof value !== 'string' || value.length === 0) {
|
||||||
value = gettext('Other');
|
value = gettext('Other');
|
||||||
}
|
}
|
||||||
let cls = 'fa fa-fw fa-question-circle-o';
|
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';
|
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';
|
cls = 'pmx-itype-icon pmx-itype-icon-debian-swirl';
|
||||||
}
|
}
|
||||||
return `<i class='${cls}'></i> ${value}`;
|
return `<i class='${cls}'></i> ${value}`;
|
||||||
@ -404,6 +405,15 @@ Ext.define('Proxmox.node.APTRepositories', {
|
|||||||
|
|
||||||
product: 'Proxmox VE', // default
|
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: {
|
controller: {
|
||||||
xclass: 'Ext.app.ViewController',
|
xclass: 'Ext.app.ViewController',
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user