From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-gui v2 2/3] refactor RestoreWindow for PBS
Date: Mon, 2 Nov 2020 19:45:37 +0100 [thread overview]
Message-ID: <20201102184538.17127-11-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20201102184538.17127-1-s.ivanov@proxmox.com>
by moving the item definition to initComponent, and changing the check
for a provided filename, we can reuse the window for restores from PBS
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
js/BackupRestore.js | 59 +++++++++++++++++++++++----------------------
1 file changed, 30 insertions(+), 29 deletions(-)
diff --git a/js/BackupRestore.js b/js/BackupRestore.js
index 6c97230..996f128 100644
--- a/js/BackupRestore.js
+++ b/js/BackupRestore.js
@@ -26,40 +26,41 @@ Ext.define('PMG.RestoreWindow', {
fieldDefaults: {
labelWidth: 150,
},
- items: [
- {
- xtype: 'proxmoxcheckbox',
- name: 'config',
- fieldLabel: gettext('System Configuration'),
- },
- {
- xtype: 'proxmoxcheckbox',
- name: 'database',
- value: 1,
- uncheckedValue: 0,
- fieldLabel: gettext('Rule Database'),
- listeners: {
- change: function(cb, value) {
- var me = this;
- me.up().down('field[name=statistic]').setDisabled(!value);
- },
- },
- },
- {
- xtype: 'proxmoxcheckbox',
- name: 'statistic',
- fieldLabel: gettext('Statistic'),
- },
- ],
initComponent: function() {
var me = this;
- if (!me.filename) {
- throw "no filename given";
- }
+ me.items = [
+ {
+ xtype: 'proxmoxcheckbox',
+ name: 'config',
+ fieldLabel: gettext('System Configuration'),
+ },
+ {
+ xtype: 'proxmoxcheckbox',
+ name: 'database',
+ value: 1,
+ uncheckedValue: 0,
+ fieldLabel: gettext('Rule Database'),
+ listeners: {
+ change: function(cb, value) {
+ me.up().down('field[name=statistic]').setDisabled(!value);
+ },
+ },
+ },
+ {
+ xtype: 'proxmoxcheckbox',
+ name: 'statistic',
+ fieldLabel: gettext('Statistic'),
+ },
+ ];
- me.url = "/nodes/" + Proxmox.NodeName + "/backup/" + encodeURIComponent(me.filename);
+ let initurl = "/nodes/" + Proxmox.NodeName;
+ if (me.filename) {
+ me.url = initurl + "/backup/" + encodeURIComponent(me.filename);
+ } else {
+ throw "neither filename nor snapshot given";
+ }
me.callParent();
},
--
2.20.1
next prev parent reply other threads:[~2020-11-02 18:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-02 18:45 [pmg-devel] [PATCH v2 pve-common/api/gui] add initial PBS integration Stoiko Ivanov
2020-11-02 18:45 ` [pmg-devel] [PATCH pve-common v2 1/1] add PBSClient module Stoiko Ivanov
2020-11-02 18:45 ` [pmg-devel] [PATCH pmg-api v2 1/7] debian: drop duplicate ', ' in dependencies Stoiko Ivanov
2020-11-02 18:45 ` [pmg-devel] [PATCH pmg-api v2 2/7] add initial SectionConfig for PBS Stoiko Ivanov
2020-11-02 18:45 ` [pmg-devel] [PATCH pmg-api v2 3/7] Add API2 module for PBS configuration Stoiko Ivanov
2020-11-02 18:45 ` [pmg-devel] [PATCH pmg-api v2 4/7] Add API2 module for per-node backups to PBS Stoiko Ivanov
2020-11-02 18:45 ` [pmg-devel] [PATCH pmg-api v2 5/7] pbs-integration: add CLI calls to pmgbackup Stoiko Ivanov
2020-11-02 18:45 ` [pmg-devel] [PATCH pmg-api v2 6/7] add scheduled backup to PBS remotes Stoiko Ivanov
2020-11-02 18:45 ` [pmg-devel] [PATCH pmg-api v2 7/7] add /etc/pmg/pbs to cluster-sync Stoiko Ivanov
2020-11-02 18:45 ` [pmg-devel] [PATCH pmg-gui v2 1/3] Make Backup/Restore panel a menuentry Stoiko Ivanov
2020-11-02 18:45 ` Stoiko Ivanov [this message]
2020-11-02 18:45 ` [pmg-devel] [PATCH pmg-gui v2 3/3] add PBSConfig tab to Backup menu 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=20201102184538.17127-11-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