Show non standard attributes in popup

bitconbyte2 years ago

Hi all forum members

We use an middleware layer program in node-red. Let me explain. Node red flow gets the real message from the device, flow prepares the information and sends it to the traccar platform via osmand protocol.
We create some "new" attributes like coordinates in DDmmsss format, battery in volts, decoded status.
These data is passed in the http osmand like:
http://dummy.net:5055/?id=xxxx&lat=xx.982376&lon=yy.843086&batt=3.5&LatDMS=xx*xx'56.580"N&LonDMS=yy*yy'35.100"W&motivo=Move
We'd need to display these new attributes in the popup (when clicking on a device) Is it possible?
BTW, we're using V 5.4 platform version.

Thanks for your help!

Nikolay 2 years ago

Yes, it is possible
You need to change the front-end app

Same thing like that -> click

Anton Tananaev2 years ago

You don't need to change the front end. You can show any custom attributes in the pop-up. You might need to upgrade to the latest version though.

bitconbyte2 years ago

Hi Nikolay and Anton
Thanks for your response, I've followed what seems to me the correct way to do it, but I get this error
[Error] (https://ibb.co/cF8DdsY)

Settings->Devices->Add.
Attributes-> Add -> LatDMS (name of the custom attributes) as String
Save

Settings ->Map -> Popup Info -> Add the LatDMS field.

And then....error.
I'm already upgraded to the V5.5 thanks to the nice Traccar Tools !

Any hint?

Anton Tananaev2 years ago

Have you cleared the browser cache after upgrade?

bitconbyte2 years ago

Nooop, I'm going to try it! Thanks Anton

bitconbyte2 years ago

No luck! :-(
Same error:

TypeError: Cannot read properties of undefined (reading 'name')
    at http://x.x.x.x:8082/static/js/main.276d165c.js:2:3326905
    at Array.map ()

Browser cache has been cleared. Error appears as soon as LatDMS (new attribute) is added to the popup fields.

Anton Tananaev2 years ago

Looks like it was fixed after the release, so you need to wait for the next release or build from source:

https://github.com/traccar/traccar-web/commit/877108d9012301f2b149ae862af4cffe17dfb20d

bitconbyte2 years ago

Thanks Anton. Any idea about the time it could take for this next release?

Anton Tananaev2 years ago

Don't have any dates yet.

bitconbyte2 years ago

Hi again Anton.
I've just upgraded to 5.6 server. When popup should show with the custom attributes, an error shows:

TypeError: Cannot read properties of undefined (reading 'name')
    at hxxx://xxx.com/static/js/main.276d165c.js:2:3326905
    at Array.map ()
    at bb (hxxx://xxx.com/static/js/main.276d165c.js:2:3326872)
    at To (hxxx://xxx.com/static/js/main.276d165c.js:2:675512)
    at Ds (hxxx://xxx.com/static/js/main.276d165c.js:2:687200)
    at Ml (hxxx://xxx.com/static/js/main.276d165c.js:2:733635)
    at bc (hxxx://xxx.com/static/js/main.276d165c.js:2:721688)
    at vc (hxxx://xxx.com/static/js/main.276d165c.js:2:721616)
    at gc (hxxx://xxx.com/static/js/main.276d165c.js:2:721479)
    at ic (hxxx://xxx.com/static/js/main.276d165c.js:2:718259)

I think it's the same error that appeared in the 5.5 version.

Any idea?

Thanks!

Anton Tananaev2 years ago

That's an error message from version 5.5. Are you sure you installed the right version? Also don't forget to clear your browser cache.

bitconbyte2 years ago

Thanks Anton. Server was running 5.6 version but it seems that my browser was still using a cached copy. Error has gone now.