]> git.proxmox.com Git - pve-manager.git/blob - www/manager6/storage/Browser.js
update shipped appliance info index
[pve-manager.git] / www / manager6 / storage / Browser.js
1 Ext.define('PVE.storage.Browser', {
2 extend: 'PVE.panel.Config',
3 alias: 'widget.PVE.storage.Browser',
4
5 onlineHelp: 'chapter_storage',
6
7 initComponent: function() {
8 let me = this;
9
10 let nodename = me.pveSelNode.data.node;
11 if (!nodename) {
12 throw "no node name specified";
13 }
14
15 let storeid = me.pveSelNode.data.storage;
16 if (!storeid) {
17 throw "no storage ID specified";
18 }
19
20 me.items = [
21 {
22 title: gettext('Summary'),
23 xtype: 'pveStorageSummary',
24 iconCls: 'fa fa-book',
25 itemId: 'summary',
26 },
27 ];
28
29 let caps = Ext.state.Manager.get('GuiCap');
30
31 Ext.apply(me, {
32 title: Ext.String.format(gettext("Storage {0} on node {1}"), `'${storeid}'`, `'${nodename}'`),
33 hstateid: 'storagetab',
34 });
35
36 if (
37 caps.storage['Datastore.Allocate'] ||
38 caps.storage['Datastore.AllocateSpace'] ||
39 caps.storage['Datastore.Audit']
40 ) {
41 let storageInfo = PVE.data.ResourceStore.findRecord(
42 'id',
43 `storage/${nodename}/${storeid}`,
44 0, // startIndex
45 false, // anyMatch
46 true, // caseSensitive
47 true, // exactMatch
48 );
49 let res = storageInfo.data;
50 let plugin = res.plugintype;
51 let contents = res.content.split(',');
52
53 let enableUpload = !!caps.storage['Datastore.AllocateTemplate'];
54 let enableDownloadUrl = enableUpload && !!(caps.nodes['Sys.Audit'] && caps.nodes['Sys.Modify']);
55
56 if (contents.includes('backup')) {
57 me.items.push({
58 xtype: 'pveStorageBackupView',
59 title: gettext('Backups'),
60 iconCls: 'fa fa-floppy-o',
61 itemId: 'contentBackup',
62 pluginType: plugin,
63 });
64 }
65 if (contents.includes('images')) {
66 me.items.push({
67 xtype: 'pveStorageImageView',
68 title: gettext('VM Disks'),
69 iconCls: 'fa fa-hdd-o',
70 itemId: 'contentImages',
71 content: 'images',
72 pluginType: plugin,
73 });
74 }
75 if (contents.includes('rootdir')) {
76 me.items.push({
77 xtype: 'pveStorageImageView',
78 title: gettext('CT Volumes'),
79 iconCls: 'fa fa-hdd-o lxc',
80 itemId: 'contentRootdir',
81 content: 'rootdir',
82 pluginType: plugin,
83 });
84 }
85 if (contents.includes('iso')) {
86 me.items.push({
87 xtype: 'pveStorageContentView',
88 title: gettext('ISO Images'),
89 iconCls: 'pve-itype-treelist-item-icon-cdrom',
90 itemId: 'contentIso',
91 content: 'iso',
92 pluginType: plugin,
93 enableUploadButton: enableUpload,
94 enableDownloadUrlButton: enableDownloadUrl,
95 useUploadButton: true,
96 });
97 }
98 if (contents.includes('vztmpl')) {
99 me.items.push({
100 xtype: 'pveStorageTemplateView',
101 title: gettext('CT Templates'),
102 iconCls: 'fa fa-file-o lxc',
103 itemId: 'contentVztmpl',
104 pluginType: plugin,
105 enableUploadButton: enableUpload,
106 enableDownloadUrlButton: enableDownloadUrl,
107 useUploadButton: true,
108 });
109 }
110 if (contents.includes('snippets')) {
111 me.items.push({
112 xtype: 'pveStorageContentView',
113 title: gettext('Snippets'),
114 iconCls: 'fa fa-file-code-o',
115 itemId: 'contentSnippets',
116 content: 'snippets',
117 pluginType: plugin,
118 });
119 }
120 }
121
122 if (caps.storage['Permissions.Modify']) {
123 me.items.push({
124 xtype: 'pveACLView',
125 title: gettext('Permissions'),
126 iconCls: 'fa fa-unlock',
127 itemId: 'permissions',
128 path: `/storage/${storeid}`,
129 });
130 }
131
132 me.callParent();
133 },
134 });