From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 09/14] create and use backup view
Date: Wed, 2 Sep 2020 13:03:32 +0200 [thread overview]
Message-ID: <20200902110337.25004-10-f.ebner@proxmox.com> (raw)
In-Reply-To: <20200902110337.25004-1-f.ebner@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/storage/BackupView.js | 77 +++++++++++++++++++++++++++++
www/manager6/storage/Browser.js | 3 +-
www/manager6/storage/ContentView.js | 45 -----------------
4 files changed, 79 insertions(+), 47 deletions(-)
create mode 100644 www/manager6/storage/BackupView.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index cece0aae..26c91bef 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -217,6 +217,7 @@ JSSRC= \
sdn/zones/SimpleEdit.js \
sdn/zones/VlanEdit.js \
sdn/zones/VxlanEdit.js \
+ storage/BackupView.js \
storage/Base.js \
storage/Browser.js \
storage/CIFSEdit.js \
diff --git a/www/manager6/storage/BackupView.js b/www/manager6/storage/BackupView.js
new file mode 100644
index 00000000..ea195e43
--- /dev/null
+++ b/www/manager6/storage/BackupView.js
@@ -0,0 +1,77 @@
+Ext.define('PVE.storage.BackupView', {
+ extend: 'PVE.storage.ContentView',
+
+ alias: 'widget.pveStorageBackupView',
+
+ initComponent: function() {
+ var me = this;
+
+ var nodename = me.nodename = me.pveSelNode.data.node;
+ if (!nodename) {
+ throw "no node name specified";
+ }
+
+ var storage = me.storage = me.pveSelNode.data.storage;
+ if (!storage) {
+ throw "no storage ID specified";
+ }
+
+ me.content = 'backup';
+
+ var sm = me.sm = Ext.create('Ext.selection.RowModel', {});
+
+ var reload = function() {
+ me.store.load();
+ };
+
+ me.tbar = [
+ {
+ xtype: 'proxmoxButton',
+ text: gettext('Restore'),
+ selModel: sm,
+ disabled: true,
+ enableFn: function(rec) {
+ return rec && rec.data.content === 'backup';
+ },
+ handler: function(b, e, rec) {
+ var vmtype;
+ if (PVE.Utils.volume_is_qemu_backup(rec.data.volid, rec.data.format)) {
+ vmtype = 'qemu';
+ } else if (PVE.Utils.volume_is_lxc_backup(rec.data.volid, rec.data.format)) {
+ vmtype = 'lxc';
+ } else {
+ return;
+ }
+
+ var win = Ext.create('PVE.window.Restore', {
+ nodename: nodename,
+ volid: rec.data.volid,
+ volidText: PVE.Utils.render_storage_content(rec.data.volid, {}, rec),
+ vmtype: vmtype
+ });
+ win.show();
+ win.on('destroy', reload);
+ }
+ },
+ {
+ xtype: 'proxmoxButton',
+ text: gettext('Show Configuration'),
+ disabled: true,
+ selModel: sm,
+ enableFn: function(rec) {
+ return rec && rec.data.content === 'backup';
+ },
+ handler: function(b,e,rec) {
+ var win = Ext.create('PVE.window.BackupConfig', {
+ volume: rec.data.volid,
+ pveSelNode: me.pveSelNode
+ });
+
+ win.show();
+ }
+ },
+ ];
+
+ me.callParent();
+ },
+});
diff --git a/www/manager6/storage/Browser.js b/www/manager6/storage/Browser.js
index 4393558c..4536392c 100644
--- a/www/manager6/storage/Browser.js
+++ b/www/manager6/storage/Browser.js
@@ -51,11 +51,10 @@ Ext.define('PVE.storage.Browser', {
if (contents.includes('backup')) {
items.push({
- xtype: 'pveStorageContentView',
+ xtype: 'pveStorageBackupView',
title: PVE.Utils.contentTypes['backup'],
iconCls: 'fa fa-th',
itemId: 'contentBackup',
- content: 'backup',
});
}
if (contents.includes('images')) {
diff --git a/www/manager6/storage/ContentView.js b/www/manager6/storage/ContentView.js
index 03b595f8..c78ac398 100644
--- a/www/manager6/storage/ContentView.js
+++ b/www/manager6/storage/ContentView.js
@@ -327,53 +327,8 @@ Ext.define('PVE.storage.ContentView', {
me.tbar.push(uploadButton);
}
me.tbar.push(
- {
- xtype: 'proxmoxButton',
- text: gettext('Restore'),
- selModel: sm,
- disabled: true,
- enableFn: function(rec) {
- return rec && rec.data.content === 'backup';
- },
- handler: function(b, e, rec) {
- var vmtype;
- if (PVE.Utils.volume_is_qemu_backup(rec.data.volid, rec.data.format)) {
- vmtype = 'qemu';
- } else if (PVE.Utils.volume_is_lxc_backup(rec.data.volid, rec.data.format)) {
- vmtype = 'lxc';
- } else {
- return;
- }
-
- var win = Ext.create('PVE.window.Restore', {
- nodename: nodename,
- volid: rec.data.volid,
- volidText: PVE.Utils.render_storage_content(rec.data.volid, {}, rec),
- vmtype: vmtype
- });
- win.show();
- win.on('destroy', reload);
- }
- },
removeButton,
imageRemoveButton,
- {
- xtype: 'proxmoxButton',
- text: gettext('Show Configuration'),
- disabled: true,
- selModel: sm,
- enableFn: function(rec) {
- return rec && rec.data.content === 'backup';
- },
- handler: function(b,e,rec) {
- var win = Ext.create('PVE.window.BackupConfig', {
- volume: rec.data.volid,
- pveSelNode: me.pveSelNode
- });
-
- win.show();
- }
- },
'->',
gettext('Search') + ':', ' ',
{
--
2.20.1
next prev parent reply other threads:[~2020-09-02 11:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-02 11:03 [pve-devel] [PATCH-SERIES/RFC manager 00/14] split up content view into a view for each type Fabian Ebner
2020-09-02 11:03 ` [pve-devel] [PATCH manager 01/14] config panel: allow new nodes to be added later Fabian Ebner
2020-09-02 11:03 ` [pve-devel] [PATCH manager 02/14] storage panel/browser: use insertNodes function Fabian Ebner
2020-09-02 11:03 ` [pve-devel] [PATCH manager 03/14] use separate view for each content type Fabian Ebner
2020-09-02 11:03 ` [pve-devel] [PATCH manager 04/14] remove the now unneccessary grouping Fabian Ebner
2020-09-02 11:03 ` [pve-devel] [PATCH manager 05/14] content view: allow specifying title bar elements for init Fabian Ebner
2020-09-02 11:03 ` [pve-devel] [PATCH manager 06/14] turn nodename, storage, sm into object variables Fabian Ebner
2020-09-02 11:03 ` [pve-devel] [PATCH manager 07/14] add upload button conditionally Fabian Ebner
2020-09-02 11:03 ` [pve-devel] [PATCH manager 08/14] create and use template view Fabian Ebner
2020-09-02 11:03 ` Fabian Ebner [this message]
2020-09-02 11:03 ` [pve-devel] [PATCH manager 10/14] get rid of unneccessary enableFns Fabian Ebner
2020-09-02 11:03 ` [pve-devel] [PATCH manager 11/14] create ImageView and use it for VM and CT images Fabian Ebner
2020-09-02 11:03 ` [pve-devel] [PATCH manager 12/14] simplify reload call Fabian Ebner
2020-09-02 11:03 ` [pve-devel] [RFC manager 13/14] content view: allow specifying which columns to show on init Fabian Ebner
2020-09-02 11:03 ` [pve-devel] [PATCH manager 14/14] backup view: add prune window Fabian Ebner
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=20200902110337.25004-10-f.ebner@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=pve-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