]> git.proxmox.com Git - pmg-gui.git/commitdiff
backup: fix #3154: make statistic backup optional
authorStoiko Ivanov <s.ivanov@proxmox.com>
Mon, 1 Mar 2021 14:12:22 +0000 (15:12 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 5 Mar 2021 21:48:36 +0000 (22:48 +0100)
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@proxmox.com>
js/BackupRestore.js
js/PBSSnapshotView.js

index 3cfabd8bdddc6cc7181b4b4af0490f88a7148427..21a979f390ebe2230f7574fc574b9adb9aa2ca17 100644 (file)
@@ -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() {
index 841bff82d3caa13a3e6386ca811514145d945894..c182bfb52b6a999404bab07d72d96a8607a02335 100644 (file)
@@ -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) {