summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-dawn/htdocs/luci-static/resources/dawn/dawn-common.js
diff options
context:
space:
mode:
authorDaniel Vijge <danielvijge@gmail.com>2023-11-06 22:37:32 +0100
committerDaniel Vijge <danielvijge@gmail.com>2023-11-07 20:12:15 +0100
commit69eeebe23d60736c1d4436162444f7b9c53de3ed (patch)
tree2eb254e86cf35e05af262b5601aaff8e8d811d83 /applications/luci-app-dawn/htdocs/luci-static/resources/dawn/dawn-common.js
parente8029b08287c666a43d5ef25c7ea83ce7d606903 (diff)
luci-app-dawn: error message when service not running
Display a nicer error message when the DAWN service is not running Signed-off-by: Daniel Vijge <danielvijge@gmail.com>
Diffstat (limited to 'applications/luci-app-dawn/htdocs/luci-static/resources/dawn/dawn-common.js')
-rw-r--r--applications/luci-app-dawn/htdocs/luci-static/resources/dawn/dawn-common.js24
1 files changed, 20 insertions, 4 deletions
diff --git a/applications/luci-app-dawn/htdocs/luci-static/resources/dawn/dawn-common.js b/applications/luci-app-dawn/htdocs/luci-static/resources/dawn/dawn-common.js
index 79f37a7d63..9dec2c6ec1 100644
--- a/applications/luci-app-dawn/htdocs/luci-static/resources/dawn/dawn-common.js
+++ b/applications/luci-app-dawn/htdocs/luci-static/resources/dawn/dawn-common.js
@@ -7,13 +7,13 @@ let callDawnGetNetwork, callDawnGetHearingMap, callHostHints;
callDawnGetNetwork = rpc.declare({
object: 'dawn',
method: 'get_network',
- expect: { }
+ expect: { }
});
callDawnGetHearingMap = rpc.declare({
object: 'dawn',
method: 'get_hearing_map',
- expect: { }
+ expect: { }
});
callHostHints = rpc.declare({
@@ -22,6 +22,12 @@ callHostHints = rpc.declare({
expect: { }
});
+function isDawnRPCAvailable() {
+ return rpc.list("dawn").then(function(signatures) {
+ return 'dawn' in signatures && 'get_network' in signatures.dawn && 'get_hearing_map' in signatures.dawn;
+ });
+}
+
function getAvailableText(available) {
return ( available ? _('Available') : _('Not available') );
}
@@ -59,16 +65,26 @@ function getFormattedNumber(num, decimals, divider = 1) {
}
function getHostnameFromMAC(hosthints, mac) {
- return ( hosthints[mac] && hosthints[mac].name ? hosthints[mac].name + ' (' + mac + ')' : mac);
+ return ( hosthints[mac] && hosthints[mac].name ? hosthints[mac].name + ' (' + mac + ')' : mac );
+}
+
+function getDawnServiceNotRunningErrorMessage() {
+ return E('div', { 'class': 'alert-message fade-in warning' }, [
+ E('h4', _('DAWN service unavailable')),
+ E('p', _('Unable to query the DAWN service via ubus, the service appears to be stopped.')),
+ E('a', { 'href': L.url('admin/system/startup') }, _('Check Startup services'))
+ ]);
}
return L.Class.extend({
callDawnGetNetwork: callDawnGetNetwork,
callDawnGetHearingMap: callDawnGetHearingMap,
callHostHints: callHostHints,
+ isDawnRPCAvailable: isDawnRPCAvailable,
getAvailableText: getAvailableText,
getYesText: getYesText,
getChannelFromFrequency: getChannelFromFrequency,
getFormattedNumber: getFormattedNumber,
- getHostnameFromMAC: getHostnameFromMAC
+ getHostnameFromMAC: getHostnameFromMAC,
+ getDawnServiceNotRunningErrorMessage: getDawnServiceNotRunningErrorMessage
});