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 C659D6D168 for ; Thu, 4 Feb 2021 13:56:34 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C494A24178 for ; Thu, 4 Feb 2021 13:56:34 +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 B4D2724163 for ; Thu, 4 Feb 2021 13:56:33 +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 7F0ED461DE for ; Thu, 4 Feb 2021 13:56:33 +0100 (CET) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Thu, 4 Feb 2021 13:56:32 +0100 Message-Id: <20210204125632.16787-4-d.csapak@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210204125632.16787-1-d.csapak@proxmox.com> References: <20210204125632.16787-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.235 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [record.data] Subject: [pbs-devel] [PATCH proxmox-backup 4/4] ui: tape/ChangerStatus: add 'is labeled' column for tapes 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: Thu, 04 Feb 2021 12:56:34 -0000 so that a user can see if a tape in a library is not yet labeled Signed-off-by: Dominik Csapak --- www/tape/ChangerStatus.js | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/www/tape/ChangerStatus.js b/www/tape/ChangerStatus.js index f7e1b1f4..97294b72 100644 --- a/www/tape/ChangerStatus.js +++ b/www/tape/ChangerStatus.js @@ -377,19 +377,31 @@ Ext.define('PBS.TapeManagement.ChangerStatus', { try { Proxmox.Utils.setErrorMask(view, true); Proxmox.Utils.setErrorMask(me.lookup('content')); - let status = await PBS.Async.api2({ + let status_fut = PBS.Async.api2({ url: `/api2/extjs/tape/changer/${encodeURIComponent(changer)}/status`, }); - let drives = await PBS.Async.api2({ + let drives_fut = PBS.Async.api2({ url: `/api2/extjs/tape/drive?changer=${encodeURIComponent(changer)}`, }); + let tapes_fut = PBS.Async.api2({ + url: '/api2/extjs/tape/media/list', + }); + + let [status, drives, tapes_list] = await Promise.all([status_fut, drives_fut, tapes_fut]); + let data = { slot: [], 'import-export': [], drive: [], }; + let tapes = {}; + + for (const tape of tapes_list.result.data) { + tapes[tape['label-text']] = true; + } + let drive_entries = {}; for (const entry of drives.result.data) { @@ -403,6 +415,8 @@ Ext.define('PBS.TapeManagement.ChangerStatus', { entry = Ext.applyIf(entry, drive_entries[entry['entry-id']]); } + entry['is-labeled'] = !!tapes[entry['label-text']]; + data[type].push(entry); } @@ -520,6 +534,22 @@ Ext.define('PBS.TapeManagement.ChangerStatus', { flex: 1, renderer: (value) => value || '', }, + { + text: gettext('Labeled'), + dataIndex: 'is-labeled', + width: 80, + renderer: function(value, mD, record) { + if (!record.data['label-text']) { + return ""; + } + + if (record.data['label-text'].startsWith("CLN")) { + return ""; + } + + return Proxmox.Utils.format_boolean(value); + }, + }, { text: gettext('Actions'), xtype: 'actioncolumn', -- 2.20.1