AndyTaylorTweet / Pi-Star_DV_Dash

Pi-Star DV Dashboard (Based on works by Hans-J. Barthen (DL5DI) and Kim Huebel (DG9VH)).
http://www.pistar.uk/downloads/
111 stars 120 forks source link

Target column substitutions #91

Open RandyLoeb opened 4 years ago

RandyLoeb commented 4 years ago

I have a number of DMR talk groups I monitor, but it's hard to keep track of their numbers. I started looking at the code and make a little hack to run from the browser console window that substitutes "TG 12345" with the friendly name I want to see displayed: reloadLastHerd = function (){ $.get("/mmdvmhost/lh.php",null,function(responseText, textStatus, jqXHR){ console.log("hello"); $("#lastHerd").html(responseText //add your mappings here .replace(/TG 3112/g,"Florida 3112") .replace(/TG 31124/g,"South-East-Flori (DMR NET)") .replace(/TG 31622/g,"South East FL (SW Ranches)") .replace(/TG 31777/g,"DX Link/NQR Net") .replace(/TG KI7WKZ/g,"East Coast Reflector") //etc... ); setTimeout(reloadLastHerd,1500) }); }

Very hacky, so I'd like to handle this directly in lh.php. Basically lh.php would have access to a lookup table pairing TG X with a friendly name, and would simply replace with the friendly name (or maybe offer hover-over to see the id). Take javascript out of the equation.

Question is where would be a good place to keep this lookup table, and is there already a gui in place to let users edit such a table? I'm a little new to the software and have been just skimming the code, so figure I'd ask. 73 Randy KN4YRM

AndyTaylorTweet commented 4 years ago

Randy,

I don’t do this at the moment, because the world is larger than BM - so it gets very ugly when trying to accommodate everyone :) That may well change when I re-write the dashboard - something that has been on my to-do list for a while now….

Yes you could indeed make a TG<->Name map, and substitute them in lh.php, doing so at scale is quite a different animal from doing so with 5 TGs, and the dashboard currently consumes a lot of resources as it is (its why it needs a ground-up re-write), you could query BM for the TG list, save the file and look-up against that - and that’s probably how you might want to start out, since its the most simple method.

Andy

On 29 Nov 2019, at 03:31, RandyLoeb notifications@github.com wrote:

I have a number of DMR talk groups I monitor, but it's hard to keep track of their numbers. I started looking at the code and make a little hack to run from the browser console window that substitutes "TG 12345" with the friendly name I want to see displayed: reloadLastHerd = function (){ $.get("/mmdvmhost/lh.php",null,function(responseText, textStatus, jqXHR){ console.log("hello"); $("#lastHerd").html(responseText //add your mappings here .replace(/TG 3112/g,"Florida 3112") .replace(/TG 31124/g,"South-East-Flori (DMR NET)") .replace(/TG 31622/g,"South East FL (SW Ranches)") .replace(/TG 31777/g,"DX Link/NQR Net") .replace(/TG KI7WKZ/g,"East Coast Reflector") //etc... ); setTimeout(reloadLastHerd,1500) }); }

Very hacky, so I'd like to handle this directly in lh.php. Basically lh.php would have access to a lookup table pairing TG X with a friendly name, and would simply replace with the friendly name (or maybe offer hover-over to see the id). Take javascript out of the equation.

Question is where would be a good place to keep this lookup table, and is there already a gui in place to let users edit such a table? I'm a little new to the software and have been just skimming the code, so figure I'd ask. 73 Randy KN4YRM

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/AndyTaylorTweet/Pi-Star_DV_Dash/issues/91?email_source=notifications&email_token=AEPCN3DYP5A3CBC32EHWERTQWCEK3A5CNFSM4JS2PIIKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H4ZJGRA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEPCN3GYJCZPC6TZ4GSX5BDQWCEK3ANCNFSM4JS2PIIA.

RandyLoeb commented 4 years ago

Hi Andy,

I was thinking to do the work and submit a pull request.

I was not thinking to poll for the TG list, as some of the TGs I monitor don't seem to be listed, and further I like to name them myself to match whatever I put in the radio. I was just thinking a simple key/value pair lookup in either its own file or some section of an existing config file you might recommend as being a good place. The user goes and fills in this table themselves manually for just the TGs they care about.

For example, lh.php would check for existence of that file, if not there it does nothing. If the file exists though, it opens it and parses it and now it has its lookup table for simple string replacement of matching TGs on the way out. I guess the barebones way then would be to add this to lh.php, and "advanced" users could shell to the filesystem or otherwise move a simple text comma-delimited file over to a pre-defined directory (though would be nice to offer a gui). This is probably what I'll do for myself, as I'm not sure my javascript hack above will work in my phone browser.

As an aside, not sure what you're thinking for re-design but fwiw I work in software, including front end js frameworks, over the years jquery like you're using now, knockoutjs, some angular and lately a lot of reactjs. Worked many years ago heavily in php, was nice to see it's still around. Well anyway if you ever want to discuss re-write ideas let me know. randonloeb18@gmail.com