all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup 1/2] ui: tape/DriveStatus: add cartridge memory grid
@ 2021-03-08  9:06 Dominik Csapak
  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
  0 siblings, 2 replies; 3+ messages in thread
From: Dominik Csapak @ 2021-03-08  9:06 UTC (permalink / raw)
  To: pbs-devel

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-08 10:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08  9:06 [pbs-devel] [PATCH proxmox-backup 1/2] ui: tape/DriveStatus: add cartridge memory grid Dominik Csapak
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

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