[pbs-devel] [PATCH proxmox-backup 2/2] prune-simulator: allow setting a time on which prune happens

Matthias Heiserer m.heiserer at proxmox.com
Wed Sep 14 12:50:39 CEST 2022


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 at 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






More information about the pbs-devel mailing list