Show dashboards as local tasks

Created on 17 March 2023, over 1 year ago
Updated 10 January 2024, 11 months ago

Problem/Motivation

We decided to move from role-based dashboards and use permissions based dashboards, as a user can wear multiple hats.
This will show all the dashboards the user has access as local tasks.

Proposed resolution

Provide local tasks for all dashboards. User will see those he has access.
Still to figure out how to "hide" the default one, as he already has that as the default local task, so it's duplicated.

Remaining tasks

Patch. Add tests.

User interface changes

Many local tasks are shown.

Github PR: https://github.com/penyaskito/dashboard-initiative/pull/9

API changes

Consider remove the permissions and use entity_access handler.

Data model changes

None.

✨ Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @penyaskito
  • Status changed to Needs review over 1 year ago
  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    Attached screenshot

  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί
  • Status changed to RTBC over 1 year ago
  • πŸ‡ͺπŸ‡ΈSpain plopesc Valladolid

    Tested and looks great!

    Just a few minor comments that can be addressed once we have all the pieces together.

    • Find a way to refresh local actions cache once dashboards weights are modified from the UI. Changes are not reflected automatically
    • I think that default dashboard should be excluded in DashboardLocalTask::getDerivativeDefinitions. Or remove the "Default Dashboard" Having 2 local tasks pointing to the same dashboard can be confusing

    Thank you!

  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    Find a way to refresh local actions cache once dashboards weights are modified from the UI. Changes are not reflected automatically

    Unless we work on πŸ“Œ Allow plugin derivers to specify cache tags for their definitions Postponed: needs info , we need to do this manually on dashboard save.

    I think that default dashboard should be excluded in DashboardLocalTask::getDerivativeDefinitions. Or remove the "Default Dashboard" Having 2 local tasks pointing to the same dashboard can be confusing

    That's the problem. For the former, we don't know what the default dashboard is, as it will vary per user permissions, and local tasks are site-wide. For the latter, then we don't have the "parent" route for the local tasks (or will not be available if the user has not permissions for that one).

  • Status changed to Needs work over 1 year ago
  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    Thanks for reviewing :-)

    I'm putting this back to NW, so we cover point 1 from your review, and add tests.

  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    Is this enough for #4.1?

  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    Pablo suggested hook_menu_local_tasks_alter and got it to work. Attached patch. We just need tests now :-)

  • Assigned to gxleano
  • πŸ‡ͺπŸ‡ΈSpain gxleano CΓ‘ceres
  • πŸ‡ͺπŸ‡ΈSpain gxleano CΓ‘ceres

    I will take a look on this.

  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί
  • πŸ‡ͺπŸ‡ΈSpain gxleano CΓ‘ceres

    Answering comment #7 ✨ Show dashboards as local tasks Fixed , on my eyes it should be enough from now, I've tested modifying the weight of the different dashboard and it is automatically modified.

    About comment #8 ✨ Show dashboards as local tasks Fixed , also tested, we are not showing two local tasks pointing to the same dashboard anymore.

    @penyaskito, should we move this issue to RTBC?

  • πŸ‡ͺπŸ‡ΈSpain gxleano CΓ‘ceres
  • Status changed to Needs review over 1 year ago
  • πŸ‡ͺπŸ‡ΈSpain plopesc Valladolid

    Attaching new iteration including automated tests for the Local Tasks.

    We might need to discuss whether the "Administer dashboard" permission. bypass access to all the dashboards in /admin/dashboard, or the dashboard status and/or individual permissions should take precedence.

  • Issue was unassigned.
  • πŸ‡ͺπŸ‡ΈSpain plopesc Valladolid
  • πŸ‡ͺπŸ‡ΈSpain plopesc Valladolid

    Hi!

    While working on the tests for this one, I realize that we need to determine the behavior for users that have "Administer Dashboards" permission.

    In theory, this permissions bypass access to the dashboard entities. With the current behavior all the dashboards would be available, even the unpublished ones as local tasks in /admin/dashboard.

    This might make the /admin/dashboard page messy for these users. On the other hand, this is the only place where admin users can see the different dashboards.

    I thought about this and here is a different proposal to maintain /admin/dashboard page cleaner:

    • Dashboard page (/admin/dashboard) will include only the dashboards the users has access to based on the individual dashboard permissions
    • When managing the dashboard a new Preview tab will be added /admin/structure/dashboard/{dashboard}/preview from where users with permissions to edit the dashboard will be able to see the same output as in /admin/dashboard/{dashboard}, even if they don't have explicit access to the dashboard.

    What do you think? Should we deal with this as part of this issue or move the discussion to a separate one?

  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    I love the idea!

    I'd think we should take that as a follow-up though and try to get things closed.

  • πŸ‡ͺπŸ‡ΈSpain plopesc Valladolid

    Agreed!

    Let's close this one and open the follow-up then.

  • Status changed to Fixed over 1 year ago
  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    Didn't test this locally but code review looks good. I'm committing this.

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Fixed 11 months ago
  • πŸ‡ͺπŸ‡ΈSpain plopesc Valladolid
Production build 0.71.5 2024