luci: Fix RPC error when config is empty and add restart button.
This commit is contained in:
@@ -184,6 +184,12 @@ msgstr "解析本地主机名"
|
|||||||
msgid "Resolve local hostnames by reading Dnsmasq lease file."
|
msgid "Resolve local hostnames by reading Dnsmasq lease file."
|
||||||
msgstr "读取Dnsmasq的租约文件解析本地主机名。"
|
msgstr "读取Dnsmasq的租约文件解析本地主机名。"
|
||||||
|
|
||||||
|
msgid "Restart"
|
||||||
|
msgstr "重启"
|
||||||
|
|
||||||
|
msgid "Restart Service"
|
||||||
|
msgstr "重启服务"
|
||||||
|
|
||||||
msgid "Second Server Settings"
|
msgid "Second Server Settings"
|
||||||
msgstr "第二DNS服务器"
|
msgstr "第二DNS服务器"
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
"read": {
|
"read": {
|
||||||
"file": {
|
"file": {
|
||||||
"/etc/smartdns/*": [ "read" ],
|
"/etc/smartdns/*": [ "read" ],
|
||||||
"/usr/sbin/smartdns": [ "exec" ]
|
"/usr/sbin/smartdns": [ "exec" ],
|
||||||
|
"/etc/init.d/smartdns restart" : [ "exec" ]
|
||||||
},
|
},
|
||||||
"ubus": {
|
"ubus": {
|
||||||
"service": [ "list" ]
|
"service": [ "list" ]
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
'require view';
|
'require view';
|
||||||
'require poll';
|
'require poll';
|
||||||
'require rpc';
|
'require rpc';
|
||||||
|
'require ui';
|
||||||
|
|
||||||
var conf = 'smartdns';
|
var conf = 'smartdns';
|
||||||
var callServiceList = rpc.declare({
|
var callServiceList = rpc.declare({
|
||||||
@@ -113,12 +114,10 @@ return view.extend({
|
|||||||
pollAdded = true;
|
pollAdded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return E('div', { class: 'cbi-map' },
|
return E('div', { class: 'cbi-section' }, [
|
||||||
E('div', { class: 'cbi-section' }, [
|
E('div', { id: 'service_status' },
|
||||||
E('div', { id: 'service_status' },
|
_('Collecting data ...'))
|
||||||
_('Collecting data ...'))
|
]);
|
||||||
])
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Basic;
|
// Basic;
|
||||||
@@ -491,6 +490,17 @@ return view.extend({
|
|||||||
window.open("https://pymumu.github.io/smartdns/#donate", '_blank');
|
window.open("https://pymumu.github.io/smartdns/#donate", '_blank');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
o = s.option(form.DummyValue, "_restart", _("Restart Service"));
|
||||||
|
o.renderWidget = function () {
|
||||||
|
return E('button', {
|
||||||
|
'class': 'btn cbi-button cbi-button-apply',
|
||||||
|
'id': 'btn_restart',
|
||||||
|
'click': ui.createHandlerFn(this, function () {
|
||||||
|
return fs.exec('/etc/init.d/smartdns', ['restart'])
|
||||||
|
.catch(function (e) { ui.addNotification(null, E('p', e.message), 'error') });
|
||||||
|
})
|
||||||
|
}, [_("Restart")]);
|
||||||
|
}
|
||||||
return m.render();
|
return m.render();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user