From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <d.csapak@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 68B5F6CB77
 for <pbs-devel@lists.proxmox.com>; Tue,  2 Feb 2021 14:00:42 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 43774EE93
 for <pbs-devel@lists.proxmox.com>; Tue,  2 Feb 2021 14:00:42 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [212.186.127.180])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id 18FB4EE78
 for <pbs-devel@lists.proxmox.com>; Tue,  2 Feb 2021 14:00:41 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id D23DA4616F
 for <pbs-devel@lists.proxmox.com>; Tue,  2 Feb 2021 14:00:40 +0100 (CET)
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Date: Tue,  2 Feb 2021 14:00:38 +0100
Message-Id: <20210202130039.6564-5-d.csapak@proxmox.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20210202130039.6564-1-d.csapak@proxmox.com>
References: <20210202130039.6564-1-d.csapak@proxmox.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.240 Adjusted score from AWL reputation of From: address
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_DNSWL_MED        -2.3 Sender listed at https://www.dnswl.org/,
 medium trust
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: [pbs-devel] [PATCH proxmox-backup 5/6] ui: tape: add Restore Window
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Tue, 02 Feb 2021 13:00:42 -0000

in the BackupOverview, when a media-set is selected

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/Makefile                   |  1 +
 www/tape/BackupOverview.js     |  8 ++++++
 www/tape/window/TapeRestore.js | 45 ++++++++++++++++++++++++++++++++++
 3 files changed, 54 insertions(+)
 create mode 100644 www/tape/window/TapeRestore.js

diff --git a/www/Makefile b/www/Makefile
index 7a47ad8d..1f45bc14 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -20,6 +20,7 @@ TAPE_UI_FILES=						\
 	tape/window/LabelMedia.js			\
 	tape/window/PoolEdit.js				\
 	tape/window/TapeBackup.js			\
+	tape/window/TapeRestore.js			\
 	tape/BackupOverview.js				\
 	tape/ChangerConfig.js				\
 	tape/ChangerStatus.js				\
diff --git a/www/tape/BackupOverview.js b/www/tape/BackupOverview.js
index f850c29a..439c1394 100644
--- a/www/tape/BackupOverview.js
+++ b/www/tape/BackupOverview.js
@@ -148,6 +148,14 @@ Ext.define('PBS.TapeManagement.BackupOverview', {
 	    text: gettext('New Backup'),
 	    handler: 'backup',
 	},
+	{
+	    xtype: 'proxmoxButton',
+	    disabled: true,
+	    text: gettext('Restore Media Set'),
+	    handler: 'restore',
+	    parentXType: 'treepanel',
+	    enableFn: (rec) => !!rec.data.uuid,
+	},
     ],
 
     columns: [
diff --git a/www/tape/window/TapeRestore.js b/www/tape/window/TapeRestore.js
new file mode 100644
index 00000000..9e0a5edb
--- /dev/null
+++ b/www/tape/window/TapeRestore.js
@@ -0,0 +1,45 @@
+Ext.define('PBS.TapeManagement.TapeRestoreWindow', {
+    extend: 'Proxmox.window.Edit',
+    alias: 'pbsTapeRestoreWindow',
+    mixins: ['Proxmox.Mixin.CBind'],
+
+    width: 400,
+    title: gettext('Restore Media Set'),
+    url: '/api2/extjs/tape/restore',
+    method: 'POST',
+    showTaskViewer: true,
+    isCreate: true,
+
+    defaults: {
+	labelWidth: 120,
+    },
+
+    items: [
+	{
+	    xtype: 'displayfield',
+	    fieldLabel: gettext('Media Set'),
+	    cbind: {
+		value: '{mediaset}',
+	    },
+	},
+	{
+	    xtype: 'displayfield',
+	    fieldLabel: gettext('Media Set UUID'),
+	    name: 'media-set',
+	    submitValue: true,
+	    cbind: {
+		value: '{uuid}',
+	    },
+	},
+	{
+	    xtype: 'pbsDataStoreSelector',
+	    fieldLabel: gettext('Datastore'),
+	    name: 'store',
+	},
+	{
+	    xtype: 'pbsDriveSelector',
+	    fieldLabel: gettext('Drive'),
+	    name: 'drive',
+	},
+    ],
+});
-- 
2.20.1