[pmg-devel] [PATCH pmg-gui v2 2/4] backup: fix #3154: make statistic backup optional
Stoiko Ivanov
s.ivanov at proxmox.com
Mon Mar 1 15:12:22 CET 2021
by creating an edit-window when clicking on the respective Backup now
button.
This is the second part of the enhancement request
Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
js/BackupRestore.js | 45 ++++++++++++++++++++++++++++---------------
js/PBSSnapshotView.js | 19 +++---------------
2 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/js/BackupRestore.js b/js/BackupRestore.js
index 3cfabd8..21a979f 100644
--- a/js/BackupRestore.js
+++ b/js/BackupRestore.js
@@ -69,6 +69,32 @@ Ext.define('PMG.RestoreWindow', {
},
});
+Ext.define('PMG.BackupWindow', {
+ extend: 'Proxmox.window.Edit',
+ xtype: 'pmgBackupWindow',
+ onlineHelp: 'chapter_pmgbackup',
+
+ showProgress: true,
+ title: gettext('Backup'),
+ isCreate: true,
+ method: 'POST',
+ submitText: gettext('Backup'),
+ fieldDefaults: {
+ labelWidth: 150,
+ },
+ showTaskViewer: true,
+ items: [
+ {
+ xtype: 'proxmoxcheckbox',
+ name: 'statistic',
+ value: 1,
+ uncheckedValue: 0,
+ fieldLabel: gettext('Include Statistics'),
+ },
+ ],
+
+});
+
Ext.define('PMG.BackupRestore', {
extend: 'Ext.grid.GridPanel',
xtype: 'pmgBackupRestore',
@@ -80,23 +106,10 @@ Ext.define('PMG.BackupRestore', {
createBackup: function() {
let view = this.getView();
- Proxmox.Utils.API2Request({
+ Ext.create('PMG.BackupWindow', {
url: "/nodes/" + Proxmox.NodeName + "/backup",
- method: 'POST',
- waitMsgTarget: view,
- failure: function(response, opts) {
- Ext.Msg.alert(gettext('Error'), response.htmlStatus);
- },
- success: function(response, opts) {
- let upid = response.result.data;
-
- let win = Ext.create('Proxmox.window.TaskViewer', {
- upid: upid,
- autoShow: true,
- });
- view.mon(win, 'close', () => view.store.load());
- },
- });
+ taskDone: () => view.store.load(),
+ }).show();
},
onRestore: function() {
diff --git a/js/PBSSnapshotView.js b/js/PBSSnapshotView.js
index 841bff8..c182bfb 100644
--- a/js/PBSSnapshotView.js
+++ b/js/PBSSnapshotView.js
@@ -25,23 +25,10 @@ Ext.define('PMG.PBSConfig', {
let me = this;
let view = me.lookup('snapshotsGrid');
let remote = me.getViewModel().get('remote');
- Proxmox.Utils.API2Request({
+ Ext.create('PMG.BackupWindow', {
url: `/nodes/${Proxmox.NodeName}/pbs/${remote}/snapshot`,
- method: 'POST',
- waitMsgTarget: view,
- failure: function(response, opts) {
- Ext.Msg.alert(gettext('Error'), response.htmlStatus);
- },
- success: function(response, opts) {
- let upid = response.result.data;
-
- let win = Ext.create('Proxmox.window.TaskViewer', {
- upid: upid,
- });
- win.show();
- me.mon(win, 'close', function() { view.getStore().load(); });
- },
- });
+ taskDone: () => view.getStore().load(),
+ }).show();
},
reload: function(grid) {
--
2.20.1
More information about the pmg-devel
mailing list