luci: Add showing CPU arch

This commit is contained in:
remittor
2025-12-15 12:19:35 +03:00
parent 058b3af2b3
commit ac97bfae89
2 changed files with 15 additions and 3 deletions

View File

@@ -47,6 +47,7 @@ return view.extend({
fs.exec('/bin/busybox', [ 'ps' ]), // process list
fs.exec(tools.packager.path, tools.packager.args), // installed packages
tools.getStratList(), // nfqws strategy list
fs.exec('sh', [ '-c', '. /etc/openwrt_release && printf "%s" "$DISTRIB_ARCH"' ]), // CPU arch
uci.load(tools.appName), // config
]).catch(e => {
ui.addNotification(null, E('p', _('Unable to execute or read contents')
@@ -60,7 +61,7 @@ return view.extend({
let cfg = uci.get(tools.appName, 'config');
if (!status_array || cfg == null || typeof(cfg) !== 'object') {
let elem_status = elems.status || document.getElementById("status");
elem_status.innerHTML = tools.makeStatusString(null);
elem_status.innerHTML = tools.makeStatusString(null, '', '');
ui.addNotification(null, E('p', _('Unable to read the contents') + ': setAppStatus()'));
this.disableButtons(true, -1, elems);
return;
@@ -71,6 +72,9 @@ return view.extend({
let proc_list = status_array[3]; // stdout: multiline text
let pkg_list = status_array[4]; // stdout: installed packages
this.nfqws_strat_list = status_array[5]; // array of strat names
let pkg_arch = status_array[6]; // stdout: CPU arch
this.pkg_arch = (pkg_arch.code == 0) ? pkg_arch.stdout.trim() : 'unknown';
//console.log('svc_en: ' + svc_en.code);
svc_en = (svc_en.code == 0) ? true : false;
@@ -117,7 +121,7 @@ return view.extend({
}
}
let elem_status = elems.status || document.getElementById("status");
elem_status.innerHTML = tools.makeStatusString(svcinfo, cfg.FWTYPE, 'user_only');
elem_status.innerHTML = tools.makeStatusString(svcinfo, this.pkg_arch, '');
if (!poll.active()) {
poll.start();

View File

@@ -282,7 +282,7 @@ return baseclass.extend({
return result;
},
makeStatusString: function(svcinfo, fwtype, bllist_preset) {
makeStatusString: function(svcinfo, pkg_arch, bllist_preset) {
let svc_autorun = _('Unknown');
let svc_daemons = _('Unknown');
@@ -299,6 +299,14 @@ return baseclass.extend({
let td_name_style = `style="width: ${td_name_width}%; min-width:${td_name_width}%; max-width:${td_name_width}%;"`;
let out = `
<table class="table">
<tr class="tr">
<td class="td left" ${td_name_style}>
${_('CPU architecture')}:
</td>
<td class="td left">
${pkg_arch}
</td>
</tr>
<tr class="tr">
<td class="td left" ${td_name_style}>
${_('Service autorun status')}: