6 return baseclass
.extend({
7 title
: _('Disk Plugin Configuration'),
8 description
: _('The disk plugin collects detailed usage statistics for selected partitions or whole disks.'),
10 addFormOptions: function(s
) {
13 o
= s
.option(form
.Flag
, 'enable', _('Enable this plugin'));
15 o
= s
.option(form
.DynamicList
, 'Disks', _('Monitor disks and partitions'),
16 _('When none selected, all disks will be monitored.'));
17 o
.depends('enable', '1');
18 o
.load = function(section_id
) {
19 return fs
.trimmed('/proc/partitions').then(L
.bind(function(str
) {
20 var lines
= (str
|| '').split(/\n/);
22 for (var i
= 0; i
< lines
.length
; i
++) {
23 var m
= lines
[i
].match(/^ +[0-9]+ +[0-9]+ +[0-9]+ (\S+)$/);
28 return this.super('load', [section_id
]);
32 o
= s
.option(form
.Flag
, 'IgnoreSelected', _('Monitor all except specified'));
33 o
.depends('enable', '1');
36 configSummary: function(section
) {
37 var disks
= L
.toArray(section
.Disks
),
38 invert
= section
.IgnoreSelected
== '1';
40 if (disks
.length
== 0)
41 return _('Monitoring all disks');
43 return N_(disks
.length
, 'Monitoring all but one disk', 'Monitoring all but %d disks').format(disks
.length
);
45 return N_(disks
.length
, 'Monitoring one disk', 'Monitoring %d disks').format(disks
.length
);