ui: storage content: avoid redundant options hasNotesColumn and hideColumns
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>
This commit is contained in:
parent
4a4bbd5b54
commit
093dd35887
@ -3,6 +3,8 @@ Ext.define('PVE.storage.BackupView', {
|
||||
|
||||
alias: 'widget.pveStorageBackupView',
|
||||
|
||||
showColumns: ['name', 'notes', 'date', 'format', 'size'],
|
||||
|
||||
initComponent: function() {
|
||||
var me = this;
|
||||
|
||||
|
@ -63,7 +63,6 @@ Ext.define('PVE.storage.Browser', {
|
||||
iconCls: 'fa fa-floppy-o',
|
||||
itemId: 'contentBackup',
|
||||
pluginType: plugin,
|
||||
hasNotesColumn: true,
|
||||
});
|
||||
}
|
||||
if (contents.includes('images')) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user