all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] ui: fix order of prune keep reasons
@ 2021-08-30  8:30 Dominik Csapak
  2021-08-30 13:31 ` [pbs-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2021-08-30  8:30 UTC (permalink / raw)
  To: pbs-devel

two things wrong with the old code:
 * the sort function wants -1, 0 and 1 as a return value for a<b, a==b and a>b
   respectively, not a bool (which a < b returns)
 * we have to sort the newest backups first, since the first reason is
   'keep-last'. until now, we sorted the oldest backup first, resulting
   in the older backups getting the 'keep-last' reason

reported by a user in the forum:
https://forum.proxmox.com/threads/prune-ui-and-prune-schedule-simulator-dont-match.94944/

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/datastore/Prune.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/www/datastore/Prune.js b/www/datastore/Prune.js
index 3e74269f..42ea21bf 100644
--- a/www/datastore/Prune.js
+++ b/www/datastore/Prune.js
@@ -86,7 +86,7 @@ Ext.define('PBS.Datastore.PruneInputPanel', {
 		let counter = {};
 
 		backups.sort(function(a, b) {
-		    return a["backup-time"] < b["backup-time"];
+		    return b["backup-time"] - a["backup-time"];
 		});
 
 		let ruleIndex = -1;
-- 
2.30.2





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

* [pbs-devel] applied: Re: [PATCH proxmox-backup] ui: fix order of prune keep reasons
  2021-08-30  8:30 [pbs-devel] [PATCH proxmox-backup] ui: fix order of prune keep reasons Dominik Csapak
@ 2021-08-30 13:31 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2021-08-30 13:31 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

Am 8/30/21 um 10:30 AM schrieb Dominik Csapak:
> two things wrong with the old code:
>  * the sort function wants -1, 0 and 1 as a return value for a<b, a==b and a>b
>    respectively, not a bool (which a < b returns)
>  * we have to sort the newest backups first, since the first reason is
>    'keep-last'. until now, we sorted the oldest backup first, resulting
>    in the older backups getting the 'keep-last' reason
> 
> reported by a user in the forum:
> https://forum.proxmox.com/threads/prune-ui-and-prune-schedule-simulator-dont-match.94944/
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  www/datastore/Prune.js | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
>

I'd maybe went for an arrow function here, mostly to match the sorting in the prune-simulator,
but really does not matters mucht, if at all, so:

applied, thanks!




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

end of thread, other threads:[~2021-08-30 13:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-30  8:30 [pbs-devel] [PATCH proxmox-backup] ui: fix order of prune keep reasons Dominik Csapak
2021-08-30 13:31 ` [pbs-devel] applied: " Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal