From 990fe946c5d20db5f2bbe1dd34c2bd1a80bebf65 Mon Sep 17 00:00:00 2001 From: Kim Huebel Date: Sat, 13 Feb 2021 21:34:03 +0000 Subject: [PATCH] Adding textlabels for target-columns in the Dashboard configurable via html/data/TG_List.csv --- README.md | 15 +++++++++++- html/index.html | 2 +- html/js/functions.js | 57 ++++++++++++++++++++++++++++++++++++++++---- html/js/version.js | 2 +- 4 files changed, 68 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 71cd6b6..f173e54 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ Actually known: Finally you should be able to get the new Dashboard calling the hostname of your hotspot and port 8000 (default) in your broser ### Troubleshoting -If you have any trouble running the software most things depend on the logtailer-component. So it is a good idea to try starting the software on the console wih +If you have any trouble running the software most things depend on the logtailer-component. So it is a good idea to try starting the software on the console with `python3 ./logtailer.py` to see the output of the program. A common error are missing python-libraries you should install with the commands mentioned above. If you found any further missing library let me know! Just open an issue! @@ -78,6 +78,19 @@ Also take care to configure the filepath to the correct location of your DMRIds. For updating the DMRIds.dat you can use the script you find in scripts-folder. +### Configuration of Talkgroup-Textes in "Target"-column +You will find a file in /html/data called "TG_List.csv" that is a comma-separated file of following format: +``` +TS,TG,LABEL +1,263,DL Multimode BM +2,8021,Pegasus DMR-DL +2,2625,RLP/SL BM +``` +First row leave untouched for orientation. The other lines contains on first column the DMR-timeslot the TG is used, second column contains the talkgroup-number and third column contains the label you want to be shown in the target-column of the dashboard. + +Please edit this file to your needs. It may change on developer-side from time by time so when updating keep a copy of your personal list to modify/edit it. + +If you do not want to have this Talkgroup-textes in your dashboard, simply remove all but the first line in this file. ## Best Practise Installation For getting the best user experience it is recommended to configure your MMDVMHost and other G4KLX-software with the following parameter: diff --git a/html/index.html b/html/index.html index d5a7019..100af81 100644 --- a/html/index.html +++ b/html/index.html @@ -17,7 +17,7 @@ - + diff --git a/html/js/functions.js b/html/js/functions.js index 53175eb..b226b10 100644 --- a/html/js/functions.js +++ b/html/js/functions.js @@ -3,7 +3,7 @@ var ts1TXing = null; var ts2TXing = null; var ts1timestamp = ""; var ts2timestamp = ""; - +var talkgroups = []; // Setting config-defaults if not set qrz = typeof(qrz) == 'undefined' ? 1 : qrz; debug = typeof(debug) == 'undefined' ? 0 : debug; @@ -24,7 +24,7 @@ setInterval(getCurrentTXing, 1000); function logIt(message) { if (debug == 1 || message.startsWith("Logtailer-Errormessage:")) { - console.log(message); + console.log(JSON.stringify(message)); } } @@ -131,6 +131,26 @@ function getRawTarget(logline) { } } +function resolveTarget(timeslot, target) { + retval = null; + tmpval = talkgroups.filter(function (tg) { return tg[0] == timeslot}); + // and tg.TG == target + retval = tmpval.filter(function (tg) { return tg[1] == target.substring(3, target.length)}); + if (retval.length > 0) { + return retval[0][2]; + } else { + return target; + } +} + +function getTimeslot(mode) { + if (mode.startsWith("DMR")) { + return mode.substring(9, 10); + } else { + return null; + } +} + function getTarget(logline) { target = getRawTarget(logline); if (showBMTGLink && getMode(logline).startsWith("DMR")) { @@ -161,11 +181,20 @@ function getTarget(logline) { } } } else { - link = '' + target + ''; - return link; + if (getMode(logline).startsWith("DMR")) { + link = '' + resolveTarget(getTimeslot(getMode(logline)), target) + ''; + return link; + } else { + link = '' + target + ''; + return link; + } } } else { - return target; + if (getMode(logline).startsWith("DMR")) { + return resolveTarget(getTimeslot(getMode(logline)), target); + } else { + return target; + } } } @@ -819,3 +848,21 @@ $(document).ready(function() { activateDefaultTab("lastheard"); } }); + +$(document).ready(function() { + $.ajax({ + type: "GET", + url: 'http://mmdvm-hs-hat:8000/data/TG_List.csv', + dataType: "text", + success: function(data) {processData(data);} + }); +}); + +function processData(data) { + var allRows = data.split(/\r?\n|\r/); + for (var singleRow = 1; singleRow < allRows.length; singleRow++) { + var rowCells = allRows[singleRow].split(','); + talkgroups.push([rowCells[0], rowCells[1], rowCells[2]]); + } + logIt("Parsed TGs: " + talkgroups); +} \ No newline at end of file diff --git a/html/js/version.js b/html/js/version.js index 03e9f65..4e2f8f4 100644 --- a/html/js/version.js +++ b/html/js/version.js @@ -1 +1 @@ -var dashboard_version = "2021-02-10 21:44:07"; +var dashboard_version = "2021-02-13 21:34:03";