]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/dc/StorageView.js
2 Ext
.define('PVE.dc.StorageView', {
3 extend
: 'Ext.grid.GridPanel',
5 alias
: ['widget.pveStorageView'],
7 onlineHelp
: 'chapter_storage',
10 stateId
: 'grid-dc-storage',
12 initComponent : function() {
15 var store
= new Ext
.data
.Store({
19 url
: "/api2/json/storage"
27 var reload = function() {
31 var sm
= Ext
.create('Ext.selection.RowModel', {});
33 var run_editor = function() {
34 var rec
= sm
.getSelection()[0];
38 var type
= rec
.data
.type
;
42 editor
= 'PVE.storage.DirEdit';
43 } else if (type
=== 'nfs') {
44 editor
= 'PVE.storage.NFSEdit';
45 } else if (type
=== 'glusterfs') {
46 editor
= 'PVE.storage.GlusterFsEdit';
47 } else if (type
=== 'lvm') {
48 editor
= 'PVE.storage.LVMEdit';
49 } else if (type
=== 'lvmthin') {
50 editor
= 'PVE.storage.LvmThinEdit';
51 } else if (type
=== 'iscsi') {
52 editor
= 'PVE.storage.IScsiEdit';
53 } else if (type
=== 'rbd') {
54 editor
= 'PVE.storage.RBDEdit';
55 } else if (type
=== 'sheepdog') {
56 editor
= 'PVE.storage.SheepdogEdit';
57 } else if (type
=== 'zfs') {
58 editor
= 'PVE.storage.ZFSEdit';
59 } else if (type
=== 'zfspool') {
60 editor
= 'PVE.storage.ZFSPoolEdit';
64 var win
= Ext
.create(editor
, {
65 storageId
: rec
.data
.storage
,
66 pveceph
: !rec
.data
.monhost
70 win
.on('destroy', reload
);
73 var edit_btn
= new PVE
.button
.Button({
74 text
: gettext('Edit'),
80 var remove_btn
= new PVE
.button
.Button({
81 text
: gettext('Remove'),
84 confirmMsg: function (rec
) {
85 return Ext
.String
.format(gettext('Are you sure you want to remove entry {0}'),
86 "'" + rec
.data
.storage
+ "'");
88 handler: function(btn
, event
, rec
) {
89 PVE
.Utils
.API2Request({
90 url
: '/storage/' + rec
.data
.storage
,
93 callback: function() {
96 failure: function (response
, opts
) {
97 Ext
.Msg
.alert(gettext('Error'), response
.htmlStatus
);
111 text
: gettext('Add'),
112 menu
: new Ext
.menu
.Menu({
115 text
: PVE
.Utils
.format_storage_type('dir'),
116 iconCls
: 'fa fa-fw fa-folder',
117 handler: function() {
118 var win
= Ext
.create('PVE.storage.DirEdit', {});
119 win
.on('destroy', reload
);
125 text
: PVE
.Utils
.format_storage_type('lvm'),
126 iconCls
: 'fa fa-fw fa-folder',
127 handler: function() {
128 var win
= Ext
.create('PVE.storage.LVMEdit', {});
129 win
.on('destroy', reload
);
134 text
: PVE
.Utils
.format_storage_type('lvmthin'),
135 iconCls
: 'fa fa-fw fa-folder',
136 handler: function() {
137 var win
= Ext
.create('PVE.storage.LvmThinEdit', {});
138 win
.on('destroy', reload
);
143 text
: PVE
.Utils
.format_storage_type('nfs'),
144 iconCls
: 'fa fa-fw fa-building',
145 handler: function() {
146 var win
= Ext
.create('PVE.storage.NFSEdit', {});
147 win
.on('destroy', reload
);
152 text
: PVE
.Utils
.format_storage_type('iscsi'),
153 iconCls
: 'fa fa-fw fa-building',
154 handler: function() {
155 var win
= Ext
.create('PVE.storage.IScsiEdit', {});
156 win
.on('destroy', reload
);
161 text
: PVE
.Utils
.format_storage_type('glusterfs'),
162 iconCls
: 'fa fa-fw fa-building',
163 handler: function() {
164 var win
= Ext
.create('PVE.storage.GlusterFsEdit', {});
165 win
.on('destroy', reload
);
170 text
: PVE
.Utils
.format_storage_type('pveceph'),
171 iconCls
: 'fa fa-fw fa-building',
172 handler: function() {
173 var win
= Ext
.create('PVE.storage.RBDEdit', {
176 win
.on('destroy', reload
);
181 text
: PVE
.Utils
.format_storage_type('rbd'),
182 iconCls
: 'fa fa-fw fa-building',
183 handler: function() {
184 var win
= Ext
.create('PVE.storage.RBDEdit', {});
185 win
.on('destroy', reload
);
190 text
: PVE
.Utils
.format_storage_type('zfs'),
191 iconCls
: 'fa fa-fw fa-building',
192 handler: function() {
193 var win
= Ext
.create('PVE.storage.ZFSEdit', {});
194 win
.on('destroy', reload
);
199 text
: PVE
.Utils
.format_storage_type('zfspool'),
200 iconCls
: 'fa fa-fw fa-folder',
201 handler: function() {
202 var win
= Ext
.create('PVE.storage.ZFSPoolEdit', {});
203 win
.on('destroy', reload
);
208 /* the following type are conidered unstable
209 * so we do not enable that on the GUI for now
211 text: PVE.Utils.format_storage_type('sheepdog'),
212 iconCls: 'fa fa-fw fa-building',
213 handler: function() {
214 var win = Ext.create('PVE.storage.SheepdogEdit', {});
215 win.on('destroy', reload);
234 header
: gettext('Type'),
238 renderer
: PVE
.Utils
.format_storage_type
241 header
: gettext('Content'),
244 dataIndex
: 'content',
245 renderer
: PVE
.Utils
.format_content_types
248 header
: gettext('Path') + '/' + gettext('Target'),
252 renderer: function(value
, metaData
, record
) {
253 if (record
.data
.target
) {
254 return record
.data
.target
;
260 header
: gettext('Shared'),
264 renderer
: PVE
.Utils
.format_boolean
267 header
: gettext('Enabled'),
270 dataIndex
: 'disable',
271 renderer
: PVE
.Utils
.format_neg_boolean
276 itemdblclick
: run_editor
284 Ext
.define('pve-storage', {
285 extend
: 'Ext.data.Model',
287 'path', 'type', 'content', 'server', 'portal', 'target', 'export', 'storage',
288 { name
: 'shared', type
: 'boolean'},
289 { name
: 'disable', type
: 'boolean'}
291 idProperty
: 'storage'