Skip to content

Add support for fixed tooltips and fix status widget tooltip bug#3576

Merged
Simrayz merged 5 commits intomasterfrom
fix/3301-status-widget-popup-not-closing
Oct 10, 2025
Merged

Add support for fixed tooltips and fix status widget tooltip bug#3576
Simrayz merged 5 commits intomasterfrom
fix/3301-status-widget-popup-not-closing

Conversation

@Simrayz
Copy link
Copy Markdown
Contributor

@Simrayz Simrayz commented Oct 6, 2025

Scope and purpose

Fixes #3301.

The bug described in #3301 has been reported multiple times by users, and while fixing it I discovered that the tooltips were not rendering at all. This was due to a delegate_tooltip plugin which still used Foundation. In addition, the delegate_tooltip plugin fetched data with javascript and rendered the returned content. I changed the data fetching to use an htmx call with a mouseover once hx-trigger, which only runs the first time a tooltip trigger is hovered.

When refactoring to use a nav tooltip, I discovered that the tooltip caused layout shifts inside the navlet. This is because the container is quite small, and has automatic scroll bars. In order to fix it I had to add support for fixed position tooltips. When .nav-tooltip is annotated with data-position="fixed", the tooltip is automatically positioned below the trigger element, but without affecting the flow of the page.

This pull request

  • Adds support for fixed position tooltips
  • Fixes status widget tooltips on interface alerts
  • Fixes tooltips in tree_list.html template in SeedDb tool
  • Removes delegate_tooltip plugin

How to test

The tree list changes can be verified on the Seed database: Locations and Seed database: Organizations pages.

Testing the fix in the Status2 widget is a bit more involved. A full description of the bug can be found in #3301, but personally I followed this procedure:

  1. Make sure you have a status widget in your dashboard
  2. Choose a Netbox with interfaces to add an event to, and get the id of an interface.
  3. Create a new AlertHistory entry, with the following values:
    AlertHistory(
        netbox_id=<netbox id>, 
        subid=<interface id>,
        event_type_id='linkState',
        alert_type_id=27,
        source_id='ipdevpoll',
        start_time=datetime.datetime.now(),
        end_time=datetime.datetime.max,
        value=1
    )
    • eventtypeid='linkState' is required for the interface tooltip to render, and alerttypeid=27 refers to the linkDown alert.
    • Alternatively, modify a recent existing alert by adding a subid (Interface id) and changing event_type_id and alert_type_id.
  4. After saving the new alert, it should be visible in the status widget. If it is not visible, check the filters on the widget.

Screenshots

All before screenshots are from the "5.14.x" branch.

Before After Comment
image image Interface (linkDown) tooltip in a long list of alerts, rendered on top of the navlet (fixed position).
image image Interface (linkdown) tooltip in a short list of alerts, rendered on top of the navlet (fixed position)
image image Tooltip in organization tree list.
image image Tooltip in location tree list.

Contributor Checklist

Every pull request should have this checklist filled out, no matter how small it is.
More information about contributing to NAV can be found in the
Hacker's guide to NAV.

  • Added a changelog fragment for towncrier
  • Added/amended tests for new/changed code
  • Added/changed documentation
  • Linted/formatted the code with ruff, easiest by using pre-commit
  • Wrote the commit message so that the first line continues the sentence "If applied, this commit will ...", starts with a capital letter, does not end with punctuation and is 50 characters or less long. See https://cbea.ms/git-commit/
  • Based this pull request on the correct upstream branch: For a patch/bugfix affecting the latest stable version, it should be based on that version's branch (<major>.<minor>.x). For a new feature or other additions, it should be based on master.
  • If applicable: Created new issues if this PR does not fix the issue completely/there is further work to be done
  • If it's not obvious from a linked issue, described how to interact with NAV in order for a reviewer to observe the effects of this change first-hand (commands, URLs, UI interactions)
  • If this results in changes in the UI: Added screenshots of the before and after
  • If this adds a new Python source code file: Added the boilerplate header to that file

@github-actions
Copy link
Copy Markdown

github-actions bot commented Oct 6, 2025

Test results

    27 files      27 suites   45m 10s ⏱️
 2 586 tests  2 586 ✅ 0 💤 0 ❌
19 078 runs  19 078 ✅ 0 💤 0 ❌

Results for commit 2f79324.

♻️ This comment has been updated with latest results.

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.21%. Comparing base (35ca868) to head (005b072).
⚠️ Report is 297 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3576      +/-   ##
==========================================
+ Coverage   62.20%   62.21%   +0.01%     
==========================================
  Files         611      611              
  Lines       44939    44939              
  Branches       43       43              
==========================================
+ Hits        27955    27960       +5     
+ Misses      16974    16969       -5     
  Partials       10       10              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Simrayz Simrayz self-assigned this Oct 6, 2025
@Simrayz Simrayz requested a review from a team October 6, 2025 14:18
@Simrayz Simrayz force-pushed the fix/3301-status-widget-popup-not-closing branch 2 times, most recently from b44e609 to 6bead60 Compare October 7, 2025 08:27
@Simrayz Simrayz marked this pull request as ready for review October 7, 2025 08:34
@Simrayz Simrayz force-pushed the fix/3301-status-widget-popup-not-closing branch from 6bead60 to a07aea7 Compare October 8, 2025 08:54
Copy link
Copy Markdown
Contributor

@johannaengland johannaengland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the locations and the organizations tooltips there is a difference on how they are positioned:
Before:
image

After:
image

I do think it is much easier to navigate with the tooltip flowing to the right of the entries

And for the status widget I was able to produce this:
IMG_20251008_154749

Here I would assume that the triangle should move down

@Simrayz
Copy link
Copy Markdown
Contributor Author

Simrayz commented Oct 9, 2025

@johannaengland I made some changes (fixups):

  • Adjusted position of tree tooltips to align to the start of the tooltip
  • Added support for positioning the tooltip on top when they extend beyond the viewport. Also did some minor refactoring to clearly separate logic for fixed and normal (absolute) tooltips.

@Simrayz Simrayz requested a review from johannaengland October 9, 2025 11:30
@Simrayz Simrayz force-pushed the fix/3301-status-widget-popup-not-closing branch from 2f79324 to 005b072 Compare October 10, 2025 11:34
@Simrayz Simrayz merged commit 73b8733 into master Oct 10, 2025
12 of 13 checks passed
@Simrayz Simrayz deleted the fix/3301-status-widget-popup-not-closing branch October 10, 2025 11:34
@sonarqubecloud
Copy link
Copy Markdown

@Simrayz Simrayz mentioned this pull request Oct 20, 2025
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Status widget interface pop-up will sometimes get stuck

2 participants