public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 manager 2/5] ui: storage content: avoid redundant options hasNotesColumn and hideColumns
Date: Thu, 30 Sep 2021 13:42:12 +0200	[thread overview]
Message-ID: <20210930114215.240095-10-f.ebner@proxmox.com> (raw)
In-Reply-To: <20210930114215.240095-1-f.ebner@proxmox.com>

Replace both by a showColumns option instead. As the current use of
hasNotesColumn already indicates, when new content-specific columns
are added, it is more natural for each derived class to specify the
columns it wants, rather than those it doesn't.

For hideColumns, there was no user. For hasNotesColumn, the only user
was the backup view.

Set the column information in the storage.BackupView class itself
rather than the instance (like hasNotesColumn was).

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---

New in v2.

 www/manager6/storage/BackupView.js  |  2 ++
 www/manager6/storage/Browser.js     |  1 -
 www/manager6/storage/ContentView.js | 14 ++++++++------
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/www/manager6/storage/BackupView.js b/www/manager6/storage/BackupView.js
index 0613c94d..5fec3b18 100644
--- a/www/manager6/storage/BackupView.js
+++ b/www/manager6/storage/BackupView.js
@@ -3,6 +3,8 @@ Ext.define('PVE.storage.BackupView', {
 
     alias: 'widget.pveStorageBackupView',
 
+    showColumns: ['name', 'notes', 'date', 'format', 'size'],
+
     initComponent: function() {
 	var me = this;
 
diff --git a/www/manager6/storage/Browser.js b/www/manager6/storage/Browser.js
index fe5df3e2..1916ff6a 100644
--- a/www/manager6/storage/Browser.js
+++ b/www/manager6/storage/Browser.js
@@ -63,7 +63,6 @@ Ext.define('PVE.storage.Browser', {
 		    iconCls: 'fa fa-floppy-o',
 		    itemId: 'contentBackup',
 		    pluginType: plugin,
-		    hasNotesColumn: true,
 		});
 	    }
 	    if (contents.includes('images')) {
diff --git a/www/manager6/storage/ContentView.js b/www/manager6/storage/ContentView.js
index 3f5b686b..9ba2b4ce 100644
--- a/www/manager6/storage/ContentView.js
+++ b/www/manager6/storage/ContentView.js
@@ -371,12 +371,14 @@ Ext.define('PVE.storage.ContentView', {
 	    },
 	};
 
-	if (me.hideColumns) {
-	    me.hideColumns.forEach(key => delete availableColumns[key]);
-	}
-	if (!me.hasNotesColumn) {
-	    delete availableColumns.notes;
-	}
+	let showColumns = me.showColumns || ['name', 'date', 'format', 'size'];
+
+	Object.keys(availableColumns).forEach(function(key) {
+	    if (!showColumns.includes(key)) {
+		delete availableColumns[key];
+	    }
+	});
+
 	if (me.extraColumns && typeof me.extraColumns === 'object') {
 	    Object.assign(availableColumns, me.extraColumns);
 	}
-- 
2.30.2





  parent reply	other threads:[~2021-09-30 11:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-30 11:42 [pve-devel] [PATCH-SERIES v2 manager/storage] fix #3307: allow backups to be marked as protected Fabian Ebner
2021-09-30 11:42 ` [pve-devel] [PATCH v2 storage 1/7] dir plugin: update notes: don't fail if file is already removed Fabian Ebner
2021-09-30 11:42 ` [pve-devel] [PATCH v2 storage 2/7] dir plugin: get notes: return undef if notes are not supported Fabian Ebner
2021-09-30 11:42 ` [pve-devel] [PATCH v2 storage 3/7] add generalized functions to manage volume attributes Fabian Ebner
2021-09-30 11:42 ` [pve-devel] [PATCH v2 storage 4/7] prune mark: preserve additional information for the keep-all case Fabian Ebner
2021-09-30 11:42 ` [pve-devel] [PATCH v2 storage 5/7] fix #3307: make it possible to set protection for backups Fabian Ebner
2021-09-30 11:42 ` [pve-devel] [PATCH v2 storage 6/7] prune: mark renamed and protected backups differently Fabian Ebner
2021-09-30 11:42 ` [pve-devel] [PATCH v2 storage 7/7] pbs: integrate support for protected Fabian Ebner
2021-09-30 11:42 ` [pve-devel] [PATCH v2 manager 1/5] vzdump: skip protected backups for dumpdir pruning Fabian Ebner
2021-09-30 11:42 ` Fabian Ebner [this message]
2021-09-30 11:42 ` [pve-devel] [PATCH v2 manager 3/5] ui: backup views: add protected column Fabian Ebner
2021-09-30 11:42 ` [pve-devel] [PATCH v2 manager 4/5] ui: backup views: add button to change protection status Fabian Ebner
2021-09-30 11:42 ` [pve-devel] [PATCH v2 manager 5/5] ui: prune: also handle new 'renamed' keep reason Fabian Ebner
2021-11-09 16:51 ` [pve-devel] applied-series: [PATCH-SERIES v2 manager/storage] fix #3307: allow backups to be marked as protected Fabian Grünbichler

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=20210930114215.240095-10-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-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