Fix report $explain_ tooltips when $name_ is also set#3877
Conversation
The `explain` dict is keyed by the original SQL field name, but the lookup happened after `title` was already overridden by the display name from `$name_`. This caused the lookup to always miss for columns that have both directives. Fixes #3876
|
Test results 20 files 20 suites 25m 24s ⏱️ Results for commit d8b37dd. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 5.17.x #3877 +/- ##
==========================================
- Coverage 63.49% 63.49% -0.01%
==========================================
Files 620 620
Lines 45923 45923
Branches 43 43
==========================================
- Hits 29160 29158 -2
- Misses 16753 16755 +2
Partials 10 10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
$explain_ tooltips when $name_ is also set
johannaengland
left a comment
There was a problem hiding this comment.
Works great, but you might want to change the issue description, since the sysname column in /report/swport does not have $explain_ - it took me so long to figure it out until I saw that the to_netboxid column for example has a tooltip



Scope and purpose
Fixes #3876.
The
$explain_directive in the report configuration is supposed to add a tooltip to column headers, but the tooltip never appears when the column also has a$name_override. Theexplaindict is keyed by the original SQL field name, but the lookup inmake_table_headershappened after the field name had already been replaced by the display name from$name_. This caused the lookup to silently miss for any column that uses both directives (13 of 24 existing$explain_usages are affected).The fix is to look up the explanation before overriding the title.
Contributor Checklist
Added/amended tests for new/changed codeAdded/changed documentation<major>.<minor>.x). For a new feature or other additions, it should be based onmaster.If applicable: Created new issues if this PR does not fix the issue completely/there is further work to be doneIf this results in changes in the UI: Added screenshots of the before and afterIf this adds a new Python source code file: Added the boilerplate header to that file