]>
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, | |
a18a674d | 48 | height: 600, |
bde489e5 DC |
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: { | |
79580cd0 FE |
81 | state: { |
82 | header: gettext('Health'), | |
83 | renderer: Proxmox.Utils.render_zfs_health, | |
84 | }, | |
bde489e5 DC |
85 | scan: { |
86 | header: gettext('Scan'), | |
87 | }, | |
88 | status: { | |
89 | header: gettext('Status'), | |
90 | }, | |
91 | action: { | |
92 | header: gettext('Action'), | |
93 | }, | |
94 | errors: { | |
95 | header: gettext('Errors'), | |
96 | }, | |
97 | }, | |
98 | }, | |
99 | { | |
100 | xtype: 'treepanel', | |
101 | reference: 'devices', | |
102 | title: gettext('Devices'), | |
103 | stateful: true, | |
104 | stateId: 'grid-node-zfsstatus', | |
79580cd0 FE |
105 | // the root is the pool itself and the information is shown by the grid |
106 | rootVisible: false, | |
bde489e5 DC |
107 | fields: ['name', 'status', |
108 | { | |
109 | type: 'string', | |
110 | name: 'iconCls', | |
111 | calculate: function(data) { | |
112 | var txt = 'fa x-fa-tree fa-'; | |
113 | if (data.leaf) { | |
114 | return txt + 'hdd-o'; | |
115 | } | |
116 | return undefined; | |
117 | }, | |
118 | }, | |
119 | ], | |
120 | sorters: 'name', | |
121 | flex: 1, | |
122 | cbind: { | |
123 | zpool: '{zpoolUri}', | |
124 | nodename: '{nodename}', | |
125 | }, | |
126 | columns: [ | |
127 | { | |
128 | xtype: 'treecolumn', | |
129 | text: gettext('Name'), | |
130 | dataIndex: 'name', | |
131 | flex: 1, | |
132 | }, | |
133 | { | |
134 | text: gettext('Health'), | |
135 | renderer: Proxmox.Utils.render_zfs_health, | |
136 | dataIndex: 'state', | |
137 | }, | |
138 | { | |
139 | text: 'READ', | |
140 | dataIndex: 'read', | |
141 | }, | |
142 | { | |
143 | text: 'WRITE', | |
144 | dataIndex: 'write', | |
145 | }, | |
146 | { | |
147 | text: 'CKSUM', | |
148 | dataIndex: 'cksum', | |
149 | }, | |
150 | { | |
151 | text: gettext('Message'), | |
152 | dataIndex: 'msg', | |
153 | }, | |
154 | ], | |
155 | }, | |
156 | ], | |
157 | }); |