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 4AA836CBBB for ; Tue, 2 Feb 2021 14:01:13 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 41C3CEEC0 for ; Tue, 2 Feb 2021 14:00:43 +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 DA49DEE91 for ; 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 A622C46109 for ; Tue, 2 Feb 2021 14:00:41 +0100 (CET) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Tue, 2 Feb 2021 14:00:39 +0100 Message-Id: <20210202130039.6564-6-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.238 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. [b.data, a.data] Subject: [pbs-devel] [PATCH proxmox-backup 6/6] ui: tape: add TapeInventory panel 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: Tue, 02 Feb 2021 13:01:13 -0000 since we do not show the tapes anymore in the BackupOverview, add another panel where we can list the available tapes in the inventory Signed-off-by: Dominik Csapak --- www/Makefile | 1 + www/tape/TapeInventory.js | 104 +++++++++++++++++++++++++++++++++++++ www/tape/TapeManagement.js | 5 ++ 3 files changed, 110 insertions(+) create mode 100644 www/tape/TapeInventory.js diff --git a/www/Makefile b/www/Makefile index 1f45bc14..b24783ca 100644 --- a/www/Makefile +++ b/www/Makefile @@ -26,6 +26,7 @@ TAPE_UI_FILES= \ tape/ChangerStatus.js \ tape/DriveConfig.js \ tape/PoolConfig.js \ + tape/TapeInventory.js \ tape/TapeManagement.js \ endif diff --git a/www/tape/TapeInventory.js b/www/tape/TapeInventory.js new file mode 100644 index 00000000..ba968752 --- /dev/null +++ b/www/tape/TapeInventory.js @@ -0,0 +1,104 @@ +Ext.define('pbs-model-tapes', { + extend: 'Ext.data.Model', + fields: [ + 'catalog', + 'ctime', + 'expired', + 'label-text', + 'location', + 'media-set-ctime', + 'media-set-name', + 'media-set-uuid', + 'pool', + 'seq-nr', + 'status', + 'uuid', + ], + idProperty: 'label-text', + proxy: { + type: 'proxmox', + url: '/api2/json/tape/media/list', + }, +}); + +Ext.define('PBS.TapeManagement.TapeInventory', { + extend: 'Ext.grid.Panel', + alias: 'widget.pbsTapeInventory', + + controller: { + xclass: 'Ext.app.ViewController', + + reload: function() { + this.getView().getStore().rstore.load(); + }, + + stopStore: function() { + this.getView().getStore().rstore.stopUpdate(); + }, + + startStore: function() { + this.getView().getStore().rstore.startUpdate(); + }, + }, + + listeners: { + beforedestroy: 'stopStore', + deactivate: 'stopStore', + activate: 'startStore', + }, + + store: { + type: 'diff', + rstore: { + type: 'update', + storeid: 'proxmox-tape-tapes', + model: 'pbs-model-tapes', + }, + sorters: 'label-text', + }, + + columns: [ + { + text: gettext('Label'), + dataIndex: 'label-text', + flex: 1, + }, + { + text: gettext('Pool'), + dataIndex: 'pool', + sorter: (a, b) => (a.data.pool || "").localeCompare(b.data.pool || ""), + flex: 1, + }, + { + text: gettext('Media Set'), + dataIndex: 'media-set-name', + flex: 2, + sorter: function(a, b) { + return (a.data['media-set-ctime'] || 0) - (b.data['media-set-ctime'] || 0); + }, + }, + { + text: gettext('Location'), + dataIndex: 'location', + flex: 1, + renderer: function(value) { + if (value === 'offline') { + return ` ${gettext("Offline")}`; + } else if (value.startsWith('online-')) { + let location = value.substring(value.indexOf('-') + 1); + return ` ${gettext("Online")} - ${location}`; + } else if (value.startsWith('vault-')) { + let location = value.substring(value.indexOf('-') + 1); + return ` ${gettext("Vault")} - ${location}`; + } else { + return value; + } + }, + }, + { + text: gettext('Status'), + dataIndex: 'status', + flex: 1, + }, + ], +}); diff --git a/www/tape/TapeManagement.js b/www/tape/TapeManagement.js index 8461b0b3..e558620a 100644 --- a/www/tape/TapeManagement.js +++ b/www/tape/TapeManagement.js @@ -16,6 +16,11 @@ Ext.define('PBS.TapeManagement', { itemId: 'backup', xtype: 'pbsBackupOverview', }, + { + title: gettext('Tape Inventory'), + itemId: 'inventory', + xtype: 'pbsTapeInventory', + }, { title: gettext('Library'), itemId: 'library', -- 2.20.1