Closed (fixed)
Project:
Dashboard
Version:
2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 Apr 2023 at 22:51 UTC
Updated:
10 Jan 2024 at 11:37 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
penyaskitoThis patch applies on top of #3348617: Show dashboards as local tasks, so postponing on that one.
Comment #3
penyaskitoOops I renamed the route last minute, changing local tasks too.
Comment #4
penyaskitoI think visually it's less weird with a local action instead of local tasks, which produces all kind of weird behaviors as we are using as a local task a route that has already its own local tasks, so we see duplicated tabs etc (even when trying a secondary level). Ideally we would revisit this when/if https://www.drupal.org/project/ideas/issues/3325034 materializes.
Comment #5
penyaskitoI let both implementations for comparison at the tugboats at:
local task: https://github.com/penyaskito/dashboard-initiative/pull/10
local action: https://github.com/penyaskito/dashboard-initiative/pull/17
Comment #6
plopescHi,
Thank you for your great work here. Tested both Tugboat environments, and I would go for the Local Action based approach.
It looks cleaner to me. The "Edit Layout" local task at the same level can be confusing and it requires the extra redirect you mentioned.
In case we want to follow the local tasks path, we might try to add the
parent_idproperty to show it in a second level, like in/admin/structure/block.Comment #7
penyaskitoBoth options would require an intermediate redirect for the "default" dashboard. And you can't specify a parent_id (or a base route) with arguments, or I didn't found a way, so the local tasks ended up being a mess (even more with a second level).
Maybe you want to give it a try?
Comment #8
plopescAgree that nested local tasks can be problematic, so let's put them apart for now.
Attaching patch following a custom local task class approach instead of the intermediate controller. This approach could be useful as well if we need to move to local tasks in the future.
Comment #9
andypostcould return type ?DashboardInterface
could be moved to
protected DashboardManager $dashboard_managerin constructorComment #10
plopescBack to Needs Review once #3348617 is already merged.
Thank you for your review @andypost. I'm fine these PHP 8.1 style code changes, but I don't know what's the policy about it in Drupal core right now. Reviewed some modules and apparently they're not not following it yet. In any case I would do it at once for the whole module at some point instead of following it in specific places and other don't.
Comment #11
andypostCore started to adopt constructor promotions already, it helps to minimize boilerplate for properties.
Comment #12
penyaskitoI agree with @andypost here. Better start doing it already than accumulating more tech debt.
I've tested this and it looks great. @plopesc Happy to merge this as is, and we do a quick round of constructor promotions in a follow-up?
Comment #13
plopescSounds like a plan!
Thank you for checking it.
Comment #14
penyaskitoComment #15
penyaskitoCreated https://www.drupal.org/project/3327580/issues/3367934
Committing this now after checking in https://github.com/penyaskito/dashboard-initiative/pull/19 that works as expected and tests pass.
Comment #16
penyaskitoThanks!
Comment #18
plopesc