5 return L
.Class
.extend({
6 title
: _('Thermal Plugin Configuration'),
7 description
: _('The thermal plugin will monitor temperature of the system. Data is typically read from /sys/class/thermal/*/temp ( \'*\' denotes the thermal device to be read, e.g. thermal_zone1 )'),
9 addFormOptions: function(s
) {
12 o
= s
.option(form
.Flag
, 'enable', _('Enable this plugin'));
14 o
= s
.option(form
.DynamicList
, 'Device', _('Monitor device(s) / thermal zone(s)'), _('Empty value = monitor all'));
15 o
.load = function(section_id
) {
17 L
.resolveDefault(fs
.list('/sys/class/thermal'), []),
18 L
.resolveDefault(fs
.list('/proc/acpi/thermal_zone'), [])
19 ]).then(L
.bind(function(res
) {
20 var entries
= res
[0].concat(res
[1]);
22 for (var i
= 0; i
< entries
.length
; i
++)
23 if (entries
[i
].type
== 'directory' && !entries
[i
].name
.match(/^cooling_device/))
24 o
.value(entries
[i
].name
);
26 return this.super('load', [ section_id
]);
31 o
.depends('enable', '1');
33 o
= s
.option(form
.Flag
, 'IgnoreSelected', _('Monitor all except specified'));
36 o
.depends('enable', '1');
39 configSummary: function(section
) {
40 var zones
= L
.toArray(section
.Device
),
41 invert
= section
.IgnoreSelected
== '1';
45 ? _('Monitoring all thermal zones except %s')
46 : _('Monitoring thermal zones %s')
47 ).format(zones
.join(', '));
49 return _('Monitoring all thermal zones');