-
Notifications
You must be signed in to change notification settings - Fork 2.9k
luci-app-smart-reboot: add LuCI frontend for smart-reboot #8328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| include $(TOPDIR)/rules.mk | ||
|
|
||
| PKG_NAME:=luci-app-smart-reboot | ||
| LUCI_TITLE:=LuCI support for smart-reboot | ||
| LUCI_DEPENDS:=+smart-reboot | ||
| PKG_LICENSE:=Apache-2.0 | ||
| PKG_MAINTAINER:=Min Choi <3387910@naver.com> | ||
|
|
||
| include ../../luci.mk | ||
|
|
||
| # call BuildPackage - OpenWrt buildroot signature | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| 'use strict'; | ||
| 'require view'; | ||
| 'require form'; | ||
| 'require network'; | ||
| 'require uci'; | ||
|
|
||
| return view.extend({ | ||
| load: function() { | ||
| return Promise.all([ | ||
| network.getNetworks(), | ||
| network.getDevices() | ||
| ]); | ||
| }, | ||
|
|
||
| render: function(data) { | ||
| var m, s, o; | ||
| var networks = data[0] || []; | ||
| var devices = data[1] || []; | ||
| var ifaceMap = {}; | ||
|
|
||
| m = new form.Map('smart-reboot', _('Smart Reboot'), | ||
| _('Reboot only when the network is idle at the configured dawn time.')); | ||
|
|
||
| s = m.section(form.TypedSection, 'settings', _('Settings')); | ||
| s.anonymous = true; | ||
|
|
||
| o = s.option(form.Flag, 'enabled', _('Enable')); | ||
| o.rmempty = false; | ||
|
|
||
| o = s.option(form.DummyValue, 'last_auto_reboot', _('Last automatic reboot')); | ||
| o.cfgvalue = function(section_id) { | ||
| return uci.get('smart-reboot', section_id, 'last_auto_reboot') || _('Never'); | ||
| }; | ||
|
|
||
| o = s.option(form.Value, 'time', _('Reboot time (HH:MM)')); | ||
| o.placeholder = '04:00'; | ||
| o.rmempty = false; | ||
| o.validate = function(section_id, value) { | ||
| if (!value || !value.match(/^([01][0-9]|2[0-3]):[0-5][0-9]$/)) | ||
| return _('Time format must be HH:MM (24-hour). Example: 04:00'); | ||
|
|
||
| return true; | ||
| }; | ||
|
|
||
| o = s.option(form.Flag, 'all_ifaces', _('Select all interfaces')); | ||
| o.rmempty = false; | ||
|
|
||
| o = s.option(form.MultiValue, 'ifaces', _('Monitored interfaces')); | ||
| o.widget = 'select'; | ||
| o.size = 8; | ||
| o.depends('all_ifaces', '0'); | ||
| o.depends('all_ifaces', ''); | ||
|
|
||
| networks.forEach(function(netif) { | ||
| var logical = netif.getName(); | ||
| var dev = netif.getL3Device() || netif.getL2Device() || netif.getDevice(); | ||
| var ifname = dev && dev.getName ? dev.getName() : null; | ||
|
|
||
| if (!ifname || ifname === 'lo') | ||
| return; | ||
|
|
||
| ifaceMap[ifname] = ifaceMap[ifname] || { labels: [] }; | ||
| if (logical && ifaceMap[ifname].labels.indexOf(logical) < 0) | ||
| ifaceMap[ifname].labels.push(logical); | ||
| }); | ||
|
|
||
| (devices || []).forEach(function(dev) { | ||
| var name = dev.getName(); | ||
| if (!name || name === 'lo') | ||
| return; | ||
|
|
||
| ifaceMap[name] = ifaceMap[name] || { labels: [] }; | ||
| }); | ||
|
|
||
| Object.keys(ifaceMap).sort().forEach(function(ifname) { | ||
| var labels = ifaceMap[ifname].labels; | ||
| var text = labels.length ? '%s (%s)'.format(labels.join(', '), ifname) : ifname; | ||
| o.value(ifname, text); | ||
| }); | ||
|
|
||
| o = s.option(form.Value, 'sample_seconds', _('Idle sampling duration (seconds)')); | ||
| o.datatype = 'uinteger'; | ||
| o.placeholder = '120'; | ||
| o.rmempty = false; | ||
|
|
||
| o = s.option(form.Value, 'byte_threshold', _('Idle threshold (bytes)')); | ||
| o.datatype = 'uinteger'; | ||
| o.placeholder = '262144'; | ||
| o.rmempty = false; | ||
|
|
||
| return m.render(); | ||
| } | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| msgid "" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No Generated by Claude Code |
||
| msgstr "Content-Type: text/plain; charset=UTF-8\nLanguage: ar\n" | ||
|
|
||
| msgid "Smart Reboot" | ||
| msgstr "إعادة تشغيل ذكية" | ||
|
|
||
| msgid "Reboot only when the network is idle at the configured dawn time." | ||
| msgstr "أعد التشغيل فقط عندما تكون الشبكة خاملة في وقت الفجر المحدد." | ||
|
|
||
| msgid "Settings" | ||
| msgstr "الإعدادات" | ||
|
|
||
| msgid "Enable" | ||
| msgstr "تمكين" | ||
|
|
||
| msgid "Last automatic reboot" | ||
| msgstr "آخر إعادة تشغيل تلقائية" | ||
|
|
||
| msgid "Never" | ||
| msgstr "أبدًا" | ||
|
|
||
| msgid "Reboot time (HH:MM)" | ||
| msgstr "وقت إعادة التشغيل (HH:MM)" | ||
|
|
||
| msgid "Time format must be HH:MM (24-hour). Example: 04:00" | ||
| msgstr "يجب أن يكون تنسيق الوقت HH:MM (24 ساعة). مثال: 04:00" | ||
|
|
||
| msgid "Select all interfaces" | ||
| msgstr "تحديد جميع الواجهات" | ||
|
|
||
| msgid "Monitored interfaces" | ||
| msgstr "الواجهات المُراقبة" | ||
|
|
||
| msgid "Idle sampling duration (seconds)" | ||
| msgstr "مدة أخذ عينات الخمول (ثوانٍ)" | ||
|
|
||
| msgid "Idle threshold (bytes)" | ||
| msgstr "حد الخمول (بايت)" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| msgid "" | ||
| msgstr "Content-Type: text/plain; charset=UTF-8\nLanguage: de\n" | ||
|
|
||
| msgid "Smart Reboot" | ||
| msgstr "Intelligenter Neustart" | ||
|
|
||
| msgid "Reboot only when the network is idle at the configured dawn time." | ||
| msgstr "Nur neu starten, wenn das Netzwerk zur konfigurierten Zeit im Leerlauf ist." | ||
|
|
||
| msgid "Settings" | ||
| msgstr "Einstellungen" | ||
|
|
||
| msgid "Enable" | ||
| msgstr "Aktivieren" | ||
|
|
||
| msgid "Last automatic reboot" | ||
| msgstr "Letzter automatischer Neustart" | ||
|
|
||
| msgid "Never" | ||
| msgstr "Nie" | ||
|
|
||
| msgid "Reboot time (HH:MM)" | ||
| msgstr "Neustartzeit (HH:MM)" | ||
|
|
||
| msgid "Time format must be HH:MM (24-hour). Example: 04:00" | ||
| msgstr "Zeitformat muss HH:MM (24-Stunden) sein. Beispiel: 04:00" | ||
|
|
||
| msgid "Select all interfaces" | ||
| msgstr "Alle Schnittstellen auswählen" | ||
|
|
||
| msgid "Monitored interfaces" | ||
| msgstr "Überwachte Schnittstellen" | ||
|
|
||
| msgid "Idle sampling duration (seconds)" | ||
| msgstr "Leerlauf-Abtastdauer (Sekunden)" | ||
|
|
||
| msgid "Idle threshold (bytes)" | ||
| msgstr "Leerlauf-Schwellenwert (Bytes)" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| msgid "" | ||
| msgstr "Content-Type: text/plain; charset=UTF-8\nLanguage: es\n" | ||
|
|
||
| msgid "Smart Reboot" | ||
| msgstr "Reinicio inteligente" | ||
|
|
||
| msgid "Reboot only when the network is idle at the configured dawn time." | ||
| msgstr "Reiniciar solo cuando la red esté inactiva a la hora de madrugada configurada." | ||
|
|
||
| msgid "Settings" | ||
| msgstr "Configuración" | ||
|
|
||
| msgid "Enable" | ||
| msgstr "Habilitar" | ||
|
|
||
| msgid "Last automatic reboot" | ||
| msgstr "Último reinicio automático" | ||
|
|
||
| msgid "Never" | ||
| msgstr "Nunca" | ||
|
|
||
| msgid "Reboot time (HH:MM)" | ||
| msgstr "Hora de reinicio (HH:MM)" | ||
|
|
||
| msgid "Time format must be HH:MM (24-hour). Example: 04:00" | ||
| msgstr "El formato de hora debe ser HH:MM (24 horas). Ejemplo: 04:00" | ||
|
|
||
| msgid "Select all interfaces" | ||
| msgstr "Seleccionar todas las interfaces" | ||
|
|
||
| msgid "Monitored interfaces" | ||
| msgstr "Interfaces monitorizadas" | ||
|
|
||
| msgid "Idle sampling duration (seconds)" | ||
| msgstr "Duración de muestreo de inactividad (segundos)" | ||
|
|
||
| msgid "Idle threshold (bytes)" | ||
| msgstr "Umbral de inactividad (bytes)" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| msgid "" | ||
| msgstr "Content-Type: text/plain; charset=UTF-8\nLanguage: fr\n" | ||
|
|
||
| msgid "Smart Reboot" | ||
| msgstr "Redémarrage intelligent" | ||
|
|
||
| msgid "Reboot only when the network is idle at the configured dawn time." | ||
| msgstr "Redémarrer uniquement lorsque le réseau est inactif à l'heure d'aube configurée." | ||
|
|
||
| msgid "Settings" | ||
| msgstr "Paramètres" | ||
|
|
||
| msgid "Enable" | ||
| msgstr "Activer" | ||
|
|
||
| msgid "Last automatic reboot" | ||
| msgstr "Dernier redémarrage automatique" | ||
|
|
||
| msgid "Never" | ||
| msgstr "Jamais" | ||
|
|
||
| msgid "Reboot time (HH:MM)" | ||
| msgstr "Heure de redémarrage (HH:MM)" | ||
|
|
||
| msgid "Time format must be HH:MM (24-hour). Example: 04:00" | ||
| msgstr "Le format de l'heure doit être HH:MM (24h). Exemple : 04:00" | ||
|
|
||
| msgid "Select all interfaces" | ||
| msgstr "Sélectionner toutes les interfaces" | ||
|
|
||
| msgid "Monitored interfaces" | ||
| msgstr "Interfaces surveillées" | ||
|
|
||
| msgid "Idle sampling duration (seconds)" | ||
| msgstr "Durée d'échantillonnage d'inactivité (secondes)" | ||
|
|
||
| msgid "Idle threshold (bytes)" | ||
| msgstr "Seuil d'inactivité (octets)" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| msgid "" | ||
| msgstr "Content-Type: text/plain; charset=UTF-8\nLanguage: id\n" | ||
|
|
||
| msgid "Smart Reboot" | ||
| msgstr "Reboot Cerdas" | ||
|
|
||
| msgid "Reboot only when the network is idle at the configured dawn time." | ||
| msgstr "Reboot hanya saat jaringan idle pada waktu dini hari yang dikonfigurasi." | ||
|
|
||
| msgid "Settings" | ||
| msgstr "Pengaturan" | ||
|
|
||
| msgid "Enable" | ||
| msgstr "Aktifkan" | ||
|
|
||
| msgid "Last automatic reboot" | ||
| msgstr "Reboot otomatis terakhir" | ||
|
|
||
| msgid "Never" | ||
| msgstr "Tidak pernah" | ||
|
|
||
| msgid "Reboot time (HH:MM)" | ||
| msgstr "Waktu reboot (HH:MM)" | ||
|
|
||
| msgid "Time format must be HH:MM (24-hour). Example: 04:00" | ||
| msgstr "Format waktu harus HH:MM (24 jam). Contoh: 04:00" | ||
|
|
||
| msgid "Select all interfaces" | ||
| msgstr "Pilih semua antarmuka" | ||
|
|
||
| msgid "Monitored interfaces" | ||
| msgstr "Antarmuka yang dipantau" | ||
|
|
||
| msgid "Idle sampling duration (seconds)" | ||
| msgstr "Durasi sampling idle (detik)" | ||
|
|
||
| msgid "Idle threshold (bytes)" | ||
| msgstr "Ambang idle (byte)" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| msgid "" | ||
| msgstr "Content-Type: text/plain; charset=UTF-8\nLanguage: it\n" | ||
|
|
||
| msgid "Smart Reboot" | ||
| msgstr "Riavvio intelligente" | ||
|
|
||
| msgid "Reboot only when the network is idle at the configured dawn time." | ||
| msgstr "Riavvia solo quando la rete è inattiva all'ora dell'alba configurata." | ||
|
|
||
| msgid "Settings" | ||
| msgstr "Impostazioni" | ||
|
|
||
| msgid "Enable" | ||
| msgstr "Abilita" | ||
|
|
||
| msgid "Last automatic reboot" | ||
| msgstr "Ultimo riavvio automatico" | ||
|
|
||
| msgid "Never" | ||
| msgstr "Mai" | ||
|
|
||
| msgid "Reboot time (HH:MM)" | ||
| msgstr "Ora di riavvio (HH:MM)" | ||
|
|
||
| msgid "Time format must be HH:MM (24-hour). Example: 04:00" | ||
| msgstr "Il formato orario deve essere HH:MM (24 ore). Esempio: 04:00" | ||
|
|
||
| msgid "Select all interfaces" | ||
| msgstr "Seleziona tutte le interfacce" | ||
|
|
||
| msgid "Monitored interfaces" | ||
| msgstr "Interfacce monitorate" | ||
|
|
||
| msgid "Idle sampling duration (seconds)" | ||
| msgstr "Durata campionamento inattività (secondi)" | ||
|
|
||
| msgid "Idle threshold (bytes)" | ||
| msgstr "Soglia inattività (byte)" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| msgid "" | ||
| msgstr "Content-Type: text/plain; charset=UTF-8\nLanguage: ja\n" | ||
|
|
||
| msgid "Smart Reboot" | ||
| msgstr "スマート再起動" | ||
|
|
||
| msgid "Reboot only when the network is idle at the configured dawn time." | ||
| msgstr "設定した早朝時刻に、ネットワークがアイドル状態のときのみ再起動します。" | ||
|
|
||
| msgid "Settings" | ||
| msgstr "設定" | ||
|
|
||
| msgid "Enable" | ||
| msgstr "有効化" | ||
|
|
||
| msgid "Last automatic reboot" | ||
| msgstr "前回の自動再起動" | ||
|
|
||
| msgid "Never" | ||
| msgstr "なし" | ||
|
|
||
| msgid "Reboot time (HH:MM)" | ||
| msgstr "再起動時刻 (HH:MM)" | ||
|
|
||
| msgid "Time format must be HH:MM (24-hour). Example: 04:00" | ||
| msgstr "時刻形式は HH:MM(24時間)で入力してください。例: 04:00" | ||
|
|
||
| msgid "Select all interfaces" | ||
| msgstr "すべてのインターフェースを選択" | ||
|
|
||
| msgid "Monitored interfaces" | ||
| msgstr "監視対象インターフェース" | ||
|
|
||
| msgid "Idle sampling duration (seconds)" | ||
| msgstr "アイドル判定サンプリング時間(秒)" | ||
|
|
||
| msgid "Idle threshold (bytes)" | ||
| msgstr "アイドル閾値(バイト)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The switch to
luci.mkresolves the earlier packaging/i18n comments — thanks. One thing still missing:PKG_MAINTAINER. The formality check on this commit fails withNew OpenWrt package is missing the mandatory parameter: 'PKG_MAINTAINER', and 95 of the 100 in-treeapplications/luci-app-*/Makefileset it (e.g. luci-app-ddns). Add it next toPKG_LICENSE:Generated by Claude Code