]>
Commit | Line | Data |
---|---|---|
bde489e5 DC |
1 | Ext.define('Proxmox.window.ZFSDetail', { |
2 | extend: 'Ext.window.Window', | |
3 | alias: 'widget.pmxZFSDetail', | |
4 | mixins: ['Proxmox.Mixin.CBind'], | |
5 | ||
6 | cbindData: function(initialConfig) { | |
7 | let me = this; | |
8 | me.url = `/nodes/${me.nodename}/disks/zfs/${encodeURIComponent(me.zpool)}`; | |
9 | return { | |
10 | zpoolUri: `/api2/json/${me.url}`, | |
11 | title: `${gettext('Status')}: ${me.zpool}`, | |
12 | }; | |
13 | }, | |
14 | ||
15 | controller: { | |
16 | xclass: 'Ext.app.ViewController', | |
17 | ||
18 | reload: function() { | |
19 | let me = this; | |
20 | let view = me.getView(); | |
21 | me.lookup('status').reload(); | |
22 | ||
23 | Proxmox.Utils.API2Request({ | |
24 | url: `/api2/extjs/${view.url}`, | |
25 | waitMsgTarget: view, | |
26 | method: 'GET', | |
27 | failure: function(response, opts) { | |
28 | Proxmox.Utils.setErrorMask(view, response.htmlStatus); | |
29 | }, | |
30 | success: function(response, opts) { | |
31 | let devices = me.lookup('devices'); | |
32 | devices.getSelectionModel().deselectAll(); | |
33 | devices.setRootNode(response.result.data); | |
34 | devices.expandAll(); | |
35 | }, | |
36 | }); | |
37 | }, | |
38 | ||
39 | init: function(view) { | |
40 | let me = this; | |
41 | Proxmox.Utils.monStoreErrors(me, me.lookup('status').getStore().rstore); | |
42 | me.reload(); | |
43 | }, | |
44 | }, | |
45 | ||
46 | modal: true, | |
47 | width: 800, | |
48 | height: 400, | |
49 | resizable: true, | |
50 | cbind: { | |
51 | title: '{title}', | |
52 | }, | |
53 | ||
54 | layout: { | |
55 | type: 'vbox', | |
56 | align: 'stretch', | |
57 | }, | |
58 | defaults: { | |
59 | layout: 'fit', | |
60 | border: false, | |
61 | }, | |
62 | ||
63 | tbar: [ | |
64 | { | |
65 | text: gettext('Reload'), | |
66 | iconCls: 'fa fa-refresh', | |
67 | handler: 'reload', | |
68 | }, | |
69 | ], | |
70 | ||
71 | items: [ | |
72 | { | |
73 | xtype: 'proxmoxObjectGrid', | |
74 | reference: 'status', | |
75 | flex: 0, | |
76 | cbind: { | |
77 | url: '{zpoolUri}', | |
78 | nodename: '{nodename}', | |
79 | }, | |
80 | rows: { | |
81 | scan: { | |
82 | header: gettext('Scan'), | |
83 | }, | |
84 | status: { | |
85 | header: gettext('Status'), | |
86 | }, | |
87 | action: { | |
88 | header: gettext('Action'), | |
89 | }, | |
90 | errors: { | |
91 | header: gettext('Errors'), | |
92 | }, | |
93 | }, | |
94 | }, | |
95 | { | |
96 | xtype: 'treepanel', | |
97 | reference: 'devices', | |
98 | title: gettext('Devices'), | |
99 | stateful: true, | |
100 | stateId: 'grid-node-zfsstatus', | |
101 | rootVisible: true, | |
102 | fields: ['name', 'status', | |
103 | { | |
104 | type: 'string', | |
105 | name: 'iconCls', | |
106 | calculate: function(data) { | |
107 | var txt = 'fa x-fa-tree fa-'; | |
108 | if (data.leaf) { | |
109 | return txt + 'hdd-o'; | |
110 | } | |
111 | return undefined; | |
112 | }, | |
113 | }, | |
114 | ], | |
115 | sorters: 'name', | |
116 | flex: 1, | |
117 | cbind: { | |
118 | zpool: '{zpoolUri}', | |
119 | nodename: '{nodename}', | |
120 | }, | |
121 | columns: [ | |
122 | { | |
123 | xtype: 'treecolumn', | |
124 | text: gettext('Name'), | |
125 | dataIndex: 'name', | |
126 | flex: 1, | |
127 | }, | |
128 | { | |
129 | text: gettext('Health'), | |
130 | renderer: Proxmox.Utils.render_zfs_health, | |
131 | dataIndex: 'state', | |
132 | }, | |
133 | { | |
134 | text: 'READ', | |
135 | dataIndex: 'read', | |
136 | }, | |
137 | { | |
138 | text: 'WRITE', | |
139 | dataIndex: 'write', | |
140 | }, | |
141 | { | |
142 | text: 'CKSUM', | |
143 | dataIndex: 'cksum', | |
144 | }, | |
145 | { | |
146 | text: gettext('Message'), | |
147 | dataIndex: 'msg', | |
148 | }, | |
149 | ], | |
150 | }, | |
151 | ], | |
152 | }); |