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

* [pbs-devel] [PATCH proxmox-backup 2/2] ui: tape/Drive{Config, Status} move actions to status panel
  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 ` Dominik Csapak
  2021-03-08 10:34 ` [pbs-devel] applied: [PATCH proxmox-backup 1/2] ui: tape/DriveStatus: add cartridge memory grid Dietmar Maurer
  1 sibling, 0 replies; 3+ messages in thread
From: Dominik Csapak @ 2021-03-08  9:06 UTC (permalink / raw)
  To: pbs-devel

so that the 'DriveConfig' panel is purely for configuration

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/tape/DriveConfig.js | 55 -----------------------------------------
 www/tape/DriveStatus.js | 42 +++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 55 deletions(-)

diff --git a/www/tape/DriveConfig.js b/www/tape/DriveConfig.js
index de6a0525..763f8e55 100644
--- a/www/tape/DriveConfig.js
+++ b/www/tape/DriveConfig.js
@@ -55,34 +55,6 @@ Ext.define('PBS.TapeManagement.DrivePanel', {
 	    });
 	},
 
-	readLabel: function(view, rI, cI, button, el, record) {
-	    let me = this;
-	    let drive = record.data.name;
-
-	    PBS.Utils.driveCommand(drive, 'read-label', {
-		waitMsgTarget: me.getView(),
-		success: PBS.Utils.showMediaLabelWindow,
-	    });
-	},
-
-	volumeStatistics: function(view, rI, cI, button, el, record) {
-	    let me = this;
-	    let drive = record.data.name;
-	    PBS.Utils.driveCommand(drive, 'volume-statistics', {
-		waitMsgTarget: me.getView(),
-		success: PBS.Utils.showVolumeStatisticsWindow,
-	    });
-	},
-
-	cartridgeMemory: function(view, rI, cI, button, el, record) {
-	    let me = this;
-	    let drive = record.data.name;
-	    PBS.Utils.driveCommand(drive, 'cartridge-memory', {
-		waitMsgTarget: me.getView(),
-		success: PBS.Utils.showCartridgeMemoryWindow,
-	    });
-	},
-
 	reload: function() {
 	    this.getView().getStore().rstore.load();
 	},
@@ -193,33 +165,6 @@ Ext.define('PBS.TapeManagement.DrivePanel', {
 		return record.data.changer ? value : '';
 	    },
 	},
-	{
-	    text: gettext('Actions'),
-	    width: 140,
-	    xtype: 'actioncolumn',
-	    items: [
-		{
-		    iconCls: 'fa fa-hdd-o',
-		    handler: 'cartridgeMemory',
-		    tooltip: gettext('Cartridge Memory'),
-		},
-		{
-		    iconCls: 'fa fa-line-chart',
-		    handler: 'volumeStatistics',
-		    tooltip: gettext('Volume Statistics'),
-		},
-		{
-		    iconCls: 'fa fa-tag',
-		    handler: 'readLabel',
-		    tooltip: gettext('Read Label'),
-		},
-		{
-		    iconCls: 'fa fa-info-circle',
-		    handler: 'status',
-		    tooltip: gettext('Status'),
-		},
-	    ],
-	},
     ],
 });
 
diff --git a/www/tape/DriveStatus.js b/www/tape/DriveStatus.js
index ec1b9fb9..284eb975 100644
--- a/www/tape/DriveStatus.js
+++ b/www/tape/DriveStatus.js
@@ -120,6 +120,27 @@ Ext.define('PBS.TapeManagement.DriveStatus', {
 	    });
 	},
 
+	readLabel: function() {
+	    let me = this;
+	    let view = me.getView();
+	    let drive = view.drive;
+
+	    PBS.Utils.driveCommand(drive, 'read-label', {
+		waitMsgTarget: view,
+		success: PBS.Utils.showMediaLabelWindow,
+	    });
+	},
+
+	volumeStatistics: function() {
+	    let me = this;
+	    let view = me.getView();
+	    let drive = view.drive;
+	    PBS.Utils.driveCommand(drive, 'volume-statistics', {
+		waitMsgTarget: view,
+		success: PBS.Utils.showVolumeStatisticsWindow,
+	    });
+	},
+
 	init: function(view) {
 	    let me = this;
 	    me.mon(me.lookup('statusgrid').getStore().rstore, 'load', 'onLoad');
@@ -172,6 +193,27 @@ Ext.define('PBS.TapeManagement.DriveStatus', {
 		disabled: '{!online}',
 	    },
 	},
+	{
+	    text: gettext('Read Label'),
+	    xtype: 'proxmoxButton',
+	    handler: 'readLabel',
+	    iconCls: 'fa fa-tag',
+	    disabled: true,
+	    bind: {
+		disabled: '{!online}',
+	    },
+	},
+	{
+	    text: gettext('Show Volume Statistics'),
+	    xtype: 'proxmoxButton',
+	    handler: 'volumeStatistics',
+	    iconCls: 'fa fa-line-chart',
+	    disabled: true,
+	    bind: {
+		disabled: '{!online}',
+	    },
+	},
+
     ],
 
     items: [
-- 
2.20.1





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

* [pbs-devel] applied: [PATCH proxmox-backup 1/2] ui: tape/DriveStatus: add cartridge memory grid
  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 ` Dietmar Maurer
  1 sibling, 0 replies; 3+ messages in thread
From: Dietmar Maurer @ 2021-03-08 10:34 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

applied both patches




^ 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