[pbs-devel] [PATCH proxmox-backup 2/7] ui: tape/ChangerStatus: save assigned drives

Dominik Csapak d.csapak at proxmox.com
Thu Apr 8 13:39:15 CEST 2021


so that we can shortcut later if we only have one

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/tape/ChangerStatus.js | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/www/tape/ChangerStatus.js b/www/tape/ChangerStatus.js
index f8bff531..fb4ad1e3 100644
--- a/www/tape/ChangerStatus.js
+++ b/www/tape/ChangerStatus.js
@@ -369,6 +369,13 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
 	    me.reload_full(false);
 	},
 
+	drives: [],
+
+	updateDrives: function(drives) {
+	    let me = this;
+	    me.drives = drives;
+	},
+
 	free_slots: [],
 	free_ie_slots: [],
 
@@ -440,11 +447,15 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
 		let free_slots = [];
 		let free_ie_slots = [];
 
+		let valid_drives = [];
+
 		for (let entry of status.result.data) {
 		    let type = entry['entry-kind'];
+		    let id = entry['entry-id'];
 
-		    if (type === 'drive' && drive_entries[entry['entry-id']] !== undefined) {
-			entry = Ext.applyIf(entry, drive_entries[entry['entry-id']]);
+		    if (type === 'drive' && drive_entries[id] !== undefined) {
+			entry = Ext.applyIf(entry, drive_entries[id]);
+			valid_drives.push(drive_entries[id].name);
 		    }
 
 		    if (tapes[entry['label-text']] !== undefined) {
@@ -458,12 +469,12 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
 		    if (!entry['label-text'] && type !== 'drive') {
 			if (type === 'slot') {
 			    free_slots.push({
-				id: entry['entry-id'],
+				id,
 				type,
 			    });
 			} else {
 			    free_ie_slots.push({
-				id: entry['entry-id'],
+				id,
 				type,
 			    });
 			}
@@ -488,6 +499,7 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
 		me.lookup('drives').getSelectionModel().fireEvent('selectionchange', me);
 
 		me.updateFreeSlots(free_slots, free_ie_slots);
+		me.updateDrives(valid_drives);
 
 		if (!use_cache) {
 		    Proxmox.Utils.setErrorMask(view);
-- 
2.20.1






More information about the pbs-devel mailing list