Skip to content

Commit 149534f

Browse files
committed
Add Msgs toggle to webviewer and map settings and make the viewer message warning managed-aware
1 parent c92f458 commit 149534f

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

frontend/control/js/app.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -980,13 +980,11 @@
980980
// every viewer setting except the port, which follows the control port
981981
const keys = ['station', 'station_link', 'lat', 'lon', 'webcontrol_http',
982982
'plugin_dir', 'file', 'backup', 'history',
983-
'share_loc', 'realtime', 'decoder', 'log', 'use_gps', 'expire', 'zones'];
984-
const toggles = ['share_loc', 'realtime', 'decoder', 'log', 'use_gps', 'expire'];
983+
'share_loc', 'realtime', 'msgs', 'decoder', 'log', 'use_gps', 'expire', 'zones'];
985984
const halves = ['station', 'station_link'];
986985
const schema = {};
987986
keys.forEach(k => {
988987
schema[k] = Object.assign({}, webviewerSchema[k]);
989-
if (toggles.indexOf(k) !== -1) schema[k].width = 16; // six across one row
990988
if (halves.indexOf(k) !== -1) schema[k].width = 50;
991989
if (k === 'history') schema[k].width = 100; // so the toggles start on a new row
992990
});

frontend/control/js/schema.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,16 @@ const webviewerSchema = {
538538
width: 24,
539539
tooltip: 'Stream live NMEA messages to the viewer'
540540
},
541+
msgs: {
542+
name: 'msgs',
543+
restartWebviewer: true,
544+
label: 'Msgs',
545+
type: 'toggle',
546+
jsonpath: 'msg',
547+
defaultValue: false,
548+
width: 24,
549+
tooltip: 'Keep the last NMEA messages per ship for display in the ship card'
550+
},
541551
geojson: {
542552
name: 'geojson',
543553
restartWebviewer: true,

frontend/src/script.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,8 @@ async function showJSONTableDialog(url, m, title, copyContext) {
11601160
async function showNMEA(m) {
11611161
if (config.features.save_messages) {
11621162
await showJSONTableDialog("api/message", m + "&receiver=" + activeReceiver, "Message " + m, true);
1163+
} else if (config.features.managed) {
1164+
showDialog("Error", 'Enable the "Msgs" setting in the viewer configuration of the control panel.');
11631165
} else {
11641166
showDialog("Error", 'Please enable "-N MSG on" in AIS-catcher settings.');
11651167
}

0 commit comments

Comments
 (0)