all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 1/1] ui: dashboard: node status: use repo status widget from widget-toolkit
Date: Thu, 22 Jul 2021 15:27:35 +0200	[thread overview]
Message-ID: <20210722132735.2260448-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20210722132735.2260448-1-f.ebner@proxmox.com>

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 www/Dashboard.js      |  7 +++--
 www/panel/NodeInfo.js | 68 ++-----------------------------------------
 2 files changed, 8 insertions(+), 67 deletions(-)

diff --git a/www/Dashboard.js b/www/Dashboard.js
index 70c2305b..7d3244fd 100644
--- a/www/Dashboard.js
+++ b/www/Dashboard.js
@@ -62,7 +62,8 @@ Ext.define('PBS.Dashboard', {
 	updateRepositoryStatus: function(store, records, success) {
 	    if (!success) { return; }
 	    let me = this;
-	    me.lookup('nodeInfo').setRepositoryInfo(records[0].data['standard-repos']);
+	    let repoStatus = me.lookup('nodeInfo').down('#repositoryStatus');
+	    repoStatus.setRepositoryInfo(records[0].data['standard-repos']);
 	},
 
 	updateSubscription: function(store, records, success) {
@@ -72,7 +73,9 @@ 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);
+
+	    let repoStatus = me.lookup('nodeInfo').down('#repositoryStatus');
+	    repoStatus.setSubscriptionStatus(subStatus);
 	},
 
 	updateTasks: function(store, records, success) {
diff --git a/www/panel/NodeInfo.js b/www/panel/NodeInfo.js
index ff96e8fc..f41eb3a3 100644
--- a/www/panel/NodeInfo.js
+++ b/www/panel/NodeInfo.js
@@ -20,37 +20,6 @@ Ext.define('PBS.NodeInfoPanel', {
 	padding: '0 10 5 10',
     },
 
-    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',
 
@@ -179,16 +148,10 @@ Ext.define('PBS.NodeInfoPanel', {
 	    value: '',
 	},
 	{
+	    xtype: 'pmxNodeInfoRepoStatus',
 	    itemId: 'repositoryStatus',
-	    colspan: 2,
-	    printBar: false,
-	    title: gettext('Repository Status'),
-	    setValue: function(value) { // for binding below
-		this.updateValue(value);
-	    },
-	    bind: {
-		value: '{repoStatusMessage}',
-	    },
+	    product: 'Proxmox Backup Server',
+	    repoLink: '#pbsServerAdministration:aptrepositories',
 	},
     ],
 
@@ -198,31 +161,6 @@ 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





  reply	other threads:[~2021-07-22 13:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22 13:27 [pbs-devel] [PATCH proxmox-widget-toolkit 1/1] add NodeInfoRepoStatus Fabian Ebner
2021-07-22 13:27 ` Fabian Ebner [this message]
2021-11-30  9:21   ` [pbs-devel] [PATCH proxmox-backup 1/1] ui: dashboard: node status: use repo status widget from widget-toolkit Fabian Ebner
2021-07-27 14:36 ` [pbs-devel] applied: [PATCH proxmox-widget-toolkit 1/1] add NodeInfoRepoStatus 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=20210722132735.2260448-2-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pbs-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