New backoffice - trees design (#12963)

* Refactor: Add default versioned back office route attribute

* Tree controller bases and first draft implementations for document, media and doctype

* Move tree item view models to appropriate location

* Fix missing parent

* Refactor user entity access for testability

* A bit of clean-up + handle user start nodes for items endpoint

* Implement foldersOnly for folder tree

* Items endpoint for document type tree

* Strongly typed action results

* Content + media recycle bin

* Correct return type for swagger

* Member type tree

* Rename user start node handling to make a little more sense

* Revert to faked admin start nodes in document tree

* Media type tree

* Data type tree

* Relation type tree

* Remove unused dependency from member type tree

* Correct documentation for member type tree endpoint response types

* Use icon constants

* Add templates tree

* Member group tree

* Document blueprint tree

* Partial views, scripts and stylesheets trees

* Static files tree

* Clarify "folders only" state

* Comments and improved readability

* Rename TreeControllerBase and TreeItemViewModel

* Move recycle bin controller base to its own namespace

* Moved tree base controllers to their own namespace

* Common base class for tree view models

* Remove ProblemDetails response type declaration from all actions

* Add OpenApiTag

* Various review comments

* Dictionary item tree

* Renamed all tree controllers to follow action/feature naming convention

* Handle client culture state for document tree

* Support "ignore user start nodes" for content and media + refactor how tree states work to make things more explicit

* Fix or postpone a few TODOs

* Make entity service able to paginate trashed children

* Handle sorting explicitly

* Re-apply VersionedApiBackOfficeRoute to install and upgrade controllers after merge

* Use PagedViewModel instead of PagedResult for all trees

* Explain the usage of UmbracoObjectTypes.Unknown

* Introduce and apply GetMany pattern for dictionary items

* Add a note about relation type caching

* Fix broken test build + add unit tests for new localization service methods

* Use new management API controller base

* Entity repository should build document entities for document blueprints when getting paged entities (same as it does when getting specific entities)

* Use Media type for Media recycle bin

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Move shared relation service to concrete implementations

* Use inclusive language

* Add 401 response type documentation to applicable trees

* Refactor entity load for folder tree controller base + ensure that folders are only included in the first result page

* Add (in-memory) pagination to dictionary tree

* Make file system controller honor paging parameters

* Support pagination in relation type tree

* Clarify method name a bit for detecting tree root path requests

* Update Open API schema to match new trees

* Move from page number and page size to skip/take (with temporary workaround for lack of property skip/take pagination in current DB implementation)

* Update OpenAPI schema to match skip/take

* Update OpenAPI schema

* Don't return paginated view models from "items" endpoints

* Update OpenApi schema

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>
This commit is contained in:
Kenn Jacobsen
2022-09-28 13:37:59 +02:00
committed by GitHub
parent 3752f51625
commit 134b193c74
103 changed files with 5976 additions and 255 deletions

View File

@@ -33,6 +33,13 @@ internal class DictionaryRepository : EntityRepositoryBase<int, IDictionaryItem>
return uniqueIdRepo.Get(uniqueId);
}
public IEnumerable<IDictionaryItem> GetMany(params Guid[] uniqueIds)
{
var uniqueIdRepo = new DictionaryByUniqueIdRepository(this, ScopeAccessor, AppCaches,
_loggerFactory.CreateLogger<DictionaryByUniqueIdRepository>());
return uniqueIdRepo.GetMany(uniqueIds);
}
public IDictionaryItem? Get(string key)
{
var keyRepo = new DictionaryByKeyRepository(this, ScopeAccessor, AppCaches,
@@ -40,6 +47,13 @@ internal class DictionaryRepository : EntityRepositoryBase<int, IDictionaryItem>
return keyRepo.Get(key);
}
public IEnumerable<IDictionaryItem> GetManyByKeys(string[] keys)
{
var keyRepo = new DictionaryByKeyRepository(this, ScopeAccessor, AppCaches,
_loggerFactory.CreateLogger<DictionaryByKeyRepository>());
return keyRepo.GetMany(keys);
}
public Dictionary<string, Guid> GetDictionaryItemKeyMap()
{
var columns = new[] { "key", "id" }.Select(x => (object)SqlSyntax.GetQuotedColumnName(x)).ToArray();

View File

@@ -680,7 +680,8 @@ internal class EntityRepository : RepositoryBase, IEntityRepositoryExtended
private EntitySlim BuildEntity(BaseDto dto)
{
if (dto.NodeObjectType == Constants.ObjectTypes.Document)
if (dto.NodeObjectType == Constants.ObjectTypes.Document
|| dto.NodeObjectType == Constants.ObjectTypes.DocumentBlueprint)
{
return BuildDocumentEntity(dto);
}

View File

@@ -55,7 +55,7 @@ internal abstract class SimpleGetRepository<TId, TEntity, TDto> : EntityReposito
protected override IEnumerable<TEntity> PerformGetAll(params TId[]? ids)
{
Sql<ISqlContext> sql = Sql().From<TEntity>();
Sql<ISqlContext> sql = Sql().From<TDto>();
if (ids?.Any() ?? false)
{