all lists on 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 1/2] ui: tape/DriveStatus: add cartridge memory grid
Date: Mon,  8 Mar 2021 10:06:06 +0100	[thread overview]
Message-ID: <20210308090607.28658-1-d.csapak@proxmox.com> (raw)

that the user can load when a tape is inserted

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

diff --git a/www/tape/DriveStatus.js b/www/tape/DriveStatus.js
index deb8d952..ec1b9fb9 100644
--- a/www/tape/DriveStatus.js
+++ b/www/tape/DriveStatus.js
@@ -8,12 +8,17 @@ Ext.define('PBS.TapeManagement.DriveStatus', {
     cbindData: function(config) {
 	let me = this;
 	me.setTitle(`${gettext('Drive')}: ${me.drive}`);
+	let baseurl = `/api2/json/tape/drive/${me.drive}/`;
 	return {
-	    driveStatusUrl: `/api2/json/tape/drive/${me.drive}/status`,
+	    driveStatusUrl: `${baseurl}/status`,
+	    cartridgeMemoryUrl: `${baseurl}/cartridge-memory`,
 	};
     },
 
-    scrollable: true,
+    layout: {
+	type: 'vbox',
+	align: 'stretch',
+    },
 
     bodyPadding: 5,
 
@@ -40,6 +45,9 @@ Ext.define('PBS.TapeManagement.DriveStatus', {
 	    let online = statusFlags.indexOf('ONLINE') !== -1;
 	    let vm = me.getViewModel();
 	    vm.set('online', online);
+	    if (!online) {
+		me.lookup('cartridgegrid').getStore().removeAll();
+	    }
 	},
 
 	onStateLoad: function(store) {
@@ -193,6 +201,18 @@ Ext.define('PBS.TapeManagement.DriveStatus', {
 		},
 	    ],
 	},
+	{
+	    xtype: 'pbsDriveCartridgeMemoryGrid',
+	    flex: 1,
+	    padding: 5,
+	    reference: 'cartridgegrid',
+	    bind: {
+		disabled: '{!online}',
+	    },
+	    cbind: {
+		url: '{cartridgeMemoryUrl}',
+	    },
+	},
     ],
 });
 
@@ -257,6 +277,66 @@ Ext.define('PBS.TapeManagement.DriveStatusGrid', {
     },
 });
 
+Ext.define('PBS.TapeManagement.CartridgeMemoryGrid', {
+    extend: 'Ext.grid.Panel',
+    alias: 'widget.pbsDriveCartridgeMemoryGrid',
+
+    title: gettext('Cartridge Memory'),
+
+    emptyText: gettext('Not Loaded yet'),
+    viewConfig: {
+	deferEmptyText: false,
+    },
+
+    controller: {
+	xclass: 'Ext.app.ViewController',
+
+	loadCartridgeMemory: function() {
+	    console.log(this);
+	    this.getView().getStore().load();
+	},
+
+	init: function(view) {
+	    if (!view.url) {
+		throw "no url given";
+	    }
+
+	    view.getStore().getProxy().setUrl(view.url);
+	},
+    },
+
+    store: {
+	proxy: {
+	    type: 'proxmox',
+	},
+    },
+
+    tbar: [
+	{
+	    text: gettext('Reload'),
+	    handler: 'loadCartridgeMemory',
+	},
+    ],
+
+    columns: [
+	{
+	    text: gettext('ID'),
+	    dataIndex: 'id',
+	    width: 60,
+	},
+	{
+	    text: gettext('Name'),
+	    dataIndex: 'name',
+	    flex: 2,
+	},
+	{
+	    text: gettext('Value'),
+	    dataIndex: 'value',
+	    flex: 1,
+	},
+    ],
+});
+
 Ext.define('PBS.TapeManagement.DriveInfoPanel', {
     extend: 'Ext.panel.Panel',
     alias: 'widget.pbsDriveInfoPanel',
-- 
2.20.1





             reply	other threads:[~2021-03-08  9:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08  9:06 Dominik Csapak [this message]
2021-03-08  9:06 ` [pbs-devel] [PATCH proxmox-backup 2/2] ui: tape/Drive{Config, Status} move actions to status panel Dominik Csapak
2021-03-08 10:34 ` [pbs-devel] applied: [PATCH proxmox-backup 1/2] ui: tape/DriveStatus: add cartridge memory grid 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=20210308090607.28658-1-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal