I have the following js view source code.
I tested the uci get works properly but but the uci.set is not working
what I am missing
/www/luci-static/resources/view/mycaller/mycaller.js:
'use strict';
'require view';
'require fs';
'require ui';
'require dom';
'require uci';
return view.extend({
handlemycaller: function(ev) {
var username;
username = ev.currentTarget.parentNode.previousSibling.previousSibling;
uci.set('mycaller', 'mycaller', 'username', username.value);
uci.save();
ui.addNotification(null, E('p', _('uci have been saved.')), 'info');
},
load: function() {
return Promise.all([
uci.load('mycaller')
]);
},
render: function(res) {
var username = uci.get('mycaller', 'mycaller', 'username') || '';
return E([
E('label', {'style': 'width:100', 'class': 'right'}, [ _('Usename: ') ]),
E('input', {
'style': 'width:100',
'type': 'text',
'value': username
}, [ _('Usename:') ]),
E('p', {}, ''),
E('span', { 'class': 'dmc-action right' }, [
E('button', {
'class': 'cbi-button cbi-button-action',
'click': ui.createHandlerFn(this, 'handlemycaller')
}, [ _('Save and Call') ]),
]),
E('pre', { 'class': 'command-output', 'style': 'display:none' })
]);
},
handleSaveApply: null,
handleSave: null,
handleReset: null
});
/usr/share/rpcd/acl.d/luci-app-mycaller.json:
{
"luci-app-mycaller": {
"description": "mycaller app",
"read": {
"file": {
"/usr/sbin/mycaller": [ "exec" ],
"/tmp/.luci_input": [ "read" ]
},
"uci": [ "mycaller" ]
},
"write": {
"file": {
"/tmp/.luci_input": [ "write" ]
},
"uci": [ "mycaller" ]
}
}
}