From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH widget-toolkit 3/5] apt repositories: add classifyOrigin helper
Date: Mon, 5 Jun 2023 17:43:11 +0200 [thread overview]
Message-ID: <20230605154313.181289-5-f.ebner@proxmox.com> (raw)
In-Reply-To: <20230605154313.181289-1-f.ebner@proxmox.com>
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>
---
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
next prev parent reply other threads:[~2023-06-05 15:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 15:43 [pve-devel] [PATCH-SERIES proxmox-apt/widget-toolkit] prepare for major upgrade Fiona Ebner
2023-06-05 15:43 ` [pve-devel] [PATCH stable proxmox-apt 1/1] repositories: also detect repository with next suite as configured Fiona Ebner
2023-06-09 8:45 ` Wolfgang Bumiller
2023-06-09 8:49 ` Fiona Ebner
2023-06-09 9:59 ` [pve-devel] applied: " Wolfgang Bumiller
2023-06-05 15:43 ` [pve-devel] [PATCH widget-toolkit 1/5] apt repositories: actually ignore ignore-pre-upgrade-warning Fiona Ebner
2023-06-05 15:43 ` [pve-devel] [PATCH/RFC widget-toolkit 2/5] apt repositories: just ignore unknown info rather than throwing an error Fiona Ebner
2023-06-05 17:06 ` Thomas Lamprecht
2023-06-06 6:27 ` Fiona Ebner
2023-06-05 15:43 ` Fiona Ebner [this message]
2023-06-05 15:43 ` [pve-devel] [PATCH widget-toolkit 4/5] apt repositories: detect mixed suites before major upgrade Fiona Ebner
2023-06-05 15:43 ` [pve-devel] [PATCH stable-bullseye widget-toolkit 5/5] apt repositoires: allow " Fiona Ebner
2023-06-07 15:23 ` [pve-devel] applied-series: [PATCH-SERIES proxmox-apt/widget-toolkit] prepare for " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230605154313.181289-5-f.ebner@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox