public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pmg-devel] [PATCH v2 pmg-gui 1/2] dashboard: node info: use local subscription status only
@ 2021-07-23  7:20 Fabian Ebner
  2021-07-23  7:20 ` [pmg-devel] [PATCH v2 pmg-gui 2/2] dashboard: node status: use repo status widget from widget-toolkit Fabian Ebner
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Fabian Ebner @ 2021-07-23  7:20 UTC (permalink / raw)
  To: pmg-devel

instead of the cluster-wide status.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---

New in v2.

 js/Dashboard.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/js/Dashboard.js b/js/Dashboard.js
index 3d8bca3..3cf9cf0 100644
--- a/js/Dashboard.js
+++ b/js/Dashboard.js
@@ -119,6 +119,10 @@ Ext.define('PMG.Dashboard', {
 		    subStatus = 0;
 		}
 
+		if (item.data.name === Proxmox.NodeName) {
+		    me.lookup('nodeInfo').setSubscriptionStatus(!!item.data.level);
+		}
+
 		// resources count
 		cpu += item.data.cpu || 0;
 
@@ -140,8 +144,6 @@ Ext.define('PMG.Dashboard', {
 	    var subscriptionPanel = me.lookup('subscription');
 	    subscriptionPanel.setSubStatus(subStatus);
 
-	    me.lookup('nodeInfo').setSubscriptionStatus(subStatus);
-
 	    // the node info already displays this information in case there is no cluster
 	    me.lookup('clusterResources').setHidden(records.length === 1);
 
-- 
2.30.2





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pmg-devel] [PATCH v2 pmg-gui 2/2] dashboard: node status: use repo status widget from widget-toolkit
  2021-07-23  7:20 [pmg-devel] [PATCH v2 pmg-gui 1/2] dashboard: node info: use local subscription status only Fabian Ebner
@ 2021-07-23  7:20 ` Fabian Ebner
  2021-07-23  7:21   ` Fabian Ebner
  2021-07-28  8:31   ` [pmg-devel] applied: " Thomas Lamprecht
  2021-07-28  8:30 ` [pmg-devel] [PATCH v2 pmg-gui 1/2] dashboard: node info: use local subscription status only Thomas Lamprecht
  2021-07-28  8:30 ` [pmg-devel] applied: " Thomas Lamprecht
  2 siblings, 2 replies; 6+ messages in thread
From: Fabian Ebner @ 2021-07-23  7:20 UTC (permalink / raw)
  To: pmg-devel

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---

Changes from v1:
    * rebased on top of new patch

 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 = ` <a data-qtip="${gettext("Open Repositories Panel")}"
-		    href="#pmgServerAdministration:aptrepositories">
-		    <i class="fa black fa-chevron-right txt-shadow-hover"></i>
-		    </a>`;
-		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;
 
-- 
2.30.2





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [pmg-devel] [PATCH v2 pmg-gui 2/2] dashboard: node status: use repo status widget from widget-toolkit
  2021-07-23  7:20 ` [pmg-devel] [PATCH v2 pmg-gui 2/2] dashboard: node status: use repo status widget from widget-toolkit Fabian Ebner
@ 2021-07-23  7:21   ` Fabian Ebner
  2021-07-28  8:31   ` [pmg-devel] applied: " Thomas Lamprecht
  1 sibling, 0 replies; 6+ messages in thread
From: Fabian Ebner @ 2021-07-23  7:21 UTC (permalink / raw)
  To: pmg-devel

Am 23.07.21 um 09:20 schrieb Fabian Ebner:
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
> 
> 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 = ` <a data-qtip="${gettext("Open Repositories Panel")}"
> -		    href="#pmgServerAdministration:aptrepositories">
> -		    <i class="fa black fa-chevron-right txt-shadow-hover"></i>
> -		    </a>`;
> -		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;
>   
> 




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [pmg-devel] [PATCH v2 pmg-gui 1/2] dashboard: node info: use local subscription status only
  2021-07-23  7:20 [pmg-devel] [PATCH v2 pmg-gui 1/2] dashboard: node info: use local subscription status only Fabian Ebner
  2021-07-23  7:20 ` [pmg-devel] [PATCH v2 pmg-gui 2/2] dashboard: node status: use repo status widget from widget-toolkit Fabian Ebner
@ 2021-07-28  8:30 ` Thomas Lamprecht
  2021-07-28  8:30 ` [pmg-devel] applied: " Thomas Lamprecht
  2 siblings, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2021-07-28  8:30 UTC (permalink / raw)
  To: Fabian Ebner, pmg-devel

On 23.07.21 09:20, Fabian Ebner wrote:
> instead of the cluster-wide status.
> 
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
> 
> New in v2.
> 
>  js/Dashboard.js | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/js/Dashboard.js b/js/Dashboard.js
> index 3d8bca3..3cf9cf0 100644
> --- a/js/Dashboard.js
> +++ b/js/Dashboard.js
> @@ -119,6 +119,10 @@ Ext.define('PMG.Dashboard', {
>  		    subStatus = 0;
>  		}
>  
> +		if (item.data.name === Proxmox.NodeName) {
> +		    me.lookup('nodeInfo').setSubscriptionStatus(!!item.data.level);
> +		}
> +
>  		// resources count
>  		cpu += item.data.cpu || 0;
>  
> @@ -140,8 +144,6 @@ Ext.define('PMG.Dashboard', {
>  	    var subscriptionPanel = me.lookup('subscription');
>  	    subscriptionPanel.setSubStatus(subStatus);
>  
> -	    me.lookup('nodeInfo').setSubscriptionStatus(subStatus);
> -
>  	    // the node info already displays this information in case there is no cluster
>  	    me.lookup('clusterResources').setHidden(records.length === 1);
>  
> 





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pmg-devel] applied: [PATCH v2 pmg-gui 1/2] dashboard: node info: use local subscription status only
  2021-07-23  7:20 [pmg-devel] [PATCH v2 pmg-gui 1/2] dashboard: node info: use local subscription status only Fabian Ebner
  2021-07-23  7:20 ` [pmg-devel] [PATCH v2 pmg-gui 2/2] dashboard: node status: use repo status widget from widget-toolkit Fabian Ebner
  2021-07-28  8:30 ` [pmg-devel] [PATCH v2 pmg-gui 1/2] dashboard: node info: use local subscription status only Thomas Lamprecht
@ 2021-07-28  8:30 ` Thomas Lamprecht
  2 siblings, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2021-07-28  8:30 UTC (permalink / raw)
  To: Fabian Ebner, pmg-devel

On 23.07.21 09:20, Fabian Ebner wrote:
> instead of the cluster-wide status.
> 
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
> 
> New in v2.
> 
>  js/Dashboard.js | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pmg-devel] applied: [PATCH v2 pmg-gui 2/2] dashboard: node status: use repo status widget from widget-toolkit
  2021-07-23  7:20 ` [pmg-devel] [PATCH v2 pmg-gui 2/2] dashboard: node status: use repo status widget from widget-toolkit Fabian Ebner
  2021-07-23  7:21   ` Fabian Ebner
@ 2021-07-28  8:31   ` Thomas Lamprecht
  1 sibling, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2021-07-28  8:31 UTC (permalink / raw)
  To: Fabian Ebner, pmg-devel

On 23.07.21 09:20, Fabian Ebner wrote:
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
> 
> Changes from v1:
>     * rebased on top of new patch
> 
>  js/Dashboard.js          |  6 ++--
>  js/dashboard/NodeInfo.js | 72 ++--------------------------------------
>  2 files changed, 7 insertions(+), 71 deletions(-)
> 
>

applied, with d/control versioned-dependency bump for proxmox-widget-toolkit, thanks!




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-07-28  8:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-23  7:20 [pmg-devel] [PATCH v2 pmg-gui 1/2] dashboard: node info: use local subscription status only Fabian Ebner
2021-07-23  7:20 ` [pmg-devel] [PATCH v2 pmg-gui 2/2] dashboard: node status: use repo status widget from widget-toolkit Fabian Ebner
2021-07-23  7:21   ` Fabian Ebner
2021-07-28  8:31   ` [pmg-devel] applied: " Thomas Lamprecht
2021-07-28  8:30 ` [pmg-devel] [PATCH v2 pmg-gui 1/2] dashboard: node info: use local subscription status only Thomas Lamprecht
2021-07-28  8:30 ` [pmg-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal