[pbs-devel] [PATCH proxmox-backup] ui: tape: mark incomplete media-sets as such

Dominik Csapak d.csapak at proxmox.com
Fri Sep 29 10:52:05 CEST 2023


by counting the returned tapes and compare it to the sequence number.
If the tape count is lower than the highest sequence number plus one,
there must be a tape missing.

Mark it in the text and add the proxmox-warning-row class.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
i opted to not deduplicated the checking logic because it's only three
lines and we don't have a good place to put it besides Utils.
If wanted i can ofc do that and send a v2

 www/tape/BackupOverview.js | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/www/tape/BackupOverview.js b/www/tape/BackupOverview.js
index 229d8d9d..f8e9dfd7 100644
--- a/www/tape/BackupOverview.js
+++ b/www/tape/BackupOverview.js
@@ -55,17 +55,24 @@ Ext.define('PBS.TapeManagement.BackupOverview', {
 		    data[pool] = {};
 		}
 
+		let seq_nr = entry['seq-nr'];
+
 		if (data[pool][media_set] === undefined) {
 		    data[pool][media_set] = entry;
 		    data[pool][media_set].text = media_set;
 		    data[pool][media_set].restore = true;
 		    data[pool][media_set].tapes = 1;
 		    data[pool][media_set]['seq-nr'] = undefined;
+		    data[pool][media_set]['max-seq-nr'] = seq_nr;
 		    data[pool][media_set].is_media_set = true;
 		    data[pool][media_set].typeText = 'media-set';
 		} else {
 		    data[pool][media_set].tapes++;
 		}
+
+		if (data[pool][media_set]['max-seq-nr'] < seq_nr) {
+		    data[pool][media_set]['max-seq-nr'] = seq_nr;
+		}
 	    }
 
 	    let list = [];
@@ -309,11 +316,33 @@ Ext.define('PBS.TapeManagement.BackupOverview', {
 	},
     ],
 
+    viewConfig: {
+	getRowClass: function(rec) {
+	    let tapeCount = (rec.get('max-seq-nr') ?? 0) + 1;
+	    let actualTapeCount = rec.get('tapes') ?? 1;
+
+	    if (tapeCount !== actualTapeCount) {
+		return 'proxmox-warning-row';
+	    }
+
+	    return '';
+	},
+    },
+
     columns: [
 	{
 	    xtype: 'treecolumn',
 	    text: gettext('Pool/Media-Set/Snapshot'),
 	    dataIndex: 'text',
+	    renderer: function(value, mD, rec) {
+		let tapeCount = (rec.get('max-seq-nr') ?? 0) + 1;
+		let actualTapeCount = rec.get('tapes') ?? 1;
+
+		if (tapeCount !== actualTapeCount) {
+		    return `${value} (${gettext('Incomplete')})`;
+		}
+		return value;
+	    },
 	    sortable: false,
 	    flex: 3,
 	},
-- 
2.30.2






More information about the pbs-devel mailing list