pve-manager/www/manager6/storage/Browser.js
Fabian Ebner 1a763337a2 storage panel/browser: use insertNodes function
in preparation for dynamically loading nodes for content-type-specific views.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-11-15 18:41:11 +01:00

67 lines
1.3 KiB
JavaScript

Ext.define('PVE.storage.Browser', {
extend: 'PVE.panel.Config',
alias: 'widget.PVE.storage.Browser',
onlineHelp: 'chapter_storage',
initComponent: function() {
var me = this;
var nodename = me.pveSelNode.data.node;
if (!nodename) {
throw "no node name specified";
}
var storeid = me.pveSelNode.data.storage;
if (!storeid) {
throw "no storage ID specified";
}
me.items = [
{
title: gettext('Summary'),
xtype: 'pveStorageSummary',
iconCls: 'fa fa-book',
itemId: 'summary'
}
];
var caps = Ext.state.Manager.get('GuiCap');
Ext.apply(me, {
title: Ext.String.format(gettext("Storage {0} on node {1}"),
"'" + storeid + "'", "'" + nodename + "'"),
hstateid: 'storagetab'
});
// call here, so there is a root for insertNodes()
me.callParent();
if (caps.storage['Datastore.Allocate'] ||
caps.storage['Datastore.AllocateSpace'] ||
caps.storage['Datastore.Audit']) {
me.insertNodes([
{
xtype: 'pveStorageContentView',
title: gettext('Content'),
iconCls: 'fa fa-th',
itemId: 'content'
},
]);
}
if (caps.storage['Permissions.Modify']) {
me.insertNodes([
{
xtype: 'pveACLView',
title: gettext('Permissions'),
iconCls: 'fa fa-unlock',
itemId: 'permissions',
path: '/storage/' + storeid
},
]);
}
}
});