public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 5/9] ui: tape/TapeRestore: add MediaSetSelector
Date: Wed, 26 May 2021 15:48:07 +0200	[thread overview]
Message-ID: <20210526134811.333-6-d.csapak@proxmox.com> (raw)
In-Reply-To: <20210526134811.333-1-d.csapak@proxmox.com>

when no uuid/mediaset is given.
we change a bit how we use the uuid by moving it into the viewmodel
(instead of a simple property on the view) so that we can always
use the selected one

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/tape/window/TapeRestore.js | 45 ++++++++++++++++++++++++++++++++--
 1 file changed, 43 insertions(+), 2 deletions(-)

diff --git a/www/tape/window/TapeRestore.js b/www/tape/window/TapeRestore.js
index 1afd57fe..1987dff4 100644
--- a/www/tape/window/TapeRestore.js
+++ b/www/tape/window/TapeRestore.js
@@ -14,6 +14,10 @@ Ext.define('PBS.TapeManagement.TapeRestoreWindow', {
     showTaskViewer: true,
     isCreate: true,
 
+    mediaset: undefined,
+    prefilter: undefined,
+    uuid: undefined,
+
     cbindData: function(config) {
 	let me = this;
 	if (me.prefilter !== undefined) {
@@ -27,6 +31,7 @@ Ext.define('PBS.TapeManagement.TapeRestoreWindow', {
 
     viewModel: {
 	data: {
+	    uuid: "",
 	    singleDatastore: true,
 	},
 	formulas: {
@@ -43,6 +48,13 @@ Ext.define('PBS.TapeManagement.TapeRestoreWindow', {
 	    return panel.query('[isFormField]').every(field => field.isValid());
 	},
 
+	changeMediaSet: function(field, value) {
+	    let me = this;
+	    let vm = me.getViewModel();
+	    vm.set('uuid', value);
+	    me.updateSnapshots();
+	},
+
 	checkValidity: function() {
 	    let me = this;
 
@@ -203,10 +215,12 @@ Ext.define('PBS.TapeManagement.TapeRestoreWindow', {
 	    let me = this;
 	    let view = me.getView();
 	    let grid = me.lookup('snapshotGrid');
+	    let vm = me.getViewModel();
+	    let uuid = vm.get('uuid');
 
 	    Proxmox.Utils.API2Request({
 		waitMsgTarget: view,
-		url: `/tape/media/content?media-set=${view.uuid}`,
+		url: `/tape/media/content?media-set=${uuid}`,
 		success: function(response, opt) {
 		    let datastores = {};
 		    for (const content of response.result.data) {
@@ -229,6 +243,13 @@ Ext.define('PBS.TapeManagement.TapeRestoreWindow', {
 	    });
 	},
 
+	init: function(view) {
+	    let me = this;
+	    let vm = me.getViewModel();
+
+	    vm.set('uuid', view.uuid);
+	},
+
 	control: {
 	    '[isFormField]': {
 		change: 'checkValidity',
@@ -283,11 +304,29 @@ Ext.define('PBS.TapeManagement.TapeRestoreWindow', {
 		    },
 
 		    column1: [
+			{
+			    xtype: 'pbsMediaSetSelector',
+			    fieldLabel: gettext('Media-Set'),
+			    width: 350,
+			    submitValue: false,
+			    bind: {
+				value: '{uuid}',
+			    },
+			    cbind: {
+				hidden: '{uuid}',
+				disabled: '{uuid}',
+			    },
+			    listeners: {
+				change: 'changeMediaSet',
+			    },
+			},
 			{
 			    xtype: 'displayfield',
 			    fieldLabel: gettext('Media-Set'),
 			    cbind: {
 				value: '{mediaset}',
+				hidden: '{!uuid}',
+				disabled: '{!uuid}',
 			    },
 			},
 		    ],
@@ -298,8 +337,10 @@ Ext.define('PBS.TapeManagement.TapeRestoreWindow', {
 			    fieldLabel: gettext('Media-Set UUID'),
 			    name: 'media-set',
 			    submitValue: true,
-			    cbind: {
+			    bind: {
 				value: '{uuid}',
+				hidden: '{!uuid}',
+				disabled: '{!uuid}',
 			    },
 			},
 		    ],
-- 
2.20.1





  parent reply	other threads:[~2021-05-26 13:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-26 13:48 [pbs-devel] [PATCH proxmox-backup 0/9] tape: improve restore ux Dominik Csapak
2021-05-26 13:48 ` [pbs-devel] [PATCH proxmox-backup 1/9] ui: tape/BackupOverview: expand pools by default Dominik Csapak
2021-05-26 13:48 ` [pbs-devel] [PATCH proxmox-backup 2/9] api2/tape: add api call to list media sets Dominik Csapak
2021-05-26 13:48 ` [pbs-devel] [PATCH proxmox-backup 3/9] ui: tape/BackupOverview: rename action column to restore Dominik Csapak
2021-05-26 13:48 ` [pbs-devel] [PATCH proxmox-backup 4/9] ui: tape: add MediaSetSelector Dominik Csapak
2021-05-26 13:48 ` Dominik Csapak [this message]
2021-05-26 13:48 ` [pbs-devel] [PATCH proxmox-backup 6/9] ui: tape/BackupOverview: add generic 'Restore' button Dominik Csapak
2021-05-26 13:48 ` [pbs-devel] [PATCH proxmox-backup 7/9] ui: tape/TapeRestore: don't send snapshotlist when restoring whole datastores Dominik Csapak
2021-05-26 13:48 ` [pbs-devel] [PATCH proxmox-backup 8/9] ui: tape/TapeRestore: allow preselecting a datastore Dominik Csapak
2021-05-26 13:48 ` [pbs-devel] [PATCH proxmox-backup 9/9] ui: tape/TapeRestore: fix some properties Dominik Csapak
2021-05-26 17:16 ` [pbs-devel] applied-series: [PATCH proxmox-backup 0/9] tape: improve restore ux Thomas Lamprecht

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=20210526134811.333-6-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-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