Use sensor labels for overview/inventory pages, refactor some html-page related code #10287
TLDR: this pull request mostly contains some clean-up work to move similar code that was replicated across several html pages into functions.inc.php, and it enables new-style labels for the device overview and device entity-physical/inventory pages.
DO NOT DELETE THIS TEXT
If you would like to test this pull request then please run:
Hi @murrant - I've made some new commits that resolve the merge conflict and fix two typos in the language files. :)
Out of curiosity, I see that the calls to function
EDIT, sharing this for posterity, I was pointed to the Laravel translation docs concerning the
referenced this pull request
Jun 8, 2019
@murrant do you need anything else for this one? Because PR #10327 which was merged today has documentation which "depends" on the fact that we replaced get_unit_for_sensor_class() with the Laravel translation code for sensor class units (eg it omits a reference to the old function that was deleted here in PR #10287).
The overview was the only page which didn't already show the raw state value in the label:
The inventory page didn't do state translation at all before and only showed a raw number, which triggered me to begin investigating this part of the code and submit this PR:
All other pages already displayed it as
I wanted to make things consistent and figured that more information/visibility is usually better, moreover, I don't know whether someone might be using the raw value for things which could cause issues when taken away.
Finally, the rrdtool generated graphs don't do state translations right now, so it might be helpful to know the raw value it's currently at to see whether there have been recent changes.
However, if you don't like it, feel free to let me know and I'll remove
As I said I'm not particularly attached to the raw value, so I've removed it. ;) In effect there's a "tooltip" already in a sense that you can see small versions of the rrd graphs when you hold your mouse over the label, so that is then good enough.
Maybe we can experiment with adding the state translation info for that sensor in the graph legend, but I'd say that's something for another PR.