summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-hd-idle/htdocs/luci-static
diff options
context:
space:
mode:
authorVan Waholtz <vanwaholtz@gmail.com>2020-05-09 10:04:25 +0800
committerVan Waholtz <vanwaholtz@gmail.com>2020-05-11 22:07:06 +0800
commit836626260ab0b9bde6d10a3d50b6ba9d581e2d4e (patch)
treef3a5c260463c00c22ea1f7913f99632acb2695d8 /applications/luci-app-hd-idle/htdocs/luci-static
parentdd749961957c6a18bd3a831f27f6fa8f55dbd2d3 (diff)
luci-app-hd-idle: convert to client side rendering
Signed-off-by: Van Waholtz <vanwaholtz@gmail.com>
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.js44
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();
+ }
+});