From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 25F6972E2F for ; Wed, 26 May 2021 15:48:15 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E9DE512F21 for ; Wed, 26 May 2021 15:48:14 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (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 B20BE12E9B for ; Wed, 26 May 2021 15:48:12 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 8C3364668A for ; Wed, 26 May 2021 15:48:12 +0200 (CEST) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Wed, 26 May 2021 15:48:07 +0200 Message-Id: <20210526134811.333-6-d.csapak@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210526134811.333-1-d.csapak@proxmox.com> References: <20210526134811.333-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.035 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment 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/9] ui: tape/TapeRestore: add MediaSetSelector X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 May 2021 13:48:15 -0000 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 --- 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