diff options
Diffstat (limited to 'applications/luci-app-hd-idle/htdocs/luci-static')
-rw-r--r-- | applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js b/applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js new file mode 100644 index 0000000000..f510229523 --- /dev/null +++ b/applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js @@ -0,0 +1,44 @@ +'use strict'; +'require form'; +'require fs'; +'require view'; + +return view.extend({ + load: function() { + return fs.list('/dev').then(function(devs) { + return devs.filter(function(dev) { + return dev.type == 'block' ? dev.name.match(/^[sh]d[a-z]$/) : false; + }); + }); + }, + + render: function(devs) { + var m, s, o; + m = new form.Map('hd-idle', _('HDD Idle'), _('HDD Idle is a utility program for spinning-down external disks after a period of idle time.')); + + s = m.section(form.TypedSection, 'hd-idle', _('Settings')); + s.anonymous = true; + s.addremove = true; + s.addbtntitle = _('Add new hdd setting...'); + + o = s.option(form.Flag, 'enabled', _('Enable')); + o.rmempty = false; + + o = s.option(form.Value, 'disk', _('Disk')); + devs.forEach(function(dev) { + o.value(dev.name); + }); + + o = s.option(form.Value, 'idle_time_interval', _('Idle time')); + o.default = 10; + + o = s.option(form.ListValue, 'idle_time_unit', _('Idle time unit')); + o.value('seconds', _('s', 'Abbreviation for seconds')); + o.value('minutes', _('min', 'Abbreviation for minutes')); + o.value('hours', _('h', 'Abbreviation for hours')); + o.value('days', _('d', 'Abbreviation for days')); + o.default = 'minutes'; + + return m.render(); + } +}); |