]>
git.proxmox.com Git - proxmox-widget-toolkit.git/blob - src/window/DiskSmart.js
1 Ext
.define('Proxmox.window.DiskSmart', {
2 extend
: 'Ext.window.Window',
3 alias
: 'widget.pmxSmartWindow',
22 emptyText
: gettext('No S.M.A.R.T. Values'),
26 reserveScrollbar
: true,
34 text
: gettext('Attribute'),
37 renderer
: Ext
.String
.htmlEncode
,
40 text
: gettext('Value'),
42 renderer
: Ext
.String
.htmlEncode
,
45 text
: gettext('Normalized'),
50 text
: gettext('Threshold'),
51 dataIndex
: 'threshold',
55 text
: gettext('Worst'),
60 text
: gettext('Flags'),
64 text
: gettext('Failing'),
66 renderer
: Ext
.String
.htmlEncode
,
72 itemId
: 'smartPlainText',
77 'background-color': 'white',
79 'font-family': 'monospace',
86 text
: gettext('Reload'),
90 me
.up('window').store
.reload();
94 text
: gettext('Close'),
98 me
.up('window').close();
103 initComponent: function() {
107 throw "no baseurl specified";
110 throw "no device specified";
113 me
.title
= `${gettext('S.M.A.R.T. Values')} (${me.dev})`;
115 me
.store
= Ext
.create('Ext.data.Store', {
116 model
: 'pmx-disk-smart',
119 url
: `${me.baseurl}/smart?disk=${me.dev}`,
125 let grid
= me
.down('#smartGrid'), plainText
= me
.down('#smartPlainText');
127 Proxmox
.Utils
.monStoreErrors(grid
, me
.store
);
128 me
.mon(me
.store
, 'load', function(_store
, records
, success
) {
129 if (!success
|| records
.length
<= 0) {
130 return; // FIXME: clear displayed info?
132 let isPlainText
= records
[0].data
.type
=== 'text';
134 plainText
.setHtml(Ext
.String
.htmlEncode(records
[0].data
.text
));
136 grid
.setStore(records
[0].attributes());
138 grid
.setVisible(!isPlainText
);
139 plainText
.setVisible(isPlainText
);
145 Ext
.define('pmx-disk-smart', {
146 extend
: 'Ext.data.Model',
152 hasMany
: { model
: 'pmx-smart-attribute', name
: 'attributes' },
154 Ext
.define('pmx-smart-attribute', {
155 extend
: 'Ext.data.Model',
157 { name
: 'id', type
: 'number' }, 'name', 'value', 'worst', 'threshold', 'flags', 'fail', 'raw',