Merge pull request #1272 from umbraco/feature/content-type-collections-data-source-wireup

Wires up Content Type Collections repository/data-source
This commit is contained in:
Lee Kelleher
2024-02-26 09:50:59 +00:00
committed by GitHub
3 changed files with 6 additions and 7 deletions

View File

@@ -19,9 +19,9 @@ export class UmbDocumentWorkspaceHasCollectionCondition extends UmbBaseControlle
this.consumeContext(UMB_DOCUMENT_WORKSPACE_CONTEXT, (context) => {
this.observe(
context.contentTypeHasCollection,
(hasCollection) => {
this.permitted = hasCollection ?? false;
context.contentTypeCollection,
(collection) => {
this.permitted = !!collection?.id;
this.#onChange();
},
'observeCollection',

View File

@@ -39,7 +39,7 @@ export class UmbDocumentWorkspaceContext
readonly unique = this.#currentData.asObservablePart((data) => data?.unique);
readonly contentTypeUnique = this.#currentData.asObservablePart((data) => data?.documentType.unique);
readonly contentTypeHasCollection = this.#currentData.asObservablePart((data) => !!data?.documentType.collection);
readonly contentTypeCollection = this.#currentData.asObservablePart((data) => data?.documentType.collection);
readonly variants = this.#currentData.asObservablePart((data) => data?.variants || []);
readonly urls = this.#currentData.asObservablePart((data) => data?.urls || []);

View File

@@ -33,10 +33,9 @@ export class UmbDocumentWorkspaceViewCollectionElement extends UmbLitElement imp
this.observe(
workspaceContext.structure.ownerContentType(),
async (documentType) => {
if (!documentType) return;
if (!documentType || !documentType.collection) return;
// TODO: [LK] Temp hard-coded. Once the API is ready, wire up the data-type ID from the content-type.
const dataTypeUnique = 'c0808dd3-8133-4e4b-8ce8-e2bea84a96a4'; // documentType.collection.dataTypeId;
const dataTypeUnique = documentType.collection.unique;
if (dataTypeUnique) {
await this.#dataTypeDetailRepository.requestByUnique(dataTypeUnique);