Document/Media Collections: Don't send the DataType ID to the server,
as the Management API already has logic to deal with it. Otherwise it throws an error. We still use the it on the frontend to get UI configuration. Removed the `uui-loader` as it can appear jarring.
This commit is contained in:
@@ -17,13 +17,9 @@ export class UmbDocumentCollectionServerDataSource implements UmbCollectionDataS
|
||||
throw new Error('Unique ID is required to fetch a collection.');
|
||||
}
|
||||
|
||||
if (!query.dataTypeId) {
|
||||
throw new Error('Data type ID is required to fetch a collection.');
|
||||
}
|
||||
|
||||
const params = {
|
||||
id: query.unique,
|
||||
dataTypeId: query.dataTypeId,
|
||||
dataTypeId: query.dataTypeId ?? '',
|
||||
orderBy: query.orderBy ?? 'updateDate',
|
||||
orderCulture: query.orderCulture ?? 'en-US',
|
||||
orderDirection: query.orderDirection === 'asc' ? DirectionModel.ASCENDING : DirectionModel.DESCENDING,
|
||||
|
||||
@@ -2,7 +2,7 @@ import type {
|
||||
UmbCollectionBulkActionPermissions,
|
||||
UmbCollectionConfiguration,
|
||||
} from '../../../../../core/collection/types.js';
|
||||
import { customElement, html, state } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { customElement, html, nothing, state } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
import { UmbDataTypeDetailRepository } from '@umbraco-cms/backoffice/data-type';
|
||||
import { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor';
|
||||
@@ -58,7 +58,6 @@ export class UmbDocumentWorkspaceViewCollectionElement extends UmbLitElement imp
|
||||
const config = new UmbPropertyEditorConfigCollection(dataType.values);
|
||||
return {
|
||||
unique: this._documentUnique,
|
||||
dataTypeId: dataType.unique,
|
||||
allowedEntityBulkActions: config?.getValueByAlias<UmbCollectionBulkActionPermissions>('bulkActionPermissions'),
|
||||
orderBy: config?.getValueByAlias('orderBy') ?? 'updateDate',
|
||||
orderDirection: config?.getValueByAlias('orderDirection') ?? 'asc',
|
||||
@@ -69,7 +68,7 @@ export class UmbDocumentWorkspaceViewCollectionElement extends UmbLitElement imp
|
||||
}
|
||||
|
||||
render() {
|
||||
if (!this._config?.unique || !this._config?.dataTypeId) return html`<uui-loader></uui-loader>`;
|
||||
if (!this._config?.unique) return nothing;
|
||||
return html`<umb-collection alias="Umb.Collection.Document" .config=${this._config}></umb-collection>`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { customElement, html, state } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { customElement, html, nothing, state } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
import { UmbDataTypeDetailRepository } from '@umbraco-cms/backoffice/data-type';
|
||||
import { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor';
|
||||
@@ -58,7 +58,6 @@ export class UmbMediaWorkspaceViewCollectionElement extends UmbLitElement implem
|
||||
const config = new UmbPropertyEditorConfigCollection(dataType.values);
|
||||
return {
|
||||
unique: this._mediaUnique,
|
||||
dataTypeId: dataType.unique,
|
||||
allowedEntityBulkActions: config?.getValueByAlias<UmbCollectionBulkActionPermissions>('bulkActionPermissions'),
|
||||
orderBy: config?.getValueByAlias('orderBy') ?? 'updateDate',
|
||||
orderDirection: config?.getValueByAlias('orderDirection') ?? 'asc',
|
||||
@@ -69,7 +68,7 @@ export class UmbMediaWorkspaceViewCollectionElement extends UmbLitElement implem
|
||||
}
|
||||
|
||||
render() {
|
||||
if (!this._config?.unique || !this._config?.dataTypeId) return html`<uui-loader></uui-loader>`;
|
||||
if (!this._config?.unique) return nothing;
|
||||
return html`<umb-collection .alias=${UMB_MEDIA_COLLECTION_ALIAS} .config=${this._config}></umb-collection>`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user