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 6/6] ui: tape: add TapeInventory panel
Date: Tue,  2 Feb 2021 14:00:39 +0100	[thread overview]
Message-ID: <20210202130039.6564-6-d.csapak@proxmox.com> (raw)
In-Reply-To: <20210202130039.6564-1-d.csapak@proxmox.com>

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 <d.csapak@proxmox.com>
---
 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 `<i class="fa fa-circle-o"></i> ${gettext("Offline")}`;
+		} else if (value.startsWith('online-')) {
+		    let location = value.substring(value.indexOf('-') + 1);
+		    return `<i class="fa fa-dot-circle-o"></i> ${gettext("Online")} - ${location}`;
+		} else if (value.startsWith('vault-')) {
+		    let location = value.substring(value.indexOf('-') + 1);
+		    return `<i class="fa fa-archive"></i> ${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





  parent reply	other threads:[~2021-02-02 13:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02 13:00 [pbs-devel] [PATCH proxmox-backup 1/6] api2/types/tape/media: add media_set_ctime to MediaContentEntry Dominik Csapak
2021-02-02 13:00 ` [pbs-devel] [PATCH proxmox-backup 2/6] ui: refactor get_type_icon_cls Dominik Csapak
2021-02-02 13:00 ` [pbs-devel] [PATCH proxmox-backup 3/6] ui: tape: rework BackupOverview Dominik Csapak
2021-02-02 13:00 ` [pbs-devel] [PATCH proxmox-backup 4/6] ui: tape: TapeBackupWindow: add missing DriveSelector Dominik Csapak
2021-02-02 13:00 ` [pbs-devel] [PATCH proxmox-backup 5/6] ui: tape: add Restore Window Dominik Csapak
2021-02-02 13:00 ` Dominik Csapak [this message]
2021-02-02 13:49 ` [pbs-devel] applied: [PATCH proxmox-backup 1/6] api2/types/tape/media: add media_set_ctime to MediaContentEntry Dietmar Maurer

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=20210202130039.6564-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