Update UI for luci-app status

This commit is contained in:
Vadim Vetrov
2024-12-23 01:09:53 +03:00
parent e915e3ef51
commit 47ac81c318
2 changed files with 20 additions and 3 deletions

View File

@@ -52,6 +52,12 @@ function handleAction(act, event) {
} else { } else {
fs.exec_direct('/etc/init.d/youtubeUnblock', [ 'disable' ]).then(thn_inc); fs.exec_direct('/etc/init.d/youtubeUnblock', [ 'disable' ]).then(thn_inc);
} }
} else if (act == "reset_configs") {
fs.exec_direct('/usr/share/youtubeUnblock/youtubeUnblock_defaults.sh', [ '--force' ])
.then(function() {
fs.exec_direct('/etc/init.d/youtubeUnblock', [ 'restart' ])
.then(thn_disp);
});
} else { } else {
unroll_inact(event.target); unroll_inact(event.target);
} }
@@ -210,15 +216,25 @@ return view.extend({
return handleAction('fw_reload', event); return handleAction('fw_reload', event);
}) })
}, [ _('Firewall reload') ]), }, [ _('Firewall reload') ]),
'\xa0\xa0\xa0',
E('button', {
'class': 'btn cbi-button cbi-button-negative',
'id': 'btn_reset_configs',
'click': ui.createHandlerFn(this, function(event) {
return handleAction('reset_configs', event);
})
}, [ _('Reset configuration') ]),
]) ])
]); ]);
}, o, this); }, o, this);
const logs_s = m.section(form.NamedSection, 'ytb_logs'); const logs_s = m.section(form.NamedSection, 'ytb_logs', _("Logs"), _("If you want to scroll logs, disable refreshing by clicking the button in the upper right corner of the screen"));
logs_s.render = L.bind(function(view, section_id) { logs_s.render = L.bind(function(view, section_id) {
return E('div', { class: 'cbi-map' }, return E('div', { class: 'cbi-map' },
E('div', { class: 'cbi-section' }, [ E('div', { class: 'cbi-section' }, [
E('div', { class: 'cbi-section-descr' }, _('The syslog output, pre-filtered for messages related to: youtubeUnblock')), E('h3', _('Logs')),
E('div', { class: 'cbi-section-descr' }, _('If you want to scroll logs, disable refreshing by clicking the button in the upper right corner of the screen')),
E('textarea', { E('textarea', {
'id': 'ytb_logger', 'id': 'ytb_logger',
'style': 'width: 100% !important; padding: 5px; font-family: monospace', 'style': 'width: 100% !important; padding: 5px; font-family: monospace',

View File

@@ -14,7 +14,8 @@
"/etc/init.d/firewall reload" : [ "exec" ], "/etc/init.d/firewall reload" : [ "exec" ],
"/usr/bin/youtubeUnblock --version" : [ "exec" ], "/usr/bin/youtubeUnblock --version" : [ "exec" ],
"/sbin/logread -e youtubeUnblock -l [0-9]*": [ "exec" ], "/sbin/logread -e youtubeUnblock -l [0-9]*": [ "exec" ],
"/usr/sbin/logread -e youtubeUnblock -l [0-9]*": [ "exec" ] "/usr/sbin/logread -e youtubeUnblock -l [0-9]*": [ "exec" ],
"/usr/share/youtubeUnblock/youtubeUnblock_defaults.sh --force": [ "exec" ]
}, },
"uci": [ "youtubeUnblock" ] "uci": [ "youtubeUnblock" ]
}, },