public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-gui 2/4] backup: fix #3154: make statistic backup optional
Date: Wed, 24 Feb 2021 19:31:04 +0100	[thread overview]
Message-ID: <20210224183109.29014-8-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20210224183109.29014-1-s.ivanov@proxmox.com>

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   | 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





  parent reply	other threads:[~2021-02-24 18:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24 18:30 [pmg-devel] [PATCH pmg-api/gui/docs] small improvments for PBS integration Stoiko Ivanov
2021-02-24 18:30 ` [pmg-devel] [PATCH pmg-api 1/5] backup: fix die invocation Stoiko Ivanov
2021-02-25  9:40   ` [pmg-devel] applied: " Thomas Lamprecht
2021-02-24 18:30 ` [pmg-devel] [PATCH pmg-api 2/5] backup: fix #3154 add 'include-statistics' to pbs Stoiko Ivanov
2021-02-25  9:40   ` [pmg-devel] applied: " Thomas Lamprecht
2021-02-24 18:31 ` [pmg-devel] [PATCH pmg-api 3/5] backup: fix #3146 add email notifications Stoiko Ivanov
2021-02-25 10:04   ` Thomas Lamprecht
2021-02-24 18:31 ` [pmg-devel] [PATCH pmg-api 4/5] backup: add notify parameter to 'classic' backup Stoiko Ivanov
2021-02-25 10:06   ` Thomas Lamprecht
2021-02-24 18:31 ` [pmg-devel] [PATCH pmg-api 5/5] backup: pbs: prevent race in concurrent backups Stoiko Ivanov
2021-02-25 10:14   ` Thomas Lamprecht
2021-02-24 18:31 ` [pmg-devel] [PATCH pmg-gui 1/4] backup: pbs: add onlineHelp anchors Stoiko Ivanov
2021-02-24 18:31 ` Stoiko Ivanov [this message]
2021-02-24 18:31 ` [pmg-devel] [PATCH pmg-gui 3/4] backup: pbs: fix #3154: add statistic setting to remote Stoiko Ivanov
2021-02-24 18:31 ` [pmg-devel] [PATCH pmg-gui 4/4] backup: pbs: fix #3146 add notify " Stoiko Ivanov
2021-02-24 18:31 ` [pmg-devel] [PATCH pmg-docs 1/3] backup: fix typos Stoiko Ivanov
2021-02-25 10:15   ` [pmg-devel] applied: " Thomas Lamprecht
2021-02-24 18:31 ` [pmg-devel] [PATCH pmg-docs 2/3] backup: add anchors to pbs sections Stoiko Ivanov
2021-02-25 10:15   ` [pmg-devel] applied: " Thomas Lamprecht
2021-02-24 18:31 ` [pmg-devel] [PATCH pmg-docs 3/3] backup: shortly document #3146 and #3154 Stoiko Ivanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210224183109.29014-8-s.ivanov@proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal