Skip to content

Shared dashboards: Support loading shared and subscribed dashboards#3553

Merged
Simrayz merged 13 commits intofeat/2344-add-shareable-dashboardsfrom
feat/support-loading-shared-dashboards
Oct 2, 2025
Merged

Shared dashboards: Support loading shared and subscribed dashboards#3553
Simrayz merged 13 commits intofeat/2344-add-shareable-dashboardsfrom
feat/support-loading-shared-dashboards

Conversation

@Simrayz
Copy link
Copy Markdown
Contributor

@Simrayz Simrayz commented Sep 23, 2025

Scope and purpose

Resolves #3555

Dependent on #3551. Broken into its own PR to reduce review time.

Large PR, but 74% (493 lines) is added tests, as there was no existing coverage for the existing find_dashboard or index view (in terms of dashboard response).

This PR adds support for loading a shared dashboard and for the current account to toggle their subscription to it.

No-News because the parent PR has the fragment.

This pull request

  • Adds an Owner info popover, showing the shared dashboard owner and a button for toggling subscription.
  • Modifies dashboard nav to include shared dashboards
  • Modifies find_dashboard utility to include a shared dashboard.
  • Adds a get_dashboards_for_account utility that gets dashboards the current account owns or is subscribed to.
  • Modifies the dashboard nav to include shared dashboards.
  • Modifies the 'dashboard-index' and 'get-user-navlet' to return a response if the current dashboard.id is either owner by the current account or is_shared=True.

Screenshots

EDIT, 01.10.25: Updated screenshots and descriptions to match current state.

Modifications to the dashboard navigation

  • A shared dashboard is shown last, if the account is not subscribed. After subscribing, the dashboard is shown in the default order from the database.
  • A new Owner popover with subscribtion controls has been added to the header. Only visible when viewing a dashboard shared by another account.
  • A new Subscribe/Unsubscribe button when viewing a shared dashboard
  • A new "Shared" indicator which is visible when the current dashboard is shared, in addition to a dashboard owner badge. These are visible for both owned and shared dashboard.
  • A shared dashboard button has a "shared" icon with a title explaining that the dashboard is shared by another account.
image

Owner info with subscription controls

Unsubscribed Subscribed
image image

Modifications to dashboard and navlet actions

When viewing a dashboard shared by another account, the:

Dashboard actions Navlet actions
image image

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
  • The first line of the commit message 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/
  • This pull request is based 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 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

@Simrayz Simrayz self-assigned this Sep 23, 2025
@Simrayz Simrayz added enhancement nonews No news fragment is necessary for this PR (e.g. refactoring, cleanups, workflow/development changes) labels Sep 23, 2025
@Simrayz Simrayz linked an issue Sep 23, 2025 that may be closed by this pull request
@github-actions
Copy link
Copy Markdown

github-actions bot commented Sep 23, 2025

Test results

    27 files      27 suites   45m 8s ⏱️
 2 569 tests  2 569 ✅ 0 💤 0 ❌
18 942 runs  18 942 ✅ 0 💤 0 ❌

Results for commit 67424dc.

♻️ This comment has been updated with latest results.

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.20%. Comparing base (82fc7f9) to head (f4b50b2).

Additional details and impacted files
@@                          Coverage Diff                           @@
##           feat/2344-add-shareable-dashboards    #3553      +/-   ##
======================================================================
+ Coverage                               62.12%   62.20%   +0.08%     
======================================================================
  Files                                     611      611              
  Lines                                   44900    44939      +39     
  Branches                                   43       43              
======================================================================
+ Hits                                    27893    27955      +62     
+ Misses                                  16997    16974      -23     
  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 force-pushed the feat/2344-add-shareable-dashboards branch from 0c69b79 to 6549854 Compare September 24, 2025 07:32
@Simrayz Simrayz force-pushed the feat/support-loading-shared-dashboards branch from 2493ac3 to 00e542a Compare September 24, 2025 07:34
@Simrayz Simrayz requested a review from a team September 24, 2025 08:00
@Simrayz Simrayz marked this pull request as ready for review September 24, 2025 08:00
@Simrayz Simrayz changed the title Shareable dashboards: Support loading shared and subscribed dashboards Shared dashboards: Support loading shared and subscribed dashboards Sep 24, 2025
@Simrayz Simrayz force-pushed the feat/2344-add-shareable-dashboards branch from 6549854 to 1821850 Compare September 25, 2025 07:25
@Simrayz Simrayz force-pushed the feat/support-loading-shared-dashboards branch from 00e542a to 72e875f Compare September 25, 2025 07:28
@Simrayz Simrayz force-pushed the feat/2344-add-shareable-dashboards branch from 1821850 to cde7e99 Compare September 25, 2025 07:37
@Simrayz Simrayz force-pushed the feat/support-loading-shared-dashboards branch from 72e875f to d3ee6c1 Compare September 25, 2025 07:38
@hmpf hmpf self-requested a review September 25, 2025 11:03
Copy link
Copy Markdown
Contributor

@hmpf hmpf left a comment

Choose a reason for hiding this comment

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

What happens if you subscribe to multiple dashboards from the same user when you try to subscribe/unsubscribe?

@Simrayz
Copy link
Copy Markdown
Contributor Author

Simrayz commented Sep 25, 2025

What happens if you subscribe to multiple dashboards from the same user when you try to subscribe/unsubscribe?

@hmpf Just what is suspected :) You are (un)subscribed only to the dashboard you're viewing currently.

Copy link
Copy Markdown
Member

@lunkwill42 lunkwill42 left a comment

Choose a reason for hiding this comment

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

I have not done a deep-dive into the code, but instead focused on testing the new functionality, and I have found some issues:

Authorization issues

  • With this PR, the widget controls are displayed to an anonymous user (default) when viewing the system default dashboard. This is not good.

    • Attempts to delete widgets fails with an error message. Phew.
    • Attempts to move widgets around on the dashboard work, but the change does not seem persistent. Everything is restored on a page reload.
    • Some widgets allow for editing their title, like the "Status" widget. The anonymous user is allowed to change the widget title permanently under this PR, whereas it previously was not.
  • Related to this seems to be: If I am logged in as user A and share my dashboard D, then sudo to user B (using the "operate as this user" button in the user admin panel), then try to view dashboard D, I am also shown the widget control buttons. I am now even allowed to enter the widget configuration forms. Fortunately most forms respond with a failure if I try to save my configuration changes (one of them has a snappy error message about Oompa Loompas not willing to do their job).

    • If I, however, log in as user B without the sudo function, none of the widget control are displayed to me when I view dashboard D.

Usability thoughts

  • I find it somewhat difficult to deduce whether I am just watching someone else's dashboard transiently, or whether I am in fact subscribed to the dashboard I'm looking at. I think maybe the dashboard selector button should have some type of indication that this is a transient view. Dotted-line frame around the button, perhaps? (although, what about UU?) Having to click the dashboard owner's name to the right of the screen to see whether I am subscribed or not seems a bit excessive.

  • Similarly, I find myself wanting to have a better indication of whether one of my own dashboards are shared with others - without the need to use the gear button (dashboard config form) to see the share status.

Other thoughts

This is a nice piece of work, and I think we are headed in the right direction with this :)

@Simrayz Simrayz force-pushed the feat/support-loading-shared-dashboards branch from 0c679f8 to bb94025 Compare September 26, 2025 10:10
@Simrayz Simrayz force-pushed the feat/2344-add-shareable-dashboards branch from e7822ed to a697519 Compare September 26, 2025 10:21
@Simrayz Simrayz force-pushed the feat/support-loading-shared-dashboards branch from bb94025 to f3078e4 Compare September 26, 2025 10:23
@johannaengland
Copy link
Copy Markdown
Contributor

And another thought that just occurred to me: Can you make someone else's dashboard your default dashboard? And should you be able to? Because I assume that some user might want to do that - and what happens then if that one is deleted?

@Simrayz
Copy link
Copy Markdown
Contributor Author

Simrayz commented Sep 29, 2025

And another thought that just occurred to me: Can you make someone else's dashboard your default dashboard? And should you be able to? Because I assume that some user might want to do that - and what happens then if that one is deleted?

It is not possible to make a shared dashboard your default in the current system. The default dashboard is set directly on the dashboard table, while subscriptions are using a separate join table. It is possible to add a default attribute to the subscription table, and then check both for an owned default and a subscribed default. Whether it should be possible, I'm not sure, but it makes sense for those who don't want to create their own dashboards. In either case, since this was not in the list of requirements, I would prefer that this is done at a later time, either based on user demand or as a follow-up if the team thinks it is essential.

@Simrayz Simrayz force-pushed the feat/support-loading-shared-dashboards branch from 5340d39 to edd62b1 Compare September 29, 2025 09:01
@johannaengland
Copy link
Copy Markdown
Contributor

And another thought that just occurred to me: Can you make someone else's dashboard your default dashboard? And should you be able to? Because I assume that some user might want to do that - and what happens then if that one is deleted?

It is not possible to make a shared dashboard your default in the current system. The default dashboard is set directly on the dashboard table, while subscriptions are using a separate join table. It is possible to add a default attribute to the subscription table, and then check both for an owned default and a subscribed default. Whether it should be possible, I'm not sure, but it makes sense for those who don't want to create their own dashboards. In either case, since this was not in the list of requirements, I would prefer that this is done at a later time, either based on user demand or as a follow-up if the team thinks it is essential.

Yes, good idea. Depending on what @lunkwill42 and @hmpf say we can make a follow up issue. Or just forget about this

@johannaengland johannaengland requested a review from hmpf October 2, 2025 09:42
@lunkwill42
Copy link
Copy Markdown
Member

Yes, good idea. Depending on what @lunkwill42 and @hmpf say we can make a follow up issue. Or just forget about this

I think we should make a followup issue. Setting a subscribed dashboard as your default makes sense, and I'm sure many users will want to do this.

I never liked the model where the "default" is an attribute on the dashboard model itself. It would be much nicer to have it be part of the user preferences, so that only a single entry could ever be made (I guess @johannaengland still remembers the weird "no-default-dashboard" or "multiple-default-dashboards"-debaucle).

Copy link
Copy Markdown
Member

@lunkwill42 lunkwill42 left a comment

Choose a reason for hiding this comment

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

Tested from #3557, but things seem better now :-)

<div class="row navlet-header">
<div class="small-12 column">
{% if not current_user_data.account.is_default_account or current_user_data.sudoer %}
{% if navlet.can_edit or current_user_data.sudoer %}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As described in #3571 - this no longer works anyway. Not sure why. But it means that this check is partly useless atm.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will look into allowing admins to edit default account dashboards :)

@Simrayz Simrayz force-pushed the feat/support-loading-shared-dashboards branch from 2dfd09c to f4b50b2 Compare October 2, 2025 13:47
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Oct 2, 2025

@Simrayz Simrayz merged commit 3fb0328 into feat/2344-add-shareable-dashboards Oct 2, 2025
16 checks passed
@Simrayz Simrayz deleted the feat/support-loading-shared-dashboards branch October 2, 2025 13:58
@Simrayz
Copy link
Copy Markdown
Contributor Author

Simrayz commented Oct 2, 2025

Yes, good idea. Depending on what @lunkwill42 and @hmpf say we can make a follow up issue. Or just forget about this

I think we should make a followup issue. Setting a subscribed dashboard as your default makes sense, and I'm sure many users will want to do this.

I never liked the model where the "default" is an attribute on the dashboard model itself. It would be much nicer to have it be part of the user preferences, so that only a single entry could ever be made (I guess @johannaengland still remembers the weird "no-default-dashboard" or "multiple-default-dashboards"-debaucle).

Made a follow-up issue #3572

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement nonews No news fragment is necessary for this PR (e.g. refactoring, cleanups, workflow/development changes)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for viewing and subscribing to shared dashboards

4 participants