]>
git.proxmox.com Git - proxmox-widget-toolkit.git/blob - src/window/DiskSmart.js
ae4f3d9ed08903ee04c869d18432a663d149c064
1 Ext
.define('Proxmox.window.DiskSmart', {
2 extend
: 'Ext.window.Window',
3 alias
: 'widget.pmxSmartWindow',
15 title
: gettext('S.M.A.R.T. Values'),
23 emptyText
: gettext('No S.M.A.R.T. Values'),
27 reserveScrollbar
: true,
35 text
: gettext('Attribute'),
38 renderer
: Ext
.String
.htmlEncode
,
41 text
: gettext('Value'),
43 renderer
: Ext
.String
.htmlEncode
,
46 text
: gettext('Normalized'),
51 text
: gettext('Threshold'),
52 dataIndex
: 'threshold',
56 text
: gettext('Worst'),
61 text
: gettext('Flags'),
65 text
: gettext('Failing'),
67 renderer
: Ext
.String
.htmlEncode
,
78 'background-color': 'white',
80 'font-family': 'monospace',
87 text
: gettext('Reload'),
91 me
.up('window').store
.reload();
95 text
: gettext('Close'),
99 me
.up('window').close();
104 initComponent: function() {
108 throw "no baseurl specified";
113 throw "no device specified";
116 me
.store
= Ext
.create('Ext.data.Store', {
117 model
: 'pmx-disk-smart',
120 url
: `${me.baseurl}/smart?disk=${dev}`,
126 let grid
= me
.down('#smarts');
128 Proxmox
.Utils
.monStoreErrors(grid
, me
.store
);
129 me
.mon(me
.store
, 'load', function(s
, records
, success
) {
130 if (success
&& records
.length
> 0) {
131 let rec
= records
[0];
132 if (rec
.data
.type
=== 'text') {
133 grid
.setVisible(false);
135 me
.down('#text').setHtml(Ext
.String
.htmlEncode(rec
.data
.text
));
136 me
.down('#text').setVisible(true);
138 grid
.setVisible(true);
139 me
.down('#textContainer').setVisible(false);
140 grid
.setStore(rec
.attributes());
148 Ext
.define('pmx-disk-smart', {
149 extend
: 'Ext.data.Model',
155 hasMany
: { model
: 'pmx-smart-attribute', name
: 'attributes' },
157 Ext
.define('pmx-smart-attribute', {
158 extend
: 'Ext.data.Model',
160 { name
: 'id', type
: 'number' }, 'name', 'value', 'worst', 'threshold', 'flags', 'fail', 'raw',