public inbox for pbs-devel@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] ui: tape: mark incomplete media-sets as such
Date: Fri, 29 Sep 2023 10:52:05 +0200	[thread overview]
Message-ID: <20230929085205.1485197-1-d.csapak@proxmox.com> (raw)

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@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





             reply	other threads:[~2023-09-29  8:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-29  8:52 Dominik Csapak [this message]
2023-11-08 15:38 ` [pbs-devel] applied: " Thomas Lamprecht

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=20230929085205.1485197-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal