From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id D7ACE68B0E for ; Thu, 22 Jul 2021 15:27:41 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id CA44F11A8A for ; Thu, 22 Jul 2021 15:27:41 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id EC3FD11A7A for ; Thu, 22 Jul 2021 15:27:40 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 9F65140C06 for ; Thu, 22 Jul 2021 15:27:40 +0200 (CEST) From: Fabian Ebner To: pbs-devel@lists.proxmox.com Date: Thu, 22 Jul 2021 15:27:35 +0200 Message-Id: <20210722132735.2260448-2-f.ebner@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210722132735.2260448-1-f.ebner@proxmox.com> References: <20210722132735.2260448-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.487 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox-backup 1/1] ui: dashboard: node status: use repo status widget from widget-toolkit X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jul 2021 13:27:41 -0000 Signed-off-by: Fabian Ebner --- 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