]>
Commit | Line | Data |
---|---|---|
6b3ce31b | 1 | // require("js/omv/tree/Panel.js") |
3415404c | 2 | // require("js/omv/module/admin/storage/zfs/TreePanel.js") |
6b3ce31b | 3 | // require("js/omv/workspace/window/Grid.js") |
42856e8b NB |
4 | // require("js/omv/form/field/CheckboxGrid.js") |
5 | ||
54b9d43e NB |
6 | Ext.define("OMV.module.admin.storage.zfs.ShowDetails", { |
7 | extend: "OMV.workspace.window.Form", | |
8 | requires: [ | |
9 | "OMV.data.Store", | |
10 | "OMV.data.Model", | |
11 | "OMV.data.proxy.Rpc", | |
12 | ], | |
13 | ||
14 | rpcService: "ZFS", | |
15 | title: _("Object details"), | |
16 | autoLoadData: true, | |
17 | hideResetButton: true, | |
18 | hideCancelButton: true, | |
19 | width: 550, | |
20 | height: 350, | |
21 | layout: 'fit', | |
22 | okButtonText: _("Ok"), | |
23 | ||
24 | getFormItems: function() { | |
25 | var me = this; | |
26 | ||
27 | return [{ | |
28 | xtype: "textareafield", | |
29 | name: "details", | |
30 | grow: true, | |
31 | anchor: '100%', | |
32 | readOnly: true | |
33 | }]; | |
34 | ||
35 | } | |
36 | }); | |
37 | ||
42856e8b NB |
38 | Ext.define("OMV.module.admin.storage.zfs.AddPool", { |
39 | extend: "OMV.workspace.window.Form", | |
40 | requires: [ | |
41 | "OMV.data.Store", | |
42 | "OMV.data.Model", | |
43 | "OMV.data.proxy.Rpc", | |
44 | "OMV.form.field.CheckboxGrid" | |
45 | ], | |
46 | ||
47 | rpcService: "ZFS", | |
48 | rpcSetMethod: "addPool", | |
49 | title: _("Create ZFS pool"), | |
50 | autoLoadData: false, | |
51 | hideResetButton: true, | |
52 | width: 550, | |
7d6b772c | 53 | height: 350, |
42856e8b NB |
54 | |
55 | getFormItems: function() { | |
56 | var me = this; | |
57 | return [{ | |
58 | xtype: "textfield", | |
59 | name: "name", | |
60 | fieldLabel: _("Name") | |
61 | },{ | |
62 | xtype: "combo", | |
63 | name: "pooltype", | |
64 | fieldLabel: _("Pool type"), | |
65 | queryMode: "local", | |
66 | store: Ext.create("Ext.data.ArrayStore", { | |
67 | fields: [ "value", "text" ], | |
68 | data: [ | |
69 | [ "basic", _("Basic") ], | |
70 | [ "mirror", _("Mirror") ], | |
71 | [ "raidz1", _("RAID-Z1") ], | |
72 | [ "raidz2", _("RAID-Z2") ], | |
73 | [ "raidz3", _("RAID-Z3") ] | |
74 | ] | |
75 | }), | |
76 | displayField: "text", | |
77 | valueField: "value", | |
78 | allowBlank: false, | |
79 | editable: false, | |
80 | triggerAction: "all", | |
81 | value: "raidz1", | |
82 | listeners: { | |
83 | scope: me, | |
84 | change: function(combo, value) { | |
85 | var devicesField = this.findField("devices"); | |
86 | switch(value) { | |
7d6b772c NB |
87 | case "basic": |
88 | devicesField.minSelections = 1; | |
42856e8b | 89 | break; |
7d6b772c NB |
90 | case "mirror": |
91 | devicesField.minSelections = 2; | |
42856e8b | 92 | break; |
7d6b772c NB |
93 | case "raidz1": |
94 | devicesField.minSelections = 3; | |
42856e8b | 95 | break; |
7d6b772c NB |
96 | case "raidz2": |
97 | devicesField.minSelections = 4; | |
98 | case "raidz3": | |
99 | devicesField.minSelections = 5; | |
100 | break; | |
101 | default: | |
102 | devicesField.minSelections = 2; | |
42856e8b NB |
103 | break; |
104 | } | |
105 | devicesField.validate(); | |
106 | } | |
107 | } | |
108 | },{ | |
109 | xtype: "checkboxgridfield", | |
110 | name: "devices", | |
111 | fieldLabel: _("Devices"), | |
112 | valueField: "devicefile", | |
113 | minSelections: 3, // Min. number of devices for RAIDZ-1 | |
114 | useStringValue: true, | |
115 | height: 130, | |
116 | store: Ext.create("OMV.data.Store", { | |
117 | autoLoad: true, | |
118 | model: OMV.data.Model.createImplicit({ | |
119 | idProperty: "devicefile", | |
120 | fields: [ | |
121 | { name: "devicefile", type: "string" }, | |
122 | { name: "size", type: "string" }, | |
123 | { name: "vendor", type: "string" }, | |
124 | { name: "serialnumber", type: "string" } | |
125 | ] | |
126 | }), | |
127 | proxy: { | |
128 | type: "rpc", | |
129 | appendSortParams: false, | |
130 | rpcData: { | |
131 | service: "RaidMgmt", | |
132 | method: "getCandidates" | |
133 | } | |
134 | }, | |
135 | sorters: [{ | |
136 | direction: "ASC", | |
137 | property: "devicefile" | |
138 | }] | |
139 | }), | |
140 | gridConfig: { | |
141 | stateful: true, | |
142 | stateId: "1866b5d0-327e-11e4-8c21-0800200c9a66", | |
143 | columns: [{ | |
144 | text: _("Device"), | |
145 | sortable: true, | |
146 | dataIndex: "devicefile", | |
147 | stateId: "devicefile", | |
148 | flex: 1 | |
149 | },{ | |
150 | xtype: "binaryunitcolumn", | |
151 | text: _("Capacity"), | |
152 | sortable: true, | |
153 | dataIndex: "size", | |
154 | stateId: "size", | |
155 | width: 50, | |
156 | flex: 1 | |
157 | },{ | |
158 | text: _("Vendor"), | |
159 | sortable: true, | |
160 | dataIndex: "vendor", | |
161 | stateId: "vendor", | |
162 | flex: 1 | |
163 | },{ | |
164 | text: _("Serial Number"), | |
165 | sortable: true, | |
166 | dataIndex: "serialnumber", | |
167 | stateId: "serialnumber", | |
168 | flex: 1 | |
169 | }] | |
170 | } | |
c6117b32 NB |
171 | },{ |
172 | xtype: "textfield", | |
173 | name: "mountpoint", | |
174 | fieldLabel: _("Mountpoint"), | |
175 | plugins: [{ | |
176 | ptype: "fieldinfo", | |
177 | text: _("Optional mountpoint for the pool. Default is to use pool name.") | |
178 | }] | |
7d6b772c NB |
179 | },{ |
180 | xtype: "checkbox", | |
181 | name: "force", | |
182 | fieldLabel: _("Force creation"), | |
183 | checked: false, | |
cc1caa78 NB |
184 | plugins: [{ |
185 | ptype: "fieldinfo", | |
186 | text: _("Forces the creation of the pool even if errors are reported. Use with extreme caution!") | |
187 | }] | |
42856e8b NB |
188 | }]; |
189 | }, | |
190 | ||
191 | doSubmit: function() { | |
192 | var me = this; | |
193 | OMV.MessageBox.show({ | |
194 | title: _("Confirmation"), | |
195 | msg: _("Do you really want to create the ZFS pool?"), | |
196 | buttons: Ext.Msg.YESNO, | |
197 | fn: function(answer) { | |
198 | if(answer === "no") | |
199 | return; | |
200 | me.superclass.doSubmit.call(me); | |
201 | }, | |
202 | scope: me, | |
203 | icon: Ext.Msg.QUESTION | |
204 | }); | |
205 | } | |
206 | }); | |
6b3ce31b | 207 | |
3415404c | 208 | Ext.define("OMV.module.admin.storage.zfs.AddObject", { |
6b3ce31b MR |
209 | extend: "OMV.workspace.window.Form", |
210 | uses: [ | |
211 | "OMV.data.Store", | |
212 | "OMV.data.Model", | |
213 | "OMV.data.proxy.Rpc", | |
214 | "OMV.data.reader.RpcArray" | |
215 | ], | |
216 | ||
217 | rpcService: "ZFS", | |
218 | rpcSetMethod: "addObject", | |
219 | width: 420, | |
220 | ||
221 | getFormItems: function() { | |
222 | var me = this; | |
223 | return [{ | |
224 | xtype: "combo", | |
225 | name: "type", | |
226 | fieldLabel: _("Object Type"), | |
227 | queryMode: "local", | |
228 | store: [ | |
229 | [ "filesystem", "Filesystem" ], | |
230 | [ "snapshot", "Snapshot" ], | |
231 | [ "volume", "Volume" ] | |
232 | ], | |
233 | allowBlank: true, | |
234 | editable: false, | |
235 | triggerAction: "all", | |
236 | value: "filesystem", | |
237 | listeners: { | |
238 | scope: me, | |
239 | change: function(combo, value) { | |
240 | var sizeField = this.findField("size"); | |
241 | switch(value) { | |
242 | case "volume": | |
243 | sizeField.show(); | |
244 | sizeField.allowBlank = false; | |
245 | break; | |
246 | default: | |
247 | sizeField.hide(); | |
248 | sizeField.allowBlank = true; | |
249 | break; | |
250 | } | |
251 | sizeField.validate(); | |
252 | } | |
253 | } | |
254 | },{ | |
255 | xtype: "textfield", | |
256 | name: "path", | |
257 | fieldLabel: _("Prefix"), | |
258 | allowBlank: false, | |
259 | readOnly: true | |
260 | },{ | |
261 | xtype: "textfield", | |
262 | name: "name", | |
263 | fieldLabel: _("Name"), | |
264 | allowBlank: false, | |
265 | plugins: [{ | |
266 | ptype: "fieldinfo", | |
267 | text: _("Name of the new object. Prefix will prepend the name. Please omit leading /") | |
268 | }] | |
269 | },{ | |
270 | xtype: "textfield", | |
271 | name: "size", | |
272 | hidden: true, | |
273 | fieldLabel: _("Size"), | |
274 | allowBlank: true, | |
275 | plugins: [{ | |
276 | ptype: "fieldinfo", | |
277 | text: _("Size of the volume e.g. 5mb,100gb,1tb etc") | |
278 | }] | |
279 | }]; | |
280 | } | |
281 | }); | |
282 | ||
283 | ||
284 | ||
3415404c | 285 | Ext.define("OMV.module.admin.storage.zfs.EditProperties", { |
6b3ce31b MR |
286 | extend: "OMV.workspace.window.Grid", |
287 | requires: [ | |
288 | "OMV.data.Store", | |
289 | "OMV.data.Model", | |
290 | "OMV.data.proxy.Rpc" | |
291 | ], | |
292 | ||
293 | rpcService: "ZFS", | |
294 | rpcSetMethod: "setProperties", | |
295 | ||
296 | title: _("Edit properties"), | |
297 | width: 500, | |
298 | height: 305, | |
299 | ||
300 | getGridConfig: function() { | |
301 | var me = this; | |
302 | ||
303 | var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { | |
304 | clicksToEdit: 1, | |
305 | pluginId: 'rowEditing', | |
306 | listeners: { | |
307 | validateedit: function(editor, e, eOpts) { | |
308 | e.record.set("modified", "true"); | |
309 | }, | |
310 | beforeedit: function(editor, e, eOpts) { | |
cc1caa78 | 311 | if (e.record.get("newproperty") === "false") { |
6b3ce31b MR |
312 | e.grid.getPlugin('rowEditing').editor.form.findField("value").enable(); |
313 | e.grid.getPlugin('rowEditing').editor.form.findField("property").disable(); | |
314 | } else { | |
315 | e.grid.getPlugin('rowEditing').editor.form.findField("value").enable(); | |
316 | e.grid.getPlugin('rowEditing').editor.form.findField("property").enable(); | |
317 | } | |
318 | } | |
319 | ||
320 | } | |
321 | }); | |
322 | ||
323 | var store = Ext.create("OMV.data.Store", { | |
324 | autoLoad: true, | |
325 | model: OMV.data.Model.createImplicit({ | |
326 | fields: [ | |
327 | { name: "property", type: "string" }, | |
328 | { name: "value", type: "string" }, | |
329 | { name: "source", type: "string" }, | |
330 | { name: "modified", type: "string" }, | |
331 | { name: "newproperty", type: "string", defaultValue: "false" } | |
332 | ] | |
333 | }), | |
334 | proxy: { | |
335 | type: "rpc", | |
336 | rpcData: { | |
337 | service: "ZFS", | |
338 | method: "getProperties", | |
339 | params: { | |
340 | name: me.name, | |
341 | type: me.type | |
342 | } | |
343 | } | |
344 | } | |
345 | }); | |
346 | ||
347 | return { | |
348 | border: false, | |
349 | stateful: true, | |
350 | stateId: "8c3dc800-bdbb-11e3-b1b6-0800200c9a66", | |
351 | selType: 'rowmodel', | |
352 | plugins: [rowEditing], | |
353 | store: store, | |
354 | tbar: [{ | |
355 | text: "Add property", | |
356 | icon: "images/add.png", | |
357 | iconCls: Ext.baseCSSPrefix + "btn-icon-16x16", | |
358 | handler: function(view) { | |
359 | Ext.define('Property', { | |
360 | extend: 'Ext.data.Model', | |
361 | fields: [ | |
362 | "property", | |
363 | "value", | |
364 | "source", | |
365 | "modified", | |
366 | "newproperty" | |
367 | ] | |
368 | }); | |
369 | var newProperty = Ext.create("Property", { | |
370 | property: "", | |
371 | value: "", | |
372 | source: "local", | |
373 | modified: "true", | |
38408c3f | 374 | newproperty: "true" |
6b3ce31b MR |
375 | }); |
376 | rowEditing.cancelEdit(); | |
377 | store.insert(0, newProperty); | |
378 | rowEditing.startEdit(); | |
379 | } | |
380 | }], | |
381 | columns: [{ | |
382 | text: _("Property"), | |
383 | sortable: true, | |
384 | dataIndex: "property", | |
385 | stateId: "property", | |
386 | editor: { | |
387 | xtype: "textfield", | |
388 | allowBlank: false, | |
389 | } | |
390 | },{ | |
391 | text: _("Value"), | |
392 | sortable: true, | |
393 | dataIndex: "value", | |
394 | stateId: "value", | |
395 | flex: 1, | |
396 | readOnly: true, | |
397 | editor: { | |
398 | xtype: "textfield", | |
399 | allowBlank: false, | |
400 | } | |
401 | },{ | |
402 | text: _("Source"), | |
403 | sortable: true, | |
404 | dataIndex: "source", | |
405 | stateId: "source", | |
406 | },{ | |
407 | xtype: 'actioncolumn', | |
408 | header: 'Inherit', | |
409 | icon: "images/checkmark.png", | |
410 | tooltip: "Inherit", | |
411 | handler: function(view, rowIndex, colIndex, item, e, record, row) { | |
412 | OMV.RpcObserver.request({ | |
413 | msg : _("Updating property..."), | |
414 | rpcData : { | |
415 | service: "ZFS", | |
416 | method: "inherit", | |
417 | params: { | |
418 | name: me.name, | |
419 | type: me.type, | |
420 | property: record.get("property") | |
421 | } | |
422 | }, | |
423 | finish : function() { | |
424 | view.getStore().reload(); | |
425 | } | |
426 | }); | |
427 | }, | |
428 | isDisabled: function(view, rowIdx, colIdx, item, record) { | |
429 | var src = record.get("source"); | |
430 | if(src === "local") { | |
431 | return false; | |
432 | } else { | |
433 | return true; | |
434 | } | |
435 | } | |
436 | },{ | |
437 | text: _("New"), | |
438 | dataIndex: "newproperty", | |
439 | stateId: "newproperty", | |
440 | sortable: false, | |
441 | hidden: true | |
38408c3f | 442 | },{ |
6b3ce31b MR |
443 | text: _("Modified"), |
444 | sortable: false, | |
445 | dataIndex: "modified", | |
446 | stateId: "modified", | |
447 | hidden: true | |
448 | }], | |
449 | }; | |
450 | }, | |
451 | ||
452 | getRpcSetParams: function() { | |
453 | var me = this; | |
454 | var properties = []; | |
455 | var values = me.getValues(); | |
456 | Ext.Array.each(values, function(value) { | |
457 | if(value.modified === "false") | |
38408c3f | 458 | return; |
6b3ce31b MR |
459 | properties.push({ |
460 | "property": value.property, | |
461 | "value": value.value, | |
462 | }); | |
463 | }); | |
464 | return { | |
465 | name: me.name, | |
466 | type: me.type, | |
467 | properties: properties | |
468 | }; | |
469 | } | |
470 | ||
471 | }); | |
472 | ||
473 | ||
3415404c | 474 | Ext.define("OMV.module.admin.storage.zfs.CreateShare", { |
6b3ce31b MR |
475 | extend: "OMV.workspace.window.Form", |
476 | uses: [ | |
477 | "OMV.data.Store", | |
478 | "OMV.data.Model", | |
479 | "OMV.data.proxy.Rpc", | |
480 | "OMV.data.reader.RpcArray" | |
481 | ], | |
482 | ||
483 | rpcService: "ZFS", | |
484 | rpcSetMethod: "createShare", | |
485 | width: 500, | |
486 | ||
487 | getFormItems: function() { | |
488 | var me = this; | |
489 | return [{ | |
490 | xtype: "textfield", | |
491 | name: "sharename", | |
492 | fieldLabel: _("Name"), | |
493 | allowBlank: false, | |
494 | },{ | |
495 | xtype: "textfield", | |
496 | name: "mountpoint", | |
497 | fieldLabel: _("Path"), | |
cc1caa78 NB |
498 | allowBlank: true, |
499 | readOnly: false | |
6b3ce31b MR |
500 | },{ |
501 | xtype: "combo", | |
502 | name: "mode", | |
503 | fieldLabel: _("Permissions"), | |
504 | queryMode: "local", | |
505 | store: Ext.create("Ext.data.ArrayStore", { | |
506 | fields: [ "value", "text" ], | |
507 | data: [ | |
508 | [ "700", _("Administrator: read/write, Users: no access, Others: no access") ], | |
509 | [ "750", _("Administrator: read/write, Users: read-only, Others: no access") ], | |
510 | [ "770", _("Administrator: read/write, Users: read/write, Others: no access") ], | |
511 | [ "755", _("Administrator: read/write, Users: read-only, Others: read-only") ], | |
512 | [ "775", _("Administrator: read/write, Users: read/write, Others: read-only") ], | |
513 | [ "777", _("Everyone: read/write") ] | |
514 | ] | |
515 | }), | |
516 | displayField: "text", | |
517 | valueField: "value", | |
518 | allowBlank: false, | |
519 | editable: false, | |
520 | showItemTooltip: true, | |
521 | triggerAction: "all", | |
522 | value: "775", | |
523 | plugins: [{ | |
524 | ptype: "fieldinfo", | |
525 | text: _("The file mode of the shared folder path.") | |
526 | }] | |
527 | },{ | |
528 | xtype: "textarea", | |
529 | name: "comment", | |
530 | fieldLabel: _("Comment"), | |
531 | allowBlank: true | |
532 | },{ | |
533 | xtype: "textarea", | |
534 | name: "name", | |
535 | hidden: true | |
536 | },{ | |
537 | xtype: "textarea", | |
538 | name: "type", | |
539 | hidden: true | |
540 | }]; | |
541 | } | |
542 | }); | |
543 | ||
544 | ||
545 | ||
38408c3f MR |
546 | Ext.define("OMV.module.admin.storage.zfs.Overview", { |
547 | extend: "OMV.module.admin.storage.zfs.TreePanel", | |
6b3ce31b MR |
548 | |
549 | rpcService: "ZFS", | |
550 | rpcGetMethod: "getObjectTree", | |
551 | requires: [ | |
552 | "OMV.data.Store", | |
553 | "OMV.data.Model", | |
554 | "OMV.data.proxy.Rpc" | |
555 | ], | |
556 | ||
557 | rootVisible: false, | |
558 | stateful: true, | |
559 | stateId: "cec54550-bc2a-11e3-a5e2-0800200c9a66", | |
560 | ||
561 | columns: [{ | |
562 | text: _("Name"), | |
563 | xtype: 'treecolumn', | |
564 | dataIndex: 'name', | |
565 | sortable: true, | |
566 | flex: 2, | |
567 | stateId: 'name' | |
568 | },{ | |
569 | text: _("Type"), | |
570 | dataIndex: 'type', | |
571 | sortable: true, | |
572 | flex: 1, | |
573 | stateId: 'type' | |
54b9d43e NB |
574 | },{ |
575 | text: _("Size"), | |
576 | dataIndex: 'size', | |
577 | sortable: true, | |
578 | flex: 1, | |
579 | stateId: 'size' | |
580 | },{ | |
581 | text: _("Used"), | |
582 | dataIndex: 'used', | |
583 | sortable: true, | |
584 | flex: 1, | |
585 | stateId: 'used' | |
586 | },{ | |
587 | text: _("Available"), | |
588 | dataIndex: 'available', | |
589 | sortable: true, | |
590 | flex: 1, | |
591 | stateId: 'available' | |
592 | },{ | |
593 | text: _("Mountpoint"), | |
594 | dataIndex: 'mountpoint', | |
595 | sortable: true, | |
596 | flex: 1, | |
597 | stateId: 'mountpoint' | |
6b3ce31b MR |
598 | },{ |
599 | text: _("Share"), | |
600 | xtype: 'actioncolumn', | |
601 | tooltip: 'Create shared folder', | |
602 | align: 'center', | |
603 | icon: 'images/checkmark.png', | |
604 | handler: function(view, rowIndex, colIndex, item, e, record, row) { | |
605 | var me = this; | |
38408c3f | 606 | Ext.create("OMV.module.admin.storage.zfs.CreateShare", { |
6b3ce31b MR |
607 | title: _("Create shared folder"), |
608 | rpcGetMethod: "getSharedParams", | |
609 | rpcGetParams: { | |
610 | name: record.get('path'), | |
611 | type: record.get('type') | |
612 | } | |
613 | }).show(); | |
614 | }, | |
615 | isDisabled: function(view, rowIdx, colIdx, item, record) { | |
616 | var src = record.get("type"); | |
617 | if((src === "Filesystem") && (record.get("shared") === "false")) { | |
618 | return false; | |
619 | } else { | |
620 | return true; | |
621 | } | |
622 | } | |
6b3ce31b MR |
623 | },{ |
624 | text: _("Details"), | |
625 | xtype: 'actioncolumn', | |
626 | tooltip: 'Details', | |
627 | align: 'center', | |
54b9d43e NB |
628 | icon: 'images/search.png', |
629 | handler: function(view, rowIndex, colIndex, item, e, record, row) { | |
630 | var me = this; | |
631 | Ext.create("OMV.module.admin.storage.zfs.ShowDetails", { | |
632 | title: _("Object details"), | |
633 | rpcGetMethod: "getObjectDetails", | |
634 | rpcGetParams: { | |
635 | name: record.get('path'), | |
636 | type: record.get('type') | |
637 | } | |
638 | }).show(); | |
639 | } | |
6b3ce31b MR |
640 | },{ |
641 | text: _("Shared"), | |
642 | dataIndex: 'shared', | |
643 | sortable: false, | |
644 | stateId: 'shared', | |
645 | hidden: true | |
646 | }], | |
647 | ||
648 | initComponent: function() { | |
649 | var me = this; | |
650 | this.width = 600; | |
651 | Ext.apply(me, { | |
652 | store: Ext.create("Ext.data.TreeStore", { | |
653 | autoLoad: true, | |
654 | model: OMV.data.Model.createImplicit({ | |
655 | fields: [ | |
656 | { name: "name", type: "string" }, | |
657 | { name: "type", type: "string" }, | |
54b9d43e NB |
658 | { name: "size", type: "string" }, |
659 | { name: "used", type: "string" }, | |
660 | { name: "available", type: "string" }, | |
661 | { name: "mountpoint", type: "string" }, | |
6b3ce31b MR |
662 | { name: "id", type: "string" }, |
663 | { name: "path", type: "string" }, | |
664 | { name: "origin", type: "string", defaultValue: "none" }, | |
665 | { name: "shared", type: "string", defaultValue: "false" } | |
666 | ] | |
667 | }), | |
668 | proxy: { | |
669 | type: "rpc", | |
670 | rpcData: { | |
671 | service: "ZFS", | |
672 | method: "getObjectTree", | |
673 | } | |
674 | }, | |
675 | folderSort: true | |
676 | }) | |
677 | }); | |
678 | me.callParent(arguments); | |
679 | }, | |
680 | ||
7d6b772c | 681 | onAddButton: function() { |
42856e8b NB |
682 | var me = this; |
683 | Ext.create("OMV.module.admin.storage.zfs.AddPool", { | |
684 | listeners: { | |
685 | scope: me, | |
686 | submit: function() { | |
687 | this.doReload(); | |
688 | } | |
689 | } | |
690 | }).show(); | |
691 | }, | |
692 | ||
6b3ce31b MR |
693 | onAddObjButton: function() { |
694 | var me = this; | |
695 | var sm = me.getSelectionModel(); | |
696 | var records = sm.getSelection(); | |
38408c3f MR |
697 | var record = records[0]; |
698 | Ext.create("OMV.module.admin.storage.zfs.AddObject", { | |
6b3ce31b MR |
699 | title: _("Add Object"), |
700 | rpcGetMethod: "passParam", | |
701 | rpcGetParams: { | |
702 | key: "path", | |
703 | value: record.get('path') | |
704 | }, | |
705 | listeners: { | |
706 | scope: me, | |
707 | submit: function() { | |
708 | this.doReload(); | |
709 | } | |
710 | } | |
711 | }).show(); | |
712 | }, | |
713 | ||
714 | onEditButton: function() { | |
715 | var me = this; | |
716 | var sm = me.getSelectionModel(); | |
717 | var records = sm.getSelection(); | |
718 | var record = records[0]; | |
38408c3f | 719 | Ext.create("OMV.module.admin.storage.zfs.EditProperties", { |
6b3ce31b MR |
720 | name: record.get("path"), |
721 | type: record.get("type") | |
722 | }).show(); | |
723 | }, | |
724 | ||
725 | doDeletion: function(record) { | |
726 | var me = this; | |
727 | OMV.Rpc.request({ | |
728 | scope: me, | |
729 | callback: me.onDeletion, | |
730 | rpcData: { | |
731 | service: "ZFS", | |
732 | method: "deleteObject", | |
733 | params: { | |
734 | name: record.get('path'), | |
735 | type: record.get('type') | |
736 | } | |
737 | } | |
738 | }); | |
739 | } | |
740 | ||
741 | }); | |
742 | ||
743 | OMV.WorkspaceManager.registerPanel({ | |
744 | id: "overview", | |
38408c3f | 745 | path: "/storage/zfs", |
6b3ce31b MR |
746 | text: _("Overview"), |
747 | position: 10, | |
38408c3f | 748 | className: "OMV.module.admin.storage.zfs.Overview" |
6b3ce31b MR |
749 | }); |
750 | ||
751 | ||
752 |