From 834bae5575d931d322504da1c481a542a95f0cfc Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Mon, 28 Nov 2022 15:43:59 +0100 Subject: [PATCH] ui: datastore: allow to destroy all underlying data on removal Signed-off-by: Thomas Lamprecht --- www/datastore/OptionView.js | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/www/datastore/OptionView.js b/www/datastore/OptionView.js index d4783b80..1c764e1e 100644 --- a/www/datastore/OptionView.js +++ b/www/datastore/OptionView.js @@ -7,10 +7,20 @@ Ext.define('PBS.window.SafeDatastoreDestroy', { url: `/config/datastore/{datastore}`, item: get => ({ id: get('datastore') }), }, + viewModel: { + data: { + 'destroyData': 0, + }, + formulas: { + destroyNote: get => get('destroyData') + ? gettext('All backup snapshots and their data will be permanently destroyed!') + : gettext('Configuration change only, no data will be deleted.'), + destroyNoteCls: get => get('destroyData') ? 'pmx-hint' : '', + }, + }, autoShow: true, taskName: 'delete-datastore', - note: gettext('Configuration change only, no data will be deleted.'), apiCallDone: function(success) { if (success) { @@ -20,6 +30,29 @@ Ext.define('PBS.window.SafeDatastoreDestroy', { mainview.getController().redirectTo('pbsDataStores'); } }, + + getParams: function() { + let viewModel = this.getViewModel(); + + let params = { 'destroy-data': viewModel.get('destroyData') }; + return `?${Ext.Object.toQueryString(params)}`; + }, + additionalItems: [{ + xtype: 'proxmoxcheckbox', + name: 'destroy-data', + boxLabel: gettext("Destroy all data (dangerous!)"), + defaultValue: false, + bind: { + value: '{destroyData}', + }, + }, { + xtype: 'component', + reference: 'noteCmp', + bind: { + html: '{destroyNote}', + userCls: '{destroyNoteCls}', + }, + }], }); Ext.define('PBS.Datastore.Options', {