Hi everyone ,
I'm trying to migrate my package from lua to LuCI JS, but I'm stuck at one point. I can't handle moving the contents of the file ('/etc/config/test.user') to the select control ('USERcmds').
load: function() {
return Promise.all([
L.resolveDefault(fs.read_direct('/etc/config/test.user'), null)
]);
},
render: function () {
var USERcmds = [E('option', { value: '' }, [_('-- Select a AT command --')])];
USERcmds.push(E('option', { 'value': 'AT+CSQ' }, 'Check signal strength β AT+CSQ' ));
return E('div', { 'class': 'cbi-map', 'id': 'map' }, [
E('h2', {}, [ _('AT Commands') ]),
E('div', { 'class': 'cbi-map-descr'}, _('Web UI for handling AT commands via sms-tool. More information about the sms-tool on the %seko.one.pl forum%s.').format('<a href="https://eko.one.pl/?p=openwrt-sms_tool" target="_blank">', '</a>')),
E('br'),
E('div', { 'class': 'cbi-section' }, [
E('div', { 'class': 'cbi-section-node' }, [
E('div', { 'class': 'cbi-value' }, [
E('label', { 'class': 'cbi-value-title' }, [ _('User AT commands') ]),
E('div', { 'class': 'cbi-value-field' }, [
E('select', { 'class': 'cbi-input-select', 'id': 'tk', 'style': 'margin:5px 0; width:100%;', 'change': ui.createHandlerFn(this, 'handleCopy')},
USERcmds
)
])
]),
file content ('/etc/config/test.user')
Check signal strength β AT+CSQ;AT+CSQ
Current band in use β AT+QNWINFO;AT+QNWINFO
Could someone send me the code to do this. Maybe there is already some other package with the solution I am looking for?
Thanks for any help