* [pbs-devel] [PATCH proxmox-backup 1/2] ui: prune: show which rule keeps backup
@ 2020-11-09 14:53 Fabian Ebner
2020-11-09 14:53 ` [pbs-devel] [RFC proxmox-backup 2/2] ui: prune: show count for rule Fabian Ebner
2020-11-10 8:24 ` [pbs-devel] applied: [PATCH proxmox-backup 1/2] ui: prune: show which rule keeps backup Thomas Lamprecht
0 siblings, 2 replies; 4+ messages in thread
From: Fabian Ebner @ 2020-11-09 14:53 UTC (permalink / raw)
To: pbs-devel
and adjust layout so the description fits.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
www/datastore/Prune.js | 51 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/www/datastore/Prune.js b/www/datastore/Prune.js
index 7475aa9e..531204f1 100644
--- a/www/datastore/Prune.js
+++ b/www/datastore/Prune.js
@@ -44,6 +44,46 @@ Ext.define('PBS.DataStorePruneInputPanel', {
reload: function() {
var view = this.getView();
+ // helper to allow showing why a backup is kept
+ let addKeepReasons = function(backups, params) {
+ const rules = [
+ 'keep-last',
+ 'keep-hourly',
+ 'keep-daily',
+ 'keep-weekly',
+ 'keep-monthly',
+ 'keep-yearly',
+ 'keep-all', // when all keep options are not set
+ ];
+ let counter = {};
+
+ backups.sort(function(a, b) {
+ return a["backup-time"] < b["backup-time"];
+ });
+
+ let ruleIndex = -1;
+ let nextRule = function() {
+ let rule;
+ do {
+ ruleIndex++;
+ rule = rules[ruleIndex];
+ } while (!params[rule] && rule !== 'keep-all');
+ counter[rule] = 0;
+ return rule;
+ };
+
+ let rule = nextRule();
+ for (let backup of backups) {
+ if (backup.keep) {
+ counter[rule]++;
+ backup.keepReason = rule;
+ if (rule !== 'keep-all' && counter[rule] >= params[rule]) {
+ rule = nextRule();
+ }
+ }
+ }
+ };
+
let params = view.getValues();
params["dry-run"] = true;
@@ -59,6 +99,7 @@ Ext.define('PBS.DataStorePruneInputPanel', {
},
success: function(response, options) {
var data = response.result.data;
+ addKeepReasons(data, params);
view.prune_store.setData(data);
},
});
@@ -146,6 +187,14 @@ Ext.define('PBS.DataStorePruneInputPanel', {
{
text: "keep",
dataIndex: 'keep',
+ renderer: function(value, metaData, record) {
+ if (record.data.keep) {
+ return 'true (' + record.data.keepReason + ')';
+ } else {
+ return 'false';
+ }
+ },
+ flex: 1,
},
],
},
@@ -163,6 +212,8 @@ Ext.define('PBS.DataStorePrune', {
isCreate: true,
+ fieldDefaults: { labelWidth: 120 },
+
initComponent: function() {
var me = this;
--
2.20.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pbs-devel] [RFC proxmox-backup 2/2] ui: prune: show count for rule
2020-11-09 14:53 [pbs-devel] [PATCH proxmox-backup 1/2] ui: prune: show which rule keeps backup Fabian Ebner
@ 2020-11-09 14:53 ` Fabian Ebner
2020-11-10 8:25 ` [pbs-devel] applied: " Thomas Lamprecht
2020-11-10 8:24 ` [pbs-devel] applied: [PATCH proxmox-backup 1/2] ui: prune: show which rule keeps backup Thomas Lamprecht
1 sibling, 1 reply; 4+ messages in thread
From: Fabian Ebner @ 2020-11-09 14:53 UTC (permalink / raw)
To: pbs-devel
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
www/datastore/Prune.js | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/www/datastore/Prune.js b/www/datastore/Prune.js
index 531204f1..5ff2c459 100644
--- a/www/datastore/Prune.js
+++ b/www/datastore/Prune.js
@@ -76,9 +76,13 @@ Ext.define('PBS.DataStorePruneInputPanel', {
for (let backup of backups) {
if (backup.keep) {
counter[rule]++;
- backup.keepReason = rule;
- if (rule !== 'keep-all' && counter[rule] >= params[rule]) {
- rule = nextRule();
+ if (rule !== 'keep-all') {
+ backup.keepReason = rule + ': ' + counter[rule];
+ if (counter[rule] >= params[rule]) {
+ rule = nextRule();
+ }
+ } else {
+ backup.keepReason = rule;
}
}
}
@@ -212,7 +216,7 @@ Ext.define('PBS.DataStorePrune', {
isCreate: true,
- fieldDefaults: { labelWidth: 120 },
+ fieldDefaults: { labelWidth: 130 },
initComponent: function() {
var me = this;
--
2.20.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pbs-devel] applied: [PATCH proxmox-backup 1/2] ui: prune: show which rule keeps backup
2020-11-09 14:53 [pbs-devel] [PATCH proxmox-backup 1/2] ui: prune: show which rule keeps backup Fabian Ebner
2020-11-09 14:53 ` [pbs-devel] [RFC proxmox-backup 2/2] ui: prune: show count for rule Fabian Ebner
@ 2020-11-10 8:24 ` Thomas Lamprecht
1 sibling, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2020-11-10 8:24 UTC (permalink / raw)
To: Proxmox Backup Server development discussion, Fabian Ebner
On 09.11.20 15:53, Fabian Ebner wrote:
> and adjust layout so the description fits.
>
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
> www/datastore/Prune.js | 51 ++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 51 insertions(+)
>
>
applied, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pbs-devel] applied: [RFC proxmox-backup 2/2] ui: prune: show count for rule
2020-11-09 14:53 ` [pbs-devel] [RFC proxmox-backup 2/2] ui: prune: show count for rule Fabian Ebner
@ 2020-11-10 8:25 ` Thomas Lamprecht
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2020-11-10 8:25 UTC (permalink / raw)
To: Proxmox Backup Server development discussion, Fabian Ebner
On 09.11.20 15:53, Fabian Ebner wrote:
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
> www/datastore/Prune.js | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
>
applied, thanks! Maybe add it to the prune sim to, for consistency?
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-11-10 8:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-09 14:53 [pbs-devel] [PATCH proxmox-backup 1/2] ui: prune: show which rule keeps backup Fabian Ebner
2020-11-09 14:53 ` [pbs-devel] [RFC proxmox-backup 2/2] ui: prune: show count for rule Fabian Ebner
2020-11-10 8:25 ` [pbs-devel] applied: " Thomas Lamprecht
2020-11-10 8:24 ` [pbs-devel] applied: [PATCH proxmox-backup 1/2] ui: prune: show which rule keeps backup 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