public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] ui: warn of missing gc-schedule, prune/verify jobs
@ 2023-11-30 14:01 Christian Ebner
  2023-12-04 15:42 ` Gabriel Goller
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Ebner @ 2023-11-30 14:01 UTC (permalink / raw)
  To: pbs-devel

Warn about a missing garbage collection schedule, prune job or verify
jobs configuration in summary panel of a datastore.

Show the number of prune/verify job configurations, if there are jobs
configured.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
 www/datastore/Summary.js | 80 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)

diff --git a/www/datastore/Summary.js b/www/datastore/Summary.js
index a932b4e0..6a63ca14 100644
--- a/www/datastore/Summary.js
+++ b/www/datastore/Summary.js
@@ -49,12 +49,19 @@ Ext.define('PBS.DataStoreInfo', {
 	    usage: {},
 	    stillbad: 0,
 	    mountpoint: "",
+	    gcScheduldeMsg: gettext('unknown'),
+	    pruneJobMsg: gettext('unknown'),
+	    verifyJobMsg: gettext('unknown'),
 	},
     },
 
     controller: {
 	xclass: 'Ext.app.ViewController',
 
+	fmtWarning: function(msg) {
+	    return `<i class="fa fa-fw fa-lg fa-exclamation-circle warning"></i> ${msg}`;
+	},
+
 	onLoad: function(store, data, success) {
 	    let me = this;
 	    if (!success) {
@@ -101,6 +108,51 @@ Ext.define('PBS.DataStoreInfo', {
 	    vm.set('ctcount', countstext(counts.ct));
 	    vm.set('vmcount', countstext(counts.vm));
 	    vm.set('hostcount', countstext(counts.host));
+
+	    Proxmox.Utils.API2Request({
+		url: `/config/datastore/${me.view.datastore}`,
+		success: function(response) {
+		    if (response.result.data['gc-schedule']) {
+			vm.set('gcScheduleMsg', gettext('configured'));
+		    } else {
+			vm.set('gcScheduleMsg', me.fmtWarning(gettext('none configured')));
+		    }
+		},
+		failure: function() {
+		    vm.set('gcScheduleMsg', me.fmtWarning(gettext('unknown')));
+		}
+	    });
+
+	    Proxmox.Utils.API2Request({
+		url: `/admin/prune?store=${me.view.datastore}`,
+		success: function(response) {
+		    let len = response.result.data.length;
+		    if (len > 0) {
+			vm.set('pruneJobMsg', Ext.String.format(gettext('{0} configured'), len));
+		    } else {
+			vm.set('pruneJobMsg', me.fmtWarning(gettext('none configured')));
+		    }
+		},
+		failure: function() {
+		    vm.set('pruneJobMsg', me.fmtWarning(gettext('unknown')));
+		}
+	    });
+
+	    Proxmox.Utils.API2Request({
+		url: `/admin/verify?store=${me.view.datastore}`,
+		success: function(response) {
+		    console.log(response);
+		    let len = response.result.data.length;
+		    if (len > 0) {
+			vm.set('verifyJobMsg', Ext.String.format(gettext('{0} configured'), len));
+		    } else {
+			vm.set('verifyJobMsg', me.fmtWarning(gettext('none configured')));
+		    }
+		},
+		failure: function() {
+		    vm.set('verifyJobMsg', me.fmtWarning(gettext('unknown')));
+		}
+	    });
 	},
 
 	startStore: function() { this.store.startUpdate(); },
@@ -201,6 +253,34 @@ Ext.define('PBS.DataStoreInfo', {
 		visible: '{stillbad}',
 	    },
 	},
+	{
+	    title: gettext('Garbage Collection Schedule'),
+	    printBar: false,
+	    bind: {
+		data: {
+		    text: '{gcScheduleMsg}',
+		},
+	    },
+	    padding: '10 0 0 0',
+	},
+	{
+	    title: gettext('Prune Jobs'),
+	    printBar: false,
+	    bind: {
+		data: {
+		    text: '{pruneJobMsg}',
+		},
+	    },
+	},
+	{
+	    title: gettext('Verify Jobs'),
+	    printBar: false,
+	    bind: {
+		data: {
+		    text: '{verifyJobMsg}',
+		},
+	    },
+	},
     ],
 });
 
-- 
2.39.2





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

* Re: [pbs-devel] [PATCH proxmox-backup] ui: warn of missing gc-schedule, prune/verify jobs
  2023-11-30 14:01 [pbs-devel] [PATCH proxmox-backup] ui: warn of missing gc-schedule, prune/verify jobs Christian Ebner
@ 2023-12-04 15:42 ` Gabriel Goller
  2023-12-04 16:09   ` Christian Ebner
  0 siblings, 1 reply; 4+ messages in thread
From: Gabriel Goller @ 2023-12-04 15:42 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Christian Ebner

Comments inline.

On 11/30/23 15:01, Christian Ebner wrote:
> Warn about a missing garbage collection schedule, prune job or verify
> jobs configuration in summary panel of a datastore.
>
> Show the number of prune/verify job configurations, if there are jobs
> configured.
>
> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
> ---
>   www/datastore/Summary.js | 80 ++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 80 insertions(+)
>
> diff --git a/www/datastore/Summary.js b/www/datastore/Summary.js
> index a932b4e0..6a63ca14 100644
> --- a/www/datastore/Summary.js
> +++ b/www/datastore/Summary.js
> @@ -49,12 +49,19 @@ Ext.define('PBS.DataStoreInfo', {
>   	    usage: {},
>   	    stillbad: 0,
>   	    mountpoint: "",
> +	    gcScheduldeMsg: gettext('unknown'),
Small typo here... This should say `gcScheduleMsg`.
> +	    pruneJobMsg: gettext('unknown'),
> +	    verifyJobMsg: gettext('unknown'),
>   	},
>       },
>   
>       controller: {
>   	xclass: 'Ext.app.ViewController',
>   
> +	fmtWarning: function(msg) {
> +	    return `<i class="fa fa-fw fa-lg fa-exclamation-circle warning"></i> ${msg}`;
> +	},
> +
>   	onLoad: function(store, data, success) {
>   	    let me = this;
>   	    if (!success) {
> @@ -101,6 +108,51 @@ Ext.define('PBS.DataStoreInfo', {
>   	    vm.set('ctcount', countstext(counts.ct));
>   	    vm.set('vmcount', countstext(counts.vm));
>   	    vm.set('hostcount', countstext(counts.host));
> +
> +	    Proxmox.Utils.API2Request({
> +		url: `/config/datastore/${me.view.datastore}`,
> +		success: function(response) {
> +		    if (response.result.data['gc-schedule']) {
> +			vm.set('gcScheduleMsg', gettext('configured'));
How about we put a green checkmark here (and on the other lines below)? 
Otherwise this wall of text looks kinda bleak :(
We could add the `fa fa-check-circle` icon with the `good` (color: 
green) class?


There are also a few linting issues:

3 issues marked with (*) could be auto-fixed using '--fix'.
[./datastore/Summary.js]:
WARN: line 123 col 4: comma-dangle - Missing trailing comma. (*)
WARN: line 138 col 4: comma-dangle - Missing trailing comma. (*)
WARN: line 153 col 4: comma-dangle - Missing trailing comma. (*)





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

* Re: [pbs-devel] [PATCH proxmox-backup] ui: warn of missing gc-schedule, prune/verify jobs
  2023-12-04 15:42 ` Gabriel Goller
@ 2023-12-04 16:09   ` Christian Ebner
  2023-12-05 10:22     ` Christian Ebner
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Ebner @ 2023-12-04 16:09 UTC (permalink / raw)
  To: Gabriel Goller, Proxmox Backup Server development discussion

> On 04.12.2023 16:42 CET Gabriel Goller <g.goller@proxmox.com> wrote:
> 
> Small typo here... This should say `gcScheduleMsg`.

Ah yes, thanks for noticing, will be fixed in a new version.

> How about we put a green checkmark here (and on the other lines below)? 
> Otherwise this wall of text looks kinda bleak :(
> We could add the `fa fa-check-circle` icon with the `good` (color: 
> green) class?

Hmm, not to sure about that one, I deliberately did not emphasize the
message in case there are jobs configured, keeping the output rather
neutral. But I am open for opinions on this one.

However, I will include the question mark icon in case of the unknown
job config state. The main focus should be on possibly missing job
configurations, configured jobs might still have issues and need to be
checked in the tasks logs.

> 
> 
> There are also a few linting issues:
> 
> 3 issues marked with (*) could be auto-fixed using '--fix'.
> [./datastore/Summary.js]:
> WARN: line 123 col 4: comma-dangle - Missing trailing comma. (*)
> WARN: line 138 col 4: comma-dangle - Missing trailing comma. (*)
> WARN: line 153 col 4: comma-dangle - Missing trailing comma. (*)

Yes, missed those as well, will be fixed in a new version.

Thank you for your comments!




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

* Re: [pbs-devel] [PATCH proxmox-backup] ui: warn of missing gc-schedule, prune/verify jobs
  2023-12-04 16:09   ` Christian Ebner
@ 2023-12-05 10:22     ` Christian Ebner
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Ebner @ 2023-12-05 10:22 UTC (permalink / raw)
  To: Gabriel Goller, Proxmox Backup Server development discussion

> On 04.12.2023 17:09 CET Christian Ebner <c.ebner@proxmox.com> wrote:
> 
> 
> Thank you for your comments!

Version 2 of the patch including changes based on the feedback is available [0].

[0] https://lists.proxmox.com/pipermail/pbs-devel/2023-December/007432.html




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

end of thread, other threads:[~2023-12-05 10:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-30 14:01 [pbs-devel] [PATCH proxmox-backup] ui: warn of missing gc-schedule, prune/verify jobs Christian Ebner
2023-12-04 15:42 ` Gabriel Goller
2023-12-04 16:09   ` Christian Ebner
2023-12-05 10:22     ` Christian Ebner

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