Umbraco.CMS.Backoffice icon indicating copy to clipboard operation
Umbraco.CMS.Backoffice copied to clipboard

Feature: Collection: Sets label and icon of Workspace View

Open leekelleher opened this issue 7 months ago • 1 comments

Description

Attempts to fix:

  • https://github.com/umbraco/Umbraco-CMS/issues/16633

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 the UmbWorkspaceEditorElement 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

  • [x] New feature (non-breaking change which adds functionality)

How to test?

  1. Configure a document-type to use a collection, (Structure > Presentation > Collections)
  2. In the corresponding data-type for the Collection, set the "Content app icon" and "Content app name" fields
  3. Go to the document (either create new or existing). Has the icon and label changed?

Notes

  1. 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 to icon-grid.

  2. 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).

https://github.com/umbraco/Umbraco.CMS.Backoffice/assets/209066/6bbdaf22-4b3e-4430-962a-102f75cc6990

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.

  1. I have commented out code to handle the 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.

leekelleher avatar Jul 11 '24 16:07 leekelleher