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 05E4768DF6 for ; Fri, 23 Jul 2021 09:21:51 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0322A194DE for ; Fri, 23 Jul 2021 09:21:51 +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 257D8194CE for ; Fri, 23 Jul 2021 09:21:50 +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 EFC22425CF for ; Fri, 23 Jul 2021 09:21:49 +0200 (CEST) To: pmg-devel@lists.proxmox.com References: <20210723072033.1007848-1-f.ebner@proxmox.com> <20210723072033.1007848-2-f.ebner@proxmox.com> From: Fabian Ebner Message-ID: <5cf0994f-018d-4a19-8bda-b5ebc21e62a5@proxmox.com> Date: Fri, 23 Jul 2021 09:21:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20210723072033.1007848-2-f.ebner@proxmox.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL 2.233 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 NICE_REPLY_A -3.514 Looks like a legit reply (A) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com, data.name] Subject: Re: [pmg-devel] [PATCH v2 pmg-gui 2/2] dashboard: node status: use repo status widget from widget-toolkit X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jul 2021 07:21:51 -0000 Am 23.07.21 um 09:20 schrieb Fabian Ebner: > Signed-off-by: Fabian Ebner > --- > > Changes from v1: > * rebased on top of new patch > Depends on https://lists.proxmox.com/pipermail/pbs-devel/2021-July/003764.html and needs a dependency bump for it. > js/Dashboard.js | 6 ++-- > js/dashboard/NodeInfo.js | 72 ++-------------------------------------- > 2 files changed, 7 insertions(+), 71 deletions(-) > > diff --git a/js/Dashboard.js b/js/Dashboard.js > index 3cf9cf0..b1ca8dd 100644 > --- a/js/Dashboard.js > +++ b/js/Dashboard.js > @@ -120,7 +120,8 @@ Ext.define('PMG.Dashboard', { > } > > if (item.data.name === Proxmox.NodeName) { > - me.lookup('nodeInfo').setSubscriptionStatus(!!item.data.level); > + let repoStatus = me.lookup('nodeInfo').down('#repositoryStatus'); > + repoStatus.setSubscriptionStatus(!!item.data.level); > } > > // resources count > @@ -176,7 +177,8 @@ Ext.define('PMG.Dashboard', { > } > > 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']); > }, > > init: function(view) { > diff --git a/js/dashboard/NodeInfo.js b/js/dashboard/NodeInfo.js > index bdf8f85..7952d03 100644 > --- a/js/dashboard/NodeInfo.js > +++ b/js/dashboard/NodeInfo.js > @@ -17,41 +17,6 @@ Ext.define('PMG.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'); > - let repoLink = ` - href="#pmgServerAdministration:aptrepositories"> > - > - `; > - return Proxmox.Utils.formatNodeRepoStatus(status, 'Proxmox Mail Gateway') + repoLink; > - }, > - }, > - }, > - > items: [ > { > itemId: 'nodecpu', > @@ -127,16 +92,10 @@ Ext.define('PMG.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 Mail Gateway', > + repoLink: '#pmgServerAdministration:aptrepositories', > }, > ], > > @@ -146,31 +105,6 @@ Ext.define('PMG.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 || 0; > - > - 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; > >