From bc4af01559adbb6e4b68cbec58aa4e813023da3a Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Wed, 11 May 2022 14:28:33 +0200 Subject: [PATCH] ui: datastore content: make verify-all more flexible allow to specify the namespace, max_depth and also the re-verify/skip behavior. Signed-off-by: Thomas Lamprecht --- www/Makefile | 1 + www/datastore/Content.js | 31 ++++----------- www/window/VerifyAll.js | 86 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+), 24 deletions(-) create mode 100644 www/window/VerifyAll.js diff --git a/www/Makefile b/www/Makefile index f1b3bd1e..e9cfaf62 100644 --- a/www/Makefile +++ b/www/Makefile @@ -76,6 +76,7 @@ JSSRC= \ window/Settings.js \ window/TokenEdit.js \ window/VerifyJobEdit.js \ + window/VerifyAll.js \ window/ZFSCreate.js \ dashboard/DataStoreStatistics.js \ dashboard/LongestTasks.js \ diff --git a/www/datastore/Content.js b/www/datastore/Content.js index b470a0e7..8c1f4fc6 100644 --- a/www/datastore/Content.js +++ b/www/datastore/Content.js @@ -361,26 +361,14 @@ Ext.define('PBS.DataStoreContent', { }, verifyAll: function() { - var view = this.getView(); + let me = this; + let view = me.getView(); - let params = {}; - if (view.namespace && view.namespace !== '') { - params['backup-ns'] = view.namespace; // TODO backend?! - } - - Proxmox.Utils.API2Request({ - url: `/admin/datastore/${view.datastore}/verify`, - params, - method: 'POST', - failure: function(response) { - Ext.Msg.alert(gettext('Error'), response.htmlStatus); - }, - success: function(response, options) { - Ext.create('Proxmox.window.TaskViewer', { - autoShow: true, - upid: response.result.data, - }); - }, + Ext.create('PBS.window.VerifyAll', { + taskDone: () => me.reload(), + autoShow: true, + datastore: view.datastore, + namespace: view.namespace, }); }, @@ -393,17 +381,13 @@ Ext.define('PBS.DataStoreContent', { 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', @@ -1089,7 +1073,6 @@ Ext.define('PBS.DataStoreContent', { { xtype: 'proxmoxButton', text: gettext('Verify All'), - confirmMsg: gettext('Do you want to verify all snapshots now?'), handler: 'verifyAll', }, { diff --git a/www/window/VerifyAll.js b/www/window/VerifyAll.js new file mode 100644 index 00000000..1a8d2834 --- /dev/null +++ b/www/window/VerifyAll.js @@ -0,0 +1,86 @@ +Ext.define('PBS.window.VerifyAll', { + extend: 'Proxmox.window.Edit', + alias: 'widget.pbsVerifyAll', + mixins: ['Proxmox.Mixin.CBind'], + + onlineHelp: 'maintenance_verification', + + method: 'POST', + cbind: { + title: `Verify Datastore '{datastore}'`, + url: `/admin/datastore/{datastore}/verify`, + }, + + submitText: gettext('Verify'), + isCreate: true, + showTaskViewer: true, + showReset: false, + defaultFocus: 'submitbutton', + width: 450, + items: [ + { + xtype: 'inputpanel', + viewModel: { + data: { ignoreVerified: true }, + }, + onGetValues: values => { + if (!values['backup-ns'] || values['backup-ns'] === '') { + delete values['backup-ns']; + } + return values; + }, + items: [ + { + xtype: 'pbsNamespaceSelector', + name: 'backup-ns', + fieldLabel: gettext('Namespace'), + cbind: { + datastore: '{datastore}', + value: '{namespace}', + }, + }, + { + xtype: 'pbsNamespaceMaxDepth', + name: 'max-depth', + deleteEmpty: false, + }, + { + xtype: 'fieldcontainer', + layout: 'hbox', + fieldLabel: gettext('Skip Verified'), + items: [ + { + xtype: 'proxmoxcheckbox', + name: 'ignore-verified', + uncheckedValue: false, + value: true, + bind: { + value: '{ignoreVerified}', + }, + }, + { + xtype: 'pbsVerifyOutdatedAfter', + name: 'outdated-after', + fieldLabel: gettext('Re-Verify After'), + padding: '0 0 0 5', + bind: { + disabled: '{!ignoreVerified}', + }, + flex: 1, + }, + { + xtype: 'displayfield', + name: 'unit', + submitValue: false, + padding: '0 0 0 5', + value: gettext('days'), + bind: { + disabled: '{!ignoreVerified}', + }, + }, + ], + }, + ], + }, + ], +});