ui: datastore/Content: add 'Prune All' button

since the api call always starts a real worker, we cannot have a
preview. It would also be very hard to show that for all groups in a
non-confusing way. We reuse the pbsPruneInputPanel and add the dry-run
field there conditionally.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2021-07-16 10:53:27 +02:00 committed by Dietmar Maurer
parent 9805207aa5
commit afbf2e10f3
2 changed files with 49 additions and 0 deletions

View File

@ -340,6 +340,35 @@ Ext.define('PBS.DataStoreContent', {
});
},
pruneAll: function() {
let me = this;
let view = me.getView();
if (!view.datastore) return;
Ext.create('Proxmox.window.Edit', {
title: `Prune Datastore '${view.datastore}'`,
onlineHelp: 'maintenance_pruning',
method: 'POST',
submitText: "Prune",
autoShow: true,
isCreate: true,
showTaskViewer: true,
taskDone: () => me.reload(),
url: `/api2/extjs/admin/datastore/${view.datastore}/prune-datastore`,
items: [
{
xtype: 'pbsPruneInputPanel',
dryrun: true,
},
],
});
},
onVerify: function(view, rI, cI, item, e, rec) {
let me = this;
view = me.getView();
@ -865,6 +894,11 @@ Ext.define('PBS.DataStoreContent', {
confirmMsg: gettext('Do you want to verify all snapshots now?'),
handler: 'verifyAll',
},
{
xtype: 'proxmoxButton',
text: gettext('Prune All'),
handler: 'pruneAll',
},
'->',
{
xtype: 'tbtext',

View File

@ -6,6 +6,9 @@ Ext.define('PBS.panel.PruneInputPanel', {
onlineHelp: 'maintenance_pruning',
// show/hide dry-run field
dryrun: false,
cbindData: function() {
let me = this;
me.isCreate = !!me.isCreate;
@ -65,6 +68,18 @@ Ext.define('PBS.panel.PruneInputPanel', {
},
],
columnB: [
{
xtype: 'proxmoxcheckbox',
name: 'dry-run',
fieldLabel: gettext('Dry Run'),
cbind: {
hidden: '{!dryrun}',
disabled: '{!dryrun}',
},
},
],
});
Ext.define('PBS.DataStoreEdit', {
extend: 'Proxmox.window.Edit',