]>
git.proxmox.com Git - proxmox-widget-toolkit.git/blob - src/window/DiskSmart.js
0145157291ed808998ff90394406934fbc90e710
1 Ext
.define('Proxmox.window.DiskSmart', {
2 extend
: 'Ext.window.Window',
3 alias
: 'widget.pmxSmartWindow',
16 title
: gettext('S.M.A.R.T. Values'),
24 emptyText
: gettext('No S.M.A.R.T. Values'),
28 reserveScrollbar
: true,
36 text
: gettext('Attribute'),
39 renderer
: Ext
.String
.htmlEncode
,
42 text
: gettext('Value'),
44 renderer
: Ext
.String
.htmlEncode
,
47 text
: gettext('Normalized'),
52 text
: gettext('Threshold'),
53 dataIndex
: 'threshold',
57 text
: gettext('Worst'),
62 text
: gettext('Flags'),
66 text
: gettext('Failing'),
68 renderer
: Ext
.String
.htmlEncode
,
80 'background-color': 'white',
82 'font-family': 'monospace',
89 text
: gettext('Reload'),
93 me
.up('window').store
.reload();
97 text
: gettext('Close'),
101 me
.up('window').close();
106 initComponent: function() {
110 throw "no baseurl specified";
115 throw "no device specified";
118 me
.store
= Ext
.create('Ext.data.Store', {
119 model
: 'pmx-disk-smart',
122 url
: `${me.baseurl}/smart?disk=${dev}`,
128 let grid
= me
.down('#smarts');
130 Proxmox
.Utils
.monStoreErrors(grid
, me
.store
);
131 me
.mon(me
.store
, 'load', function(s
, records
, success
) {
132 if (success
&& records
.length
> 0) {
133 let rec
= records
[0];
134 if (rec
.data
.type
=== 'text') {
135 grid
.setVisible(false);
137 me
.down('#text').setHtml(Ext
.String
.htmlEncode(rec
.data
.text
));
138 me
.down('#text').setVisible(true);
140 grid
.setVisible(true);
141 me
.down('#textContainer').setVisible(false);
142 grid
.setStore(rec
.attributes());
150 Ext
.define('pmx-disk-smart', {
151 extend
: 'Ext.data.Model',
157 hasMany
: { model
: 'pmx-smart-attribute', name
: 'attributes' },
159 Ext
.define('pmx-smart-attribute', {
160 extend
: 'Ext.data.Model',
162 { name
: 'id', type
: 'number' }, 'name', 'value', 'worst', 'threshold', 'flags', 'fail', 'raw',