public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Matthias Heiserer <m.heiserer@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 2/2] prune-simulator: allow setting a time on which prune happens
Date: Wed, 14 Sep 2022 12:50:39 +0200	[thread overview]
Message-ID: <20220914105039.186907-2-m.heiserer@proxmox.com> (raw)
In-Reply-To: <20220914105039.186907-1-m.heiserer@proxmox.com>

In addition to the previous patch, this allows setting the time (hours/minutes)
on which the pruning is simulated.

Signed-off-by: Matthias Heiserer <m.heiserer@proxmox.com>
---
 .../prune-simulator/prune-simulator_source.js | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/docs/prune-simulator/prune-simulator_source.js b/docs/prune-simulator/prune-simulator_source.js
index 137cf1b3..6ddbec0a 100644
--- a/docs/prune-simulator/prune-simulator_source.js
+++ b/docs/prune-simulator/prune-simulator_source.js
@@ -330,7 +330,10 @@ Ext.onReady(function() {
 
 		let params = view.getValues();
 
+		const time = view.lookup("currentTime").getValue();
 		NOW.setTime(Date.parse(params.currentDate));
+		NOW.setHours(time.getHours());
+		NOW.setMinutes(time.getMinutes());
 
 		let [hourSpec, minuteSpec] = params['schedule-time'].split(':');
 
@@ -458,9 +461,10 @@ Ext.onReady(function() {
 		    let weekday = parseInt(Ext.Date.format(daysDate, 'w'), 10);
 		    if (weekdayFlags[weekday]) {
 			timesOnSingleDay.forEach(function(time) {
-			    backups.push({
-				backuptime: Ext.Date.subtract(new Date(time), Ext.Date.DAY, i),
-			    });
+			    const backuptime = Ext.Date.subtract(new Date(time), Ext.Date.DAY, i);
+			    if (backuptime < NOW) {
+				backups.push({ backuptime: backuptime });
+			    }
 			});
 		    }
 		}
@@ -726,6 +730,15 @@ Ext.onReady(function() {
 					    padding: '0 0 0 10',
 					    value: new Date(),
 					},
+					{
+					    xtype: 'timefield',
+					    name: 'currentTime',
+					    reference: 'currentTime',
+					    fieldLabel: 'Time of prune',
+					    allowBlank: false,
+					    padding: '0 0 0 10',
+					    value: new Date(),
+					},
 				    ],
 				},
 			    ],
-- 
2.30.2





  reply	other threads:[~2022-09-14 10:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14 10:50 [pbs-devel] [PATCH proxmox-backup 1/2] prune-simulator: allow setting a date " Matthias Heiserer
2022-09-14 10:50 ` Matthias Heiserer [this message]
2022-09-16 10:08   ` [pbs-devel] [PATCH proxmox-backup 2/2] prune-simulator: allow setting a time " Fiona Ebner
2022-09-19 10:24     ` Matthias Heiserer
2022-09-16 10:08 ` [pbs-devel] [PATCH proxmox-backup 1/2] prune-simulator: allow setting a date " Fiona Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220914105039.186907-2-m.heiserer@proxmox.com \
    --to=m.heiserer@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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