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/BackupOverview: insert a datastore level
Date: Wed, 17 Mar 2021 13:18:40 +0100	[thread overview]
Message-ID: <20210317121840.18844-1-d.csapak@proxmox.com> (raw)

since we can now backup multiple datastores in the same media-set,
we show the datastores as first level below that

the final tree structucture looks like this:

tapepool A
- media set 1
 - datastore I
  - tape x
   - ct/100
    - ct/100/2020-01-01T00:00:00Z

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
maybe we want to omit the 'tape' level in the future since IMHO it
does not really add valuable information for the user there
instead i would probably add it as a seperate column instead of the
'seq-nr' column. any thoughts on that ?

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

diff --git a/www/tape/BackupOverview.js b/www/tape/BackupOverview.js
index a53475c2..0f9a35af 100644
--- a/www/tape/BackupOverview.js
+++ b/www/tape/BackupOverview.js
@@ -127,9 +127,16 @@ Ext.define('PBS.TapeManagement.BackupOverview', {
 		    },
 		});
 
-		list.result.data.sort((a, b) => a.snapshot.localeCompare(b.snapshot));
+		list.result.data.sort(function(a, b) {
+		    let storeRes = a.store.localeCompare(b.store);
+		    if (storeRes === 0) {
+			return a.snapshot.localeCompare(b.snapshot);
+		    } else {
+			return storeRes;
+		    }
+		});
 
-		let tapes = {};
+		let stores = {};
 
 		for (let entry of list.result.data) {
 		    entry.text = entry.snapshot;
@@ -140,9 +147,19 @@ Ext.define('PBS.TapeManagement.BackupOverview', {
 			entry.iconCls = `fa ${iconCls}`;
 		    }
 
+		    let store = entry.store;
 		    let tape = entry['label-text'];
-		    if (tapes[tape] === undefined) {
-			tapes[tape] = {
+		    if (stores[store] === undefined) {
+			stores[store] = {
+			    text: store,
+			    'media-set-uuid': entry['media-set-uuid'],
+			    iconCls: 'fa fa-database',
+			    tapes: {},
+			};
+		    }
+
+		    if (stores[store].tapes[tape] === undefined) {
+			stores[store].tapes[tape] = {
 			    text: tape,
 			    'media-set-uuid': entry['media-set-uuid'],
 			    'seq-nr': entry['seq-nr'],
@@ -153,7 +170,7 @@ Ext.define('PBS.TapeManagement.BackupOverview', {
 		    }
 		    let [type, group, _id] = PBS.Utils.parse_snapshot_id(entry.snapshot);
 
-		    let children = tapes[tape].children;
+		    let children = stores[store].tapes[tape].children;
 		    let text = `${type}/${group}`;
 		    if (children.length < 1 || children[children.length - 1].text !== text) {
 			children.push({
@@ -167,8 +184,13 @@ Ext.define('PBS.TapeManagement.BackupOverview', {
 		    children[children.length - 1].children.push(entry);
 		}
 
-		for (const tape of Object.values(tapes)) {
-		    node.appendChild(tape);
+		let storeList = Object.values(stores);
+		let expand = storeList.length === 1;
+		for (const store of storeList) {
+		    store.children = Object.values(store.tapes);
+		    store.expanded = expand;
+		    delete store.tapes;
+		    node.appendChild(store);
 		}
 
 		if (list.result.data.length === 0) {
-- 
2.20.1





             reply	other threads:[~2021-03-17 12:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-17 12:18 Dominik Csapak [this message]
2021-03-17 12:38 ` [pbs-devel] applied: " Dietmar Maurer

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=20210317121840.18844-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