]> git.proxmox.com Git - pve-manager.git/blame - www/manager6/storage/Browser.js
cluster resources: include content type for storages
[pve-manager.git] / www / manager6 / storage / Browser.js
CommitLineData
45071714
DM
1Ext.define('PVE.storage.Browser', {
2 extend: 'PVE.panel.Config',
3 alias: 'widget.PVE.storage.Browser',
4
c8802a60 5 onlineHelp: 'chapter_storage',
565a68be 6
45071714
DM
7 initComponent: function() {
8 var me = this;
9
10 var nodename = me.pveSelNode.data.node;
11 if (!nodename) {
12 throw "no node name specified";
13 }
14
15 var storeid = me.pveSelNode.data.storage;
16 if (!storeid) {
17 throw "no storage ID specified";
18 }
19
45071714
DM
20
21 me.items = [
22 {
232c96e0
DC
23 title: gettext('Summary'),
24 xtype: 'pveStorageSummary',
7ccbcc6c 25 iconCls: 'fa fa-book',
45071714
DM
26 itemId: 'summary'
27 }
28 ];
29
232c96e0
DC
30 var caps = Ext.state.Manager.get('GuiCap');
31
45071714 32 Ext.apply(me, {
2dcc87c7
TL
33 title: Ext.String.format(
34 gettext("Storage {0} on node {1}"),
35 `'${storeid}'`,
36 `'${nodename}'`
37 ),
45071714
DM
38 hstateid: 'storagetab'
39 });
40
1a763337
FE
41 // call here, so there is a root for insertNodes()
42 me.callParent();
43
0110314c
DC
44 if (caps.storage['Datastore.Allocate'] ||
45 caps.storage['Datastore.AllocateSpace'] ||
46 caps.storage['Datastore.Audit']) {
e8b422bc
FE
47
48 Proxmox.Utils.API2Request({
2dcc87c7 49 url: `/nodes/${nodename}/storage/${storeid}/status`,
e8b422bc
FE
50 method: 'GET',
51 success: function(response, opts) {
52 var contents = response.result.data.content.split(',');
53 var items = [];
54
55 if (contents.includes('backup')) {
56 items.push({
1665b840 57 xtype: 'pveStorageBackupView',
e8b422bc
FE
58 title: gettext('Backups'),
59 iconCls: 'fa fa-floppy-o',
60 itemId: 'contentBackup',
2dcc87c7 61 hasCommentColumn: true,
e8b422bc
FE
62 });
63 }
64 if (contents.includes('images')) {
65 items.push({
f5e17f15 66 xtype: 'pveStorageImageView',
2dcc87c7 67 title: gettext('VM Disks'),
e8b422bc
FE
68 iconCls: 'fa fa-hdd-o',
69 itemId: 'contentImages',
70 content: 'images',
2dcc87c7
TL
71 });
72 }
73 if (contents.includes('rootdir')) {
74 items.push({
75 xtype: 'pveStorageImageView',
76 title: gettext('CT Volumes'),
77 iconCls: 'fa fa-hdd-o lxc',
78 itemId: 'contentRootdir',
79 content: 'rootdir',
e8b422bc
FE
80 });
81 }
82 if (contents.includes('iso')) {
83 items.push({
84 xtype: 'pveStorageContentView',
85 title: gettext('ISO Images'),
86 iconCls: 'pve-itype-treelist-item-icon-cdrom',
87 itemId: 'contentIso',
88 content: 'iso',
8798c35b 89 useUploadButton: true,
e8b422bc
FE
90 });
91 }
2dcc87c7 92 if (contents.includes('vztmpl')) {
e8b422bc 93 items.push({
2dcc87c7
TL
94 xtype: 'pveStorageTemplateView',
95 title: gettext('CT Templates'),
96 iconCls: 'fa fa-file-o lxc',
97 itemId: 'contentVztmpl',
e8b422bc
FE
98 });
99 }
100 if (contents.includes('snippets')) {
101 items.push({
102 xtype: 'pveStorageContentView',
103 title: gettext('Snippets'),
104 iconCls: 'fa fa-file-code-o',
105 itemId: 'contentSnippets',
106 content: 'snippets',
e8b422bc
FE
107 });
108 }
109 me.insertNodes(items);
1a763337 110 },
e8b422bc 111 });
45071714
DM
112 }
113
114 if (caps.storage['Permissions.Modify']) {
1a763337
FE
115 me.insertNodes([
116 {
117 xtype: 'pveACLView',
118 title: gettext('Permissions'),
119 iconCls: 'fa fa-unlock',
120 itemId: 'permissions',
121 path: '/storage/' + storeid
122 },
123 ]);
45071714 124 }
45071714
DM
125 }
126});