'require form';
'require fs';
'require view';
+'require uci';
+
+function disk(devs, options, section_id) {
+ var v = uci.get('hd-idle', section_id, 'disk') || '';
+ var disk = devs.find(function(itm){ return itm.name == v; });
+ var out = '';
+ if(disk != undefined){
+ out = options.map(function(opt){ return disk[opt].trim(); });
+ out = out.filter(function(o){ return o != ''; });
+ out = out.join(' ');
+ }
+ return E('span', out);
+}
+
+function prettytime(section_id) {
+ return E('span', (uci.get('hd-idle', section_id, 'idle_time_interval') || '')
+ + ' '
+ + (uci.get('hd-idle', section_id, 'idle_time_unit') || ''));
+}
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;
- });
+ return fs.exec("/usr/bin/lsblk", ["-n", "-J", "-do", "NAME,TRAN,ROTA,RM,VENDOR,MODEL"]).then(function(res) {
+ if( res.code )
+ return [];
+ var json = JSON.parse(res.stdout);
+ return ( 'blockdevices' in json ) ? json['blockdevices'] : [];
});
},
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.'));
+ m = new form.Map('hd-idle', _('HDD Idle'), _('HDD Idle is a utility program for spinning-down disks after a period of idle time.'));
- s = m.section(form.TypedSection, 'hd-idle', _('Settings'));
+ s = m.section(form.GridSection, 'hd-idle', _('Settings'));
s.anonymous = true;
s.addremove = true;
+ s.sortable = true;
s.addbtntitle = _('Add new hdd setting...');
- o = s.option(form.Flag, 'enabled', _('Enable'));
+
+ s.tab('general', _('Disk Settings'));
+
+
+ o = s.taboption('general', form.Flag, 'enabled', _('Enable'));
o.rmempty = false;
+ o.editable = true;
- o = s.option(form.Value, 'disk', _('Disk'));
+ o = s.taboption('general', form.ListValue, 'disk', _('Disk'));
devs.forEach(function(dev) {
- o.value(dev.name);
+ if( dev.rota ) {
+ o.value(dev.name, `/dev/${dev.name} [${dev.tran}:${dev.vendor} ${dev.model}]`);
+ }
});
- o = s.option(form.Value, 'idle_time_interval', _('Idle time'));
+
+ o = s.taboption('general', form.Value, '_bus', _('Bus'));
+ o.rawhtml = true;
+ o.write = function() {};
+ o.remove = function() {};
+ o.modalonly = false;
+ o.textvalue = disk.bind(o, devs, ['tran']);
+
+ o = s.taboption('general', form.Value, '_vendorModel', _('Vendor / Model'));
+ o.rawhtml = true;
+ o.write = function() {};
+ o.remove = function() {};
+ o.modalonly = false;
+ o.textvalue = disk.bind(o, devs, ['vendor', 'model'] );
+
+ o = s.taboption('general', form.Value, 'idle_time_interval', _('Idle time'));
+ o.modalonly = true;
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 = s.taboption('general', form.ListValue, 'idle_time_unit', _('Idle time unit'));
+ o.modalonly = true;
+ o.value('seconds', _('seconds', 'Abbreviation for seconds'));
+ o.value('minutes', _('minutes', 'Abbreviation for minutes'));
+ o.value('hours', _('hours', 'Abbreviation for hours'));
+ o.value('days', _('days', 'Abbreviation for days'));
o.default = 'minutes';
+ o = s.taboption('general', form.Value, '_prettytime', _('Idle time'));
+ o.rawhtml = true;
+ o.write = function() {};
+ o.remove = function() {};
+ o.modalonly = false;
+ o.textvalue = prettytime.bind(o);
+
return m.render();
}
});
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr ""
-"HDD Idle és un programa per ralentitzar els discos externs després d'un "
+"HDD Idle és un programa per ralentitzar els discos després d'un "
"període de temps inactiu."
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:32
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr ""
-"HDD Idle je utilita pro vypnutí externích pevných disků po určité době "
+"HDD Idle je utilita pro vypnutí pevných disků po určité době "
"nečinnosti."
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:32
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr ""
-"HDD Idle ist ein Hilfsprogramm um externe Festplatten nach einer "
+"HDD Idle ist ein Hilfsprogramm um Festplatten nach einer "
"festgelegten Leerlaufzeit herunter zu fahren."
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:32
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr ""
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:32
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr ""
-"HDD Idle es un programa que administra la suspensión de discos externos tras "
+"HDD Idle es un programa que administra la suspensión de discos tras "
"un tiempo de inactividad."
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:32
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr ""
-"HDD Idle est un utilitaire pour arrêter la rotation des disques externes "
+"HDD Idle est un utilitaire pour arrêter la rotation des disques "
"après une période d'inactivité."
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:32
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr ""
-"HDD Idle הינה תוכנת שירות שמטרתה להקטין את מהירות הסיבוב של כוננים חיצוניים "
+"HDD Idle הינה תוכנת שירות שמטרתה להקטין את מהירות הסיבוב של כוננים "
"לאחר זמן מסוים של חוסר פעילות."
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:32
"HDD Idle is a utility program for spinning-down external disks after a "
"period of idle time."
msgstr ""
-"HDD Idle egy a külső lemezek adott üresjárati idő után történő leállítására "
+"HDD Idle egy a lemezek adott üresjárati idő után történő leállítására "
"szolgáló segédprogram."
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:32
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr ""
-"HDD Idle è un programma per mettere in standby i dischi esterni dopo un "
+"HDD Idle è un programma per mettere in standby i dischi dopo un "
"periodo di inattività."
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:32
"HDD Idle is a utility program for spinning-down external disks after a "
"period of idle time."
msgstr ""
-"HDD Idleはアイドル時に外部ディスクをスピンダウンさせるための、ユーティリティ"
+"HDD Idleはアイドル時にィスクをスピンダウンさせるための、ユーティリティ"
"プログラムです。"
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:32
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr ""
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr ""
-"HDD Idle er et verktøy for å spinne ned eksterne disker etter en periode med "
+"HDD Idle er et verktøy for å spinne ned disker etter en periode med "
"inaktivitet."
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:32
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr ""
-"HDD Idle jest narzędziem do zwalniania obrotów zewnętrznych dysków po "
+"HDD Idle jest narzędziem do zwalniania obrotów dysków po "
"określonym czasie bezczynności."
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:32
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr ""
"HDD Idle é um programa utilitário para activar o modo \"economia de energia"
-"\" (spinning-down) de discos externos após um período de ociosidade."
+"\" (spinning-down) de discos após um período de ociosidade."
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:32
msgid "Idle time"
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr ""
"HDD Idle é um programa utilitário para ativar o modo \"economia de energia"
-"\" (spinning-down) de discos externos após um período de ociosidade."
+"\" (spinning-down) de discos após um período de ociosidade."
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:32
msgid "Idle time"
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr ""
-"HDD Idle este un utilitar pentru a oprit din rotatie hard disc-urile externe "
+"HDD Idle este un utilitar pentru a oprit din rotatie hard disc-urile "
"dupa o anumita perioada de inactivitate."
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:32
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr ""
-"УÑ\82илиÑ\82а HDD Idle позволÑ\8fеÑ\82 замедлÑ\8fÑ\82Ñ\8c внеÑ\88ние диÑ\81ки поÑ\81ле опÑ\80еделÑ\91нного "
+"Утилита HDD Idle позволяет замедлять диски после определённого "
"времени бездействия."
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:32
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr "HDD Idle je program na uspanie disku po nastavenom čase."
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr ""
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr ""
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr ""
"HDD Idle, belirli bir zaman sonra diskleri beklemeye alan bir yardımcı "
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr ""
-"Ð\97аÑ\81Ñ\96б HDD Idle дозволÑ\8fÑ\94 Ñ\83повÑ\96лÑ\8cнÑ\8eваÑ\82и зовнÑ\96Ñ\88нÑ\96 диÑ\81ки пÑ\96Ñ\81лÑ\8f певного Ñ\87аÑ\81Ñ\83 "
+"Засіб HDD Idle дозволяє уповільнювати диски після певного часу "
"бездіяльності."
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:32
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr ""
-"HDD Idle là một chương trình tiện ích để quay các đĩa ngoài sau một khoảng "
+"HDD Idle là một chương trình tiện ích để quay các đĩa sau một khoảng "
"thời gian idle."
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:32
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:17
msgid ""
-"HDD Idle is a utility program for spinning-down external disks after a "
+"HDD Idle is a utility program for spinning-down disks after a "
"period of idle time."
msgstr "硬盘休眠是控制当硬盘在空闲一段时间后进入休眠模式的工具。"
msgid ""
"HDD Idle is a utility program for spinning-down external disks after a "
"period of idle time."
-msgstr "HDD Idle是一個實用程式,用於在一段時間的空閒時間後對外部磁盤降低轉速。"
+msgstr "HDD Idle是一個實用程式,用於在一段時間的空閒時間後對部磁盤降低轉速。"
#: applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js:32
msgid "Idle time"
"description": "Grant UCI access for luci-app-hd-idle",
"read": {
"file": {
- "/dev": [ "list" ]
+ "/usr/bin/lsblk -n -J -do NAME,TRAN,ROTA,RM,VENDOR,MODEL": [ "exec" ]
},
"uci": [ "hd-idle" ]
},