public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup v2] fix #5422: ui: garbage-collection: make columns sortable
@ 2024-05-16  9:18 Gabriel Goller
  2024-05-21  9:25 ` Max Carrara
  2024-05-21  9:42 ` [pbs-devel] applied: " Thomas Lamprecht
  0 siblings, 2 replies; 3+ messages in thread
From: Gabriel Goller @ 2024-05-16  9:18 UTC (permalink / raw)
  To: pbs-devel; +Cc: Thomas Lamprecht

Make columns sortable in the global 'Prune & GC Jobs' view. In the
per-datastore view the columns will not be sortable as there can only be
one job.

Fixes: db3fd213 ("fix #3217: ui: global prune and gc job view")

Co-authored-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 www/config/GCView.js | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/www/config/GCView.js b/www/config/GCView.js
index bcea72a5..7733c265 100644
--- a/www/config/GCView.js
+++ b/www/config/GCView.js
@@ -155,7 +155,6 @@ Ext.define('PBS.config.GCJobView', {
 	    header: gettext('Datastore'),
 	    dataIndex: 'store',
 	    renderer: Ext.String.htmlEncode,
-	    sortable: true,
 	    hideable: false,
 	    minWidth: 120,
 	    maxWidth: 300,
@@ -164,7 +163,6 @@ Ext.define('PBS.config.GCJobView', {
 	{
 	    header: gettext('Schedule'),
 	    dataIndex: 'schedule',
-	    sortable: false,
 	    hideable: false,
 	    renderer: (value) => value ? value : Proxmox.Utils.NoneText,
 	    minWidth: 85,
@@ -174,7 +172,6 @@ Ext.define('PBS.config.GCJobView', {
 	    header: gettext('Last GC'),
 	    dataIndex: 'last-run-endtime',
 	    renderer: PBS.Utils.render_optional_timestamp,
-	    sortable: true,
 	    minWidth: 150,
 	    flex: 1,
 	},
@@ -182,7 +179,6 @@ Ext.define('PBS.config.GCJobView', {
 	    text: gettext('Duration'),
 	    dataIndex: 'duration',
 	    renderer: Proxmox.Utils.render_duration,
-	    sortable: false,
 	    minWidth: 80,
 	    flex: 1,
 	},
@@ -190,7 +186,6 @@ Ext.define('PBS.config.GCJobView', {
 	    header: gettext('Last Status'),
 	    dataIndex: 'last-run-state',
 	    renderer: PBS.Utils.render_task_status,
-	    sortable: true,
 	    minWidth: 80,
 	    flex: 1,
 	},
@@ -198,7 +193,6 @@ Ext.define('PBS.config.GCJobView', {
 	    header: gettext('Next Run'),
 	    dataIndex: 'next-run',
 	    renderer: PBS.Utils.render_next_task_run,
-	    sortable: true,
 	    minWidth: 150,
 	    flex: 1,
 	},
@@ -207,7 +201,6 @@ Ext.define('PBS.config.GCJobView', {
 	    dataIndex: 'removed-bytes',
 	    renderer: (value, meta, record) => record.data.upid !== null
 		? Proxmox.Utils.format_size(value, true) : "-",
-	    sortable: false,
 	    minWidth: 85,
 	    flex: 1,
 	},
@@ -216,7 +209,6 @@ Ext.define('PBS.config.GCJobView', {
 	    dataIndex: 'pending-bytes',
 	    renderer: (value, meta, record) => record.data.upid !== null
 		? Proxmox.Utils.format_size(value, true) : "-",
-	    sortable: false,
 	    minWidth: 80,
 	    flex: 3,
 	},
@@ -224,12 +216,12 @@ Ext.define('PBS.config.GCJobView', {
 
     initComponent: function() {
 	let me = this;
-	let hideLocalDatastore = !!me.datastore;
+	let isSingleDatastore = !!me.datastore;
 
 	for (let column of me.columns) {
+	    column.sortable = !isSingleDatastore;
 	    if (column.dataIndex === 'store') {
-		column.hidden = hideLocalDatastore;
-		break;
+		column.hidden = isSingleDatastore;
 	    }
 	}
 
-- 
2.43.0



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


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

* Re: [pbs-devel] [PATCH proxmox-backup v2] fix #5422: ui: garbage-collection: make columns sortable
  2024-05-16  9:18 [pbs-devel] [PATCH proxmox-backup v2] fix #5422: ui: garbage-collection: make columns sortable Gabriel Goller
@ 2024-05-21  9:25 ` Max Carrara
  2024-05-21  9:42 ` [pbs-devel] applied: " Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Max Carrara @ 2024-05-21  9:25 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion; +Cc: Thomas Lamprecht

On Thu May 16, 2024 at 11:18 AM CEST, Gabriel Goller wrote:
> Make columns sortable in the global 'Prune & GC Jobs' view. In the
> per-datastore view the columns will not be sortable as there can only be
> one job.
>
> Fixes: db3fd213 ("fix #3217: ui: global prune and gc job view")
>
> Co-authored-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>

Tested this again; didn't think that the columns would also be sortable
in the per-datastore view. Good catch @Thomas!

Now does what it says on the box. LGTM.

Tested-by: Max Carrara <m.carrara@proxmox.com>

> ---
>  www/config/GCView.js | 14 +++-----------
>  1 file changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/www/config/GCView.js b/www/config/GCView.js
> index bcea72a5..7733c265 100644
> --- a/www/config/GCView.js
> +++ b/www/config/GCView.js
> @@ -155,7 +155,6 @@ Ext.define('PBS.config.GCJobView', {
>  	    header: gettext('Datastore'),
>  	    dataIndex: 'store',
>  	    renderer: Ext.String.htmlEncode,
> -	    sortable: true,
>  	    hideable: false,
>  	    minWidth: 120,
>  	    maxWidth: 300,
> @@ -164,7 +163,6 @@ Ext.define('PBS.config.GCJobView', {
>  	{
>  	    header: gettext('Schedule'),
>  	    dataIndex: 'schedule',
> -	    sortable: false,
>  	    hideable: false,
>  	    renderer: (value) => value ? value : Proxmox.Utils.NoneText,
>  	    minWidth: 85,
> @@ -174,7 +172,6 @@ Ext.define('PBS.config.GCJobView', {
>  	    header: gettext('Last GC'),
>  	    dataIndex: 'last-run-endtime',
>  	    renderer: PBS.Utils.render_optional_timestamp,
> -	    sortable: true,
>  	    minWidth: 150,
>  	    flex: 1,
>  	},
> @@ -182,7 +179,6 @@ Ext.define('PBS.config.GCJobView', {
>  	    text: gettext('Duration'),
>  	    dataIndex: 'duration',
>  	    renderer: Proxmox.Utils.render_duration,
> -	    sortable: false,
>  	    minWidth: 80,
>  	    flex: 1,
>  	},
> @@ -190,7 +186,6 @@ Ext.define('PBS.config.GCJobView', {
>  	    header: gettext('Last Status'),
>  	    dataIndex: 'last-run-state',
>  	    renderer: PBS.Utils.render_task_status,
> -	    sortable: true,
>  	    minWidth: 80,
>  	    flex: 1,
>  	},
> @@ -198,7 +193,6 @@ Ext.define('PBS.config.GCJobView', {
>  	    header: gettext('Next Run'),
>  	    dataIndex: 'next-run',
>  	    renderer: PBS.Utils.render_next_task_run,
> -	    sortable: true,
>  	    minWidth: 150,
>  	    flex: 1,
>  	},
> @@ -207,7 +201,6 @@ Ext.define('PBS.config.GCJobView', {
>  	    dataIndex: 'removed-bytes',
>  	    renderer: (value, meta, record) => record.data.upid !== null
>  		? Proxmox.Utils.format_size(value, true) : "-",
> -	    sortable: false,
>  	    minWidth: 85,
>  	    flex: 1,
>  	},
> @@ -216,7 +209,6 @@ Ext.define('PBS.config.GCJobView', {
>  	    dataIndex: 'pending-bytes',
>  	    renderer: (value, meta, record) => record.data.upid !== null
>  		? Proxmox.Utils.format_size(value, true) : "-",
> -	    sortable: false,
>  	    minWidth: 80,
>  	    flex: 3,
>  	},
> @@ -224,12 +216,12 @@ Ext.define('PBS.config.GCJobView', {
>  
>      initComponent: function() {
>  	let me = this;
> -	let hideLocalDatastore = !!me.datastore;
> +	let isSingleDatastore = !!me.datastore;
>  
>  	for (let column of me.columns) {
> +	    column.sortable = !isSingleDatastore;
>  	    if (column.dataIndex === 'store') {
> -		column.hidden = hideLocalDatastore;
> -		break;
> +		column.hidden = isSingleDatastore;
>  	    }
>  	}
>  



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


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

* [pbs-devel] applied: [PATCH proxmox-backup v2] fix #5422: ui: garbage-collection: make columns sortable
  2024-05-16  9:18 [pbs-devel] [PATCH proxmox-backup v2] fix #5422: ui: garbage-collection: make columns sortable Gabriel Goller
  2024-05-21  9:25 ` Max Carrara
@ 2024-05-21  9:42 ` Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2024-05-21  9:42 UTC (permalink / raw)
  To: Gabriel Goller, pbs-devel

Am 16/05/2024 um 11:18 schrieb Gabriel Goller:
> Make columns sortable in the global 'Prune & GC Jobs' view. In the
> per-datastore view the columns will not be sortable as there can only be
> one job.
> 
> Fixes: db3fd213 ("fix #3217: ui: global prune and gc job view")
> 
> Co-authored-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
>  www/config/GCView.js | 14 +++-----------
>  1 file changed, 3 insertions(+), 11 deletions(-)
> 
>

applied, with Max's T-b, thanks!

FYI: I pushed out a tangentially related follow-up to use a different
`stateId` for the different view types. This avoids that a saved state from the
global view, with sorting enabled, would also sort the same column in the
per-datastore view when the state got restored, for details see:

https://git.proxmox.com/?p=proxmox-backup.git;a=commitdiff;h=3c23c4c2503d3caac0ee1a480c89548cc404e683


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


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

end of thread, other threads:[~2024-05-21  9:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-16  9:18 [pbs-devel] [PATCH proxmox-backup v2] fix #5422: ui: garbage-collection: make columns sortable Gabriel Goller
2024-05-21  9:25 ` Max Carrara
2024-05-21  9:42 ` [pbs-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