]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/storage/Browser.js
71225f7ef1d8c823ef94b05205e63b44de00977c
1 Ext
.define('PVE.storage.Browser', {
2 extend
: 'PVE.panel.Config',
3 alias
: 'widget.PVE.storage.Browser',
5 onlineHelp
: 'chapter_storage',
7 initComponent: function() {
10 let nodename
= me
.pveSelNode
.data
.node
;
12 throw "no node name specified";
15 let storeid
= me
.pveSelNode
.data
.storage
;
17 throw "no storage ID specified";
20 let storageInfo
= PVE
.data
.ResourceStore
.findRecord(
22 `storage/${nodename}/${storeid}`,
25 true, // caseSensitive
28 let res
= storageInfo
.data
;
29 let plugin
= res
.plugintype
;
31 me
.items
= plugin
!== 'esxi' ? [
33 title
: gettext('Summary'),
34 xtype
: 'pveStorageSummary',
35 iconCls
: 'fa fa-book',
40 let caps
= Ext
.state
.Manager
.get('GuiCap');
43 title
: Ext
.String
.format(gettext("Storage {0} on node {1}"), `'${storeid}'`, `'${nodename}'`),
44 hstateid
: 'storagetab',
48 caps
.storage
['Datastore.Allocate'] ||
49 caps
.storage
['Datastore.AllocateSpace'] ||
50 caps
.storage
['Datastore.Audit']
52 let contents
= res
.content
.split(',');
54 let enableUpload
= !!caps
.storage
['Datastore.AllocateTemplate'];
55 let enableDownloadUrl
= enableUpload
&& (
56 !!(caps
.nodes
['Sys.Audit'] && caps
.nodes
['Sys.Modify']) || // for backward compat
57 !!caps
.nodes
['Sys.AccessNetwork'] // new explicit priv for querying (local) networks
60 if (contents
.includes('backup')) {
62 xtype
: 'pveStorageBackupView',
63 title
: gettext('Backups'),
64 iconCls
: 'fa fa-floppy-o',
65 itemId
: 'contentBackup',
69 if (contents
.includes('images')) {
71 xtype
: 'pveStorageImageView',
72 title
: gettext('VM Disks'),
73 iconCls
: 'fa fa-hdd-o',
74 itemId
: 'contentImages',
79 if (contents
.includes('rootdir')) {
81 xtype
: 'pveStorageImageView',
82 title
: gettext('CT Volumes'),
83 iconCls
: 'fa fa-hdd-o lxc',
84 itemId
: 'contentRootdir',
89 if (contents
.includes('iso')) {
91 xtype
: 'pveStorageContentView',
92 title
: gettext('ISO Images'),
93 iconCls
: 'pve-itype-treelist-item-icon-cdrom',
97 enableUploadButton
: enableUpload
,
98 enableDownloadUrlButton
: enableDownloadUrl
,
99 useUploadButton
: true,
102 if (contents
.includes('vztmpl')) {
104 xtype
: 'pveStorageTemplateView',
105 title
: gettext('CT Templates'),
106 iconCls
: 'fa fa-file-o lxc',
107 itemId
: 'contentVztmpl',
109 enableUploadButton
: enableUpload
,
110 enableDownloadUrlButton
: enableDownloadUrl
,
111 useUploadButton
: true,
114 if (contents
.includes('snippets')) {
116 xtype
: 'pveStorageContentView',
117 title
: gettext('Snippets'),
118 iconCls
: 'fa fa-file-code-o',
119 itemId
: 'contentSnippets',
124 if (contents
.includes('import')) {
125 let createGuestImportWindow
= (selection
) => {
130 let volumeName
= selection
.data
.volid
.replace(/^.*?:/, '');
132 Ext
.create('PVE.window.GuestImport', {
140 xtype
: 'pveStorageContentView',
141 title
: gettext('Virtual Guests'),
142 iconCls
: 'fa fa-cloud-download',
143 itemId
: 'contentImport',
145 useCustomRemoveButton
: true, // hide default remove button
146 showColumns
: ['name', 'format'],
147 itemdblclick
: (view
, record
) => createGuestImportWindow(record
),
150 xtype
: 'proxmoxButton',
152 text
: gettext('Import'),
153 handler: function() {
154 let grid
= this.up('pveStorageContentView');
155 let selection
= grid
.getSelection()?.[0];
157 createGuestImportWindow(selection
);
166 if (caps
.storage
['Permissions.Modify']) {
169 title
: gettext('Permissions'),
170 iconCls
: 'fa fa-unlock',
171 itemId
: 'permissions',
172 path
: `/storage/${storeid}`,