createScaffold
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
"Elementable",
|
||||
"pickable",
|
||||
"templating",
|
||||
"umbraco",
|
||||
"variantable"
|
||||
],
|
||||
"exportall.config.folderListener": [],
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
UpdateDocumentTypeRequestModel,
|
||||
} from '@umbraco-cms/backoffice/backend-api';
|
||||
import { UmbNotificationContext, UMB_NOTIFICATION_CONTEXT_TOKEN } from '@umbraco-cms/backoffice/notification';
|
||||
import { UmbId } from '@umbraco-cms/backoffice/id';
|
||||
|
||||
type ItemType = DocumentTypeResponseModel & {$type: string};
|
||||
|
||||
@@ -129,7 +130,13 @@ export class UmbDocumentTypeRepository
|
||||
if (parentId === undefined) throw new Error('Parent id is missing');
|
||||
await this.#init;
|
||||
|
||||
return await this.#detailDataSource.createScaffold(parentId);
|
||||
const { data } = await this.#detailDataSource.createScaffold(parentId);
|
||||
|
||||
if (data) {
|
||||
this.#detailStore?.append(data);
|
||||
}
|
||||
|
||||
return { data };
|
||||
}
|
||||
|
||||
async requestById(id: string) {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { UmbDataSource, DataSourceResponse } from '@umbraco-cms/backoffice/repository';
|
||||
import type { UmbDataSource } from '@umbraco-cms/backoffice/repository';
|
||||
import { CreateDocumentTypeRequestModel, DocumentTypeResource, DocumentTypeResponseModel, UpdateDocumentTypeRequestModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources';
|
||||
import { UmbId } from '@umbraco-cms/backoffice/id';
|
||||
|
||||
/**
|
||||
* A data source for the Document Type that fetches data from the server
|
||||
@@ -47,9 +48,11 @@ export class UmbDocumentTypeServerDataSource implements UmbDataSource<CreateDocu
|
||||
* @memberof UmbDocumentTypeServerDataSource
|
||||
*/
|
||||
async createScaffold(parentId: string | null) {
|
||||
const data: CreateDocumentTypeRequestModel = {
|
||||
//id: UmbId.new(),
|
||||
// TODO: Type hack to append $type and parentId to the DocumentTypeResponseModel.
|
||||
const data: DocumentTypeResponseModel & {$type: string, parentId: string | null} = {
|
||||
$type: '',
|
||||
id: UmbId.new(),
|
||||
parentId: parentId,
|
||||
name: '',
|
||||
alias: '',
|
||||
description: '',
|
||||
@@ -62,7 +65,11 @@ export class UmbDocumentTypeServerDataSource implements UmbDataSource<CreateDocu
|
||||
compositions: [],
|
||||
allowedTemplateIds: [],
|
||||
defaultTemplateId: null,
|
||||
cleanup: undefined,
|
||||
cleanup: {
|
||||
preventCleanup: false,
|
||||
keepAllVersionsNewerThanDays: null,
|
||||
keepLatestVersionPerDayForDays: null,
|
||||
},
|
||||
properties: [],
|
||||
containers: [],
|
||||
};
|
||||
|
||||
@@ -32,6 +32,7 @@ export class UmbTemplateRepository implements UmbTreeRepository<any>, UmbDetailR
|
||||
|
||||
requestTreeRoot(): Promise<{ data?: UmbTreeRootEntityModel | undefined; error?: ProblemDetailsModel | undefined }> {
|
||||
throw new Error('Method not implemented.');
|
||||
return {data: undefined, error: undefined} as any;
|
||||
}
|
||||
|
||||
requestItemsLegacy?:
|
||||
|
||||
Reference in New Issue
Block a user