-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Collection: Sets label and icon of Workspace View #2113
base: main
Are you sure you want to change the base?
Feature: Collection: Sets label and icon of Workspace View #2113
Conversation
Quality Gate failedFailed conditions See analysis details on SonarCloud Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
|
||
// TODO: Review how `showContentFirst` is implemented, and how to re-route/redirect the path. | ||
// e.g. the "Content" tab shows the "Collection" view. [LK] | ||
if (showContentFirst) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the only right way to do this, would be to manipulate the weight of the Collection based on this setting. (
Maybe assuming that content has a certain weight?)
Not completely sure how at the moment of writing this, but if feels wrong to sort the views, also notice how they can come and go depending on conditions. Atleast of now, then it should use the weight to sort and then make sure to sort(& change weight based on setting) in the #createViews
method.
import type { UmbRoute, UmbRouterSlotInitEvent, UmbRouterSlotChangeEvent } from '@umbraco-cms/backoffice/router'; | ||
|
||
const elementName = 'umb-workspace-editor'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a optimization we want to implement in general, I think it is a bit of an overload and I must admit i'm in for consistency. And using a variable twice use is not directly enough to trigger my need for this, especially because the later one is only used by TypeScript, so basically we are crating a const to use it once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There have been many cases where there has been a mismatch between the registered element name and the type because we have renamed elements over time. I think this is a reasonable way to avoid that.
Description
When setting a custom label and icon for a Collection (data-type), the workspace view's label and icon were not being updated.
This PR adds a
UmbWorkspaceEditorContext
, which moves logic from theUmbWorkspaceEditorElement
to collect the manifests and build the routes & views.The context exposes a method
.setWorkspaceViewMeta()
to enable a workspace view's label and icon be configured, (based on the workspace view's extension alias).Types of changes
How to test?
Notes
There is an edge-case, where a server-side migration (for v14) sets the default icon for a Collection to be
icon-badge color-black
, but that particular icon doesn't exist in the backoffice for v14. So I have added a check for this, and set it toicon-grid
.There is an annoying UI glitch, where the default icon and label (from the Collection manifest) is displayed, before changing to the custom icon and label. (Sometimes it happens faster, other times slow, try setting the video playback speed to 0.25x).
Recording.2024-07-11.171936.mp4
This is because the Workspace Editor loads in the Workspace View manifests first, then it can calculate the routes, then the Workspace View Collection is loaded in (from that route), which then has access to the data-type configuration and sets the custom icon and label.
showContentFirst
, but I hit various issues that I'm not currently able to resolve. e.g. moving the "Content" workspace to the first position, but the route doesn't update, so it displays the "Collection" instead. There is also a similar UI glitch with the Workspace View tabs updating, (it shows "Collection" first, then suddenly swaps with "Content").I'll mark this PR as a draft until we've addressed the above issues.