V15: Add abstraction for named entity detail workspaces #17959
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This is part 1 of 2 for a fix to #17514
This pull request introduced a new abstract workspace base class to use for named entities such as data types, partial views, folders, static files, etc. This is useful because a lot of the code was duplicated, and it has the added benefit of validating all of the workspaces at runtime as a namable workspace. This last part becomes important later on in the next pull request, which will introduce validation for the name field on all the affected workspaces.
The change to the data type workspace showcased in this pull request is the change, that I will add to all other workspaces in the next pull request. This demonstrates that the abstraction works.
Bonus: Added validation to all the static file handlers (partial views, scripts, stylesheets, and templates) which mimics the server. This allows us to verify that the validation works.
Workspace Context Refactoring:
src/Umbraco.Web.UI.Client/src/packages/core/entity/types.ts
: AddedUmbNamedEntityModel
interface extendingUmbEntityModel
to includename
property.src/Umbraco.Web.UI.Client/src/packages/core/workspace/entity-detail/entity-named-detail-workspace-base.ts
: CreatedUmbEntityNamedDetailWorkspaceContextBase
class to handle named entities.src/Umbraco.Web.UI.Client/src/packages/core/workspace/entity-detail/entity-named-detail-workspace.context-token.ts
: Added context token forUmbEntityNamedDetailWorkspaceContextBase
.src/Umbraco.Web.UI.Client/src/packages/data-type/workspace/data-type-workspace.context.ts
: UpdatedUmbDataTypeWorkspaceContext
to extendUmbEntityNamedDetailWorkspaceContextBase
. [1] [2] [3]How to test
Make sure you can create new data types and update existing ones.