From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com, pbs-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH proxmox-backup 1/1] ui: dashboard: show node's repository/subscription status
Date: Fri, 9 Jul 2021 14:44:16 +0200 [thread overview]
Message-ID: <20210709124416.129299-3-f.ebner@proxmox.com> (raw)
In-Reply-To: <20210709124416.129299-1-f.ebner@proxmox.com>
Mostly copied from PVE, slightly adapted to be consistent with other
things in the dashboard, e.g. use a store for the repository info.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
Dependency bump for widget-toolkit is needed.
Built on top of Dominik's patches to refactor/extend the node info in
the Dashboard [0] (still applied for me).
[0]: https://lists.proxmox.com/pipermail/pbs-devel/2021-April/002788.html
www/Dashboard.js | 22 ++++++++++++++
www/panel/NodeInfo.js | 68 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 90 insertions(+)
diff --git a/www/Dashboard.js b/www/Dashboard.js
index 18f174fe..70c2305b 100644
--- a/www/Dashboard.js
+++ b/www/Dashboard.js
@@ -59,6 +59,11 @@ Ext.define('PBS.Dashboard', {
}
},
+ updateRepositoryStatus: function(store, records, success) {
+ if (!success) { return; }
+ let me = this;
+ me.lookup('nodeInfo').setRepositoryInfo(records[0].data['standard-repos']);
+ },
updateSubscription: function(store, records, success) {
if (!success) { return; }
@@ -67,6 +72,7 @@ Ext.define('PBS.Dashboard', {
// 2 = all good, 1 = different leves, 0 = none
let subStatus = status.toLowerCase() === 'active' ? 2 : 0;
me.lookup('subscription').setSubStatus(subStatus);
+ me.lookup('nodeInfo').setSubscriptionStatus(subStatus);
},
updateTasks: function(store, records, success) {
@@ -131,6 +137,21 @@ Ext.define('PBS.Dashboard', {
},
stores: {
+ repositories: {
+ storeid: 'dash-repositories',
+ type: 'update',
+ interval: 15000,
+ autoStart: true,
+ autoLoad: true,
+ autoDestroy: true,
+ proxy: {
+ type: 'proxmox',
+ url: '/api2/json/nodes/localhost/apt/repositories',
+ },
+ listeners: {
+ load: 'updateRepositoryStatus',
+ },
+ },
subscription: {
storeid: 'dash-subscription',
type: 'update',
@@ -204,6 +225,7 @@ Ext.define('PBS.Dashboard', {
items: [
{
xtype: 'pbsNodeInfoPanel',
+ reference: 'nodeInfo',
height: 280,
},
{
diff --git a/www/panel/NodeInfo.js b/www/panel/NodeInfo.js
index 17bf3812..fbd5aad5 100644
--- a/www/panel/NodeInfo.js
+++ b/www/panel/NodeInfo.js
@@ -20,6 +20,37 @@ Ext.define('PBS.NodeInfoPanel', {
padding: '0 15 5 15',
},
+ viewModel: {
+ data: {
+ subscriptionActive: '',
+ noSubscriptionRepo: '',
+ enterpriseRepo: '',
+ testRepo: '',
+ },
+ formulas: {
+ repoStatus: function(get) {
+ if (get('subscriptionActive') === '' || get('enterpriseRepo') === '') {
+ return '';
+ }
+
+ if (get('noSubscriptionRepo') || get('testRepo')) {
+ return 'non-production';
+ } else if (get('subscriptionActive') && get('enterpriseRepo')) {
+ return 'ok';
+ } else if (!get('subscriptionActive') && get('enterpriseRepo')) {
+ return 'no-sub';
+ } else if (!get('enterpriseRepo') || !get('noSubscriptionRepo') || !get('testRepo')) {
+ return 'no-repo';
+ }
+ return 'unknown';
+ },
+ repoStatusMessage: function(get) {
+ const status = get('repoStatus');
+ return Proxmox.Utils.formatNodeRepoStatus(status, 'Proxmox Backup Server');
+ },
+ },
+ },
+
controller: {
xclass: 'Ext.app.ViewController',
@@ -147,6 +178,18 @@ Ext.define('PBS.NodeInfoPanel', {
textField: 'kversion',
value: '',
},
+ {
+ itemId: 'repositoryStatus',
+ colspan: 2,
+ printBar: false,
+ title: gettext('Repository Status'),
+ setValue: function(value) { // for binding below
+ this.updateValue(value);
+ },
+ bind: {
+ value: '{repoStatusMessage}',
+ },
+ },
],
updateTitle: function() {
@@ -155,6 +198,31 @@ Ext.define('PBS.NodeInfoPanel', {
me.setTitle(Proxmox.NodeName + ' (' + gettext('Uptime') + ': ' + uptime + ')');
},
+ setRepositoryInfo: function(standardRepos) {
+ let me = this;
+ let vm = me.getViewModel();
+
+ for (const standardRepo of standardRepos) {
+ const handle = standardRepo.handle;
+ const status = standardRepo.status;
+
+ if (handle === "enterprise") {
+ vm.set('enterpriseRepo', status);
+ } else if (handle === "no-subscription") {
+ vm.set('noSubscriptionRepo', status);
+ } else if (handle === "test") {
+ vm.set('testRepo', status);
+ }
+ }
+ },
+
+ setSubscriptionStatus: function(status) {
+ let me = this;
+ let vm = me.getViewModel();
+
+ vm.set('subscriptionActive', status);
+ },
+
initComponent: function() {
let me = this;
--
2.30.2
WARNING: multiple messages have this Message-ID
From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com, pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 1/1] ui: dashboard: show node's repository/subscription status
Date: Fri, 9 Jul 2021 14:44:16 +0200 [thread overview]
Message-ID: <20210709124416.129299-3-f.ebner@proxmox.com> (raw)
In-Reply-To: <20210709124416.129299-1-f.ebner@proxmox.com>
Mostly copied from PVE, slightly adapted to be consistent with other
things in the dashboard, e.g. use a store for the repository info.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
Dependency bump for widget-toolkit is needed.
Built on top of Dominik's patches to refactor/extend the node info in
the Dashboard [0] (still applied for me).
[0]: https://lists.proxmox.com/pipermail/pbs-devel/2021-April/002788.html
www/Dashboard.js | 22 ++++++++++++++
www/panel/NodeInfo.js | 68 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 90 insertions(+)
diff --git a/www/Dashboard.js b/www/Dashboard.js
index 18f174fe..70c2305b 100644
--- a/www/Dashboard.js
+++ b/www/Dashboard.js
@@ -59,6 +59,11 @@ Ext.define('PBS.Dashboard', {
}
},
+ updateRepositoryStatus: function(store, records, success) {
+ if (!success) { return; }
+ let me = this;
+ me.lookup('nodeInfo').setRepositoryInfo(records[0].data['standard-repos']);
+ },
updateSubscription: function(store, records, success) {
if (!success) { return; }
@@ -67,6 +72,7 @@ Ext.define('PBS.Dashboard', {
// 2 = all good, 1 = different leves, 0 = none
let subStatus = status.toLowerCase() === 'active' ? 2 : 0;
me.lookup('subscription').setSubStatus(subStatus);
+ me.lookup('nodeInfo').setSubscriptionStatus(subStatus);
},
updateTasks: function(store, records, success) {
@@ -131,6 +137,21 @@ Ext.define('PBS.Dashboard', {
},
stores: {
+ repositories: {
+ storeid: 'dash-repositories',
+ type: 'update',
+ interval: 15000,
+ autoStart: true,
+ autoLoad: true,
+ autoDestroy: true,
+ proxy: {
+ type: 'proxmox',
+ url: '/api2/json/nodes/localhost/apt/repositories',
+ },
+ listeners: {
+ load: 'updateRepositoryStatus',
+ },
+ },
subscription: {
storeid: 'dash-subscription',
type: 'update',
@@ -204,6 +225,7 @@ Ext.define('PBS.Dashboard', {
items: [
{
xtype: 'pbsNodeInfoPanel',
+ reference: 'nodeInfo',
height: 280,
},
{
diff --git a/www/panel/NodeInfo.js b/www/panel/NodeInfo.js
index 17bf3812..fbd5aad5 100644
--- a/www/panel/NodeInfo.js
+++ b/www/panel/NodeInfo.js
@@ -20,6 +20,37 @@ Ext.define('PBS.NodeInfoPanel', {
padding: '0 15 5 15',
},
+ viewModel: {
+ data: {
+ subscriptionActive: '',
+ noSubscriptionRepo: '',
+ enterpriseRepo: '',
+ testRepo: '',
+ },
+ formulas: {
+ repoStatus: function(get) {
+ if (get('subscriptionActive') === '' || get('enterpriseRepo') === '') {
+ return '';
+ }
+
+ if (get('noSubscriptionRepo') || get('testRepo')) {
+ return 'non-production';
+ } else if (get('subscriptionActive') && get('enterpriseRepo')) {
+ return 'ok';
+ } else if (!get('subscriptionActive') && get('enterpriseRepo')) {
+ return 'no-sub';
+ } else if (!get('enterpriseRepo') || !get('noSubscriptionRepo') || !get('testRepo')) {
+ return 'no-repo';
+ }
+ return 'unknown';
+ },
+ repoStatusMessage: function(get) {
+ const status = get('repoStatus');
+ return Proxmox.Utils.formatNodeRepoStatus(status, 'Proxmox Backup Server');
+ },
+ },
+ },
+
controller: {
xclass: 'Ext.app.ViewController',
@@ -147,6 +178,18 @@ Ext.define('PBS.NodeInfoPanel', {
textField: 'kversion',
value: '',
},
+ {
+ itemId: 'repositoryStatus',
+ colspan: 2,
+ printBar: false,
+ title: gettext('Repository Status'),
+ setValue: function(value) { // for binding below
+ this.updateValue(value);
+ },
+ bind: {
+ value: '{repoStatusMessage}',
+ },
+ },
],
updateTitle: function() {
@@ -155,6 +198,31 @@ Ext.define('PBS.NodeInfoPanel', {
me.setTitle(Proxmox.NodeName + ' (' + gettext('Uptime') + ': ' + uptime + ')');
},
+ setRepositoryInfo: function(standardRepos) {
+ let me = this;
+ let vm = me.getViewModel();
+
+ for (const standardRepo of standardRepos) {
+ const handle = standardRepo.handle;
+ const status = standardRepo.status;
+
+ if (handle === "enterprise") {
+ vm.set('enterpriseRepo', status);
+ } else if (handle === "no-subscription") {
+ vm.set('noSubscriptionRepo', status);
+ } else if (handle === "test") {
+ vm.set('testRepo', status);
+ }
+ }
+ },
+
+ setSubscriptionStatus: function(status) {
+ let me = this;
+ let vm = me.getViewModel();
+
+ vm.set('subscriptionActive', status);
+ },
+
initComponent: function() {
let me = this;
--
2.30.2
next prev parent reply other threads:[~2021-07-09 12:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-09 12:44 [pve-devel] [PATCH proxmox-widget-toolkit 1/1] utils: add helper to format node's repository status Fabian Ebner
2021-07-09 12:44 ` [pbs-devel] " Fabian Ebner
2021-07-09 12:44 ` [pve-devel] [PATCH pve-manager 1/1] ui: node status: use helper for formatting " Fabian Ebner
2021-07-09 12:44 ` [pbs-devel] " Fabian Ebner
2021-07-09 12:44 ` Fabian Ebner [this message]
2021-07-09 12:44 ` [pbs-devel] [PATCH proxmox-backup 1/1] ui: dashboard: show node's repository/subscription status Fabian Ebner
2021-07-12 5:19 ` [pve-devel] applied: " Thomas Lamprecht
2021-07-12 5:19 ` [pbs-devel] applied: " 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=20210709124416.129299-3-f.ebner@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=pbs-devel@lists.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal