ui: storage browser: code cleanup/modernization

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2023-01-10 13:51:53 +01:00
parent 21820ede01
commit 7ef80fa8a4

View File

@ -5,19 +5,18 @@ Ext.define('PVE.storage.Browser', {
onlineHelp: 'chapter_storage', onlineHelp: 'chapter_storage',
initComponent: function() { initComponent: function() {
var me = this; let me = this;
var nodename = me.pveSelNode.data.node; let nodename = me.pveSelNode.data.node;
if (!nodename) { if (!nodename) {
throw "no node name specified"; throw "no node name specified";
} }
var storeid = me.pveSelNode.data.storage; let storeid = me.pveSelNode.data.storage;
if (!storeid) { if (!storeid) {
throw "no storage ID specified"; throw "no storage ID specified";
} }
me.items = [ me.items = [
{ {
title: gettext('Summary'), title: gettext('Summary'),
@ -27,20 +26,18 @@ Ext.define('PVE.storage.Browser', {
}, },
]; ];
var caps = Ext.state.Manager.get('GuiCap'); let caps = Ext.state.Manager.get('GuiCap');
Ext.apply(me, { Ext.apply(me, {
title: Ext.String.format( title: Ext.String.format(gettext("Storage {0} on node {1}"), `'${storeid}'`, `'${nodename}'`),
gettext("Storage {0} on node {1}"),
`'${storeid}'`,
`'${nodename}'`,
),
hstateid: 'storagetab', hstateid: 'storagetab',
}); });
if (caps.storage['Datastore.Allocate'] || if (
caps.storage['Datastore.Allocate'] ||
caps.storage['Datastore.AllocateSpace'] || caps.storage['Datastore.AllocateSpace'] ||
caps.storage['Datastore.Audit']) { caps.storage['Datastore.Audit']
) {
let storageInfo = PVE.data.ResourceStore.findRecord( let storageInfo = PVE.data.ResourceStore.findRecord(
'id', 'id',
`storage/${nodename}/${storeid}`, `storage/${nodename}/${storeid}`,
@ -128,7 +125,7 @@ Ext.define('PVE.storage.Browser', {
title: gettext('Permissions'), title: gettext('Permissions'),
iconCls: 'fa fa-unlock', iconCls: 'fa fa-unlock',
itemId: 'permissions', itemId: 'permissions',
path: '/storage/' + storeid, path: `/storage/${storeid}`,
}); });
} }