clean up models
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const { rest } = window.MockServiceWorker;
|
||||
|
||||
import { umbracoPath } from '@umbraco-cms/backoffice/utils';
|
||||
import { ProblemDetailsModel, RuntimeLevelModel, ServerStatusResponseModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { ProblemDetails, RuntimeLevelModel, ServerStatusResponseModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { expect, test } from './test.js';
|
||||
|
||||
test.describe('installer tests', () => {
|
||||
@@ -62,7 +62,7 @@ test.describe('installer tests', () => {
|
||||
return res(
|
||||
// Respond with a 200 status code
|
||||
ctx.status(400),
|
||||
ctx.json<ProblemDetailsModel>({
|
||||
ctx.json<ProblemDetails>({
|
||||
status: 400,
|
||||
type: 'validation',
|
||||
detail: 'Something went wrong',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { rest } = window.MockServiceWorker;
|
||||
import { umbracoPath } from '@umbraco-cms/backoffice/utils';
|
||||
import { ProblemDetailsModel, RuntimeLevelModel, ServerStatusResponseModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { ProblemDetails, RuntimeLevelModel, ServerStatusResponseModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { expect, test } from './test.js';
|
||||
|
||||
test.describe('upgrader tests', () => {
|
||||
@@ -43,7 +43,7 @@ test.describe('upgrader tests', () => {
|
||||
return res(
|
||||
// Respond with a 200 status code
|
||||
ctx.status(400),
|
||||
ctx.json<ProblemDetailsModel>({
|
||||
ctx.json<ProblemDetails>({
|
||||
status: 400,
|
||||
type: 'error',
|
||||
detail: 'Something went wrong',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { css, html, nothing, customElement, property } from '@umbraco-cms/backoffice/external/lit';
|
||||
import type { ProblemDetailsModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import type { ProblemDetails } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
|
||||
|
||||
/**
|
||||
@@ -23,7 +23,7 @@ export class UmbAppErrorElement extends UmbLitElement {
|
||||
@property()
|
||||
error?: unknown;
|
||||
|
||||
private renderProblemDetails = (problemDetails: ProblemDetailsModel) => html`
|
||||
private renderProblemDetails = (problemDetails: ProblemDetails) => html`
|
||||
<h2>${problemDetails.title}</h2>
|
||||
<p>${problemDetails.detail}</p>
|
||||
<pre>${problemDetails.stack}</pre>
|
||||
@@ -35,7 +35,7 @@ export class UmbAppErrorElement extends UmbLitElement {
|
||||
<pre>${error.stack}</pre>
|
||||
`;
|
||||
|
||||
private isProblemDetails(error: unknown): error is ProblemDetailsModel {
|
||||
private isProblemDetails(error: unknown): error is ProblemDetails {
|
||||
return typeof error === 'object' && error !== null && 'detail' in error && 'title' in error;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
DatabaseInstallResponseModel,
|
||||
DatabaseSettingsPresentationModel,
|
||||
InstallResource,
|
||||
ProblemDetailsModel,
|
||||
ProblemDetails,
|
||||
} from '@umbraco-cms/backoffice/backend-api';
|
||||
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
|
||||
import { tryExecute } from '@umbraco-cms/backoffice/resources';
|
||||
@@ -216,7 +216,7 @@ export class UmbInstallerDatabaseElement extends UmbLitElement {
|
||||
history.replaceState(null, '', 'section/content');
|
||||
}
|
||||
|
||||
private _handleRejected(e: ProblemDetailsModel) {
|
||||
private _handleRejected(e: ProblemDetails) {
|
||||
this._installerContext?.setInstallStatus(e);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { UmbInstallerContext, UMB_INSTALLER_CONTEXT_TOKEN } from '../installer.context.js';
|
||||
import { css, CSSResultGroup, html, nothing, customElement, state } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { ProblemDetailsModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { ProblemDetails } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
|
||||
|
||||
@customElement('umb-installer-error')
|
||||
export class UmbInstallerErrorElement extends UmbLitElement {
|
||||
@state()
|
||||
_error?: ProblemDetailsModel;
|
||||
_error?: ProblemDetails;
|
||||
|
||||
private _installerContext?: UmbInstallerContext;
|
||||
|
||||
@@ -34,7 +34,7 @@ export class UmbInstallerErrorElement extends UmbLitElement {
|
||||
this._installerContext?.reset();
|
||||
}
|
||||
|
||||
private _renderError(error: ProblemDetailsModel) {
|
||||
private _renderError(error: ProblemDetails) {
|
||||
return html`
|
||||
<p>Description: ${error.title}</p>
|
||||
${error.errors ? this._renderErrors(error.errors) : nothing}
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
InstallVResponseModel,
|
||||
InstallResource,
|
||||
InstallSettingsResponseModel,
|
||||
ProblemDetailsModel,
|
||||
ProblemDetails,
|
||||
TelemetryLevelModel,
|
||||
} from '@umbraco-cms/backoffice/backend-api';
|
||||
import { tryExecute } from '@umbraco-cms/backoffice/resources';
|
||||
@@ -29,7 +29,7 @@ export class UmbInstallerContext {
|
||||
private _settings = new UmbObjectState<InstallSettingsResponseModel | undefined>(undefined);
|
||||
public readonly settings = this._settings.asObservable();
|
||||
|
||||
private _installStatus = new UmbObjectState<ProblemDetailsModel | null>(null);
|
||||
private _installStatus = new UmbObjectState<ProblemDetails | null>(null);
|
||||
public readonly installStatus = this._installStatus.asObservable();
|
||||
|
||||
constructor() {
|
||||
@@ -49,10 +49,10 @@ export class UmbInstallerContext {
|
||||
/**
|
||||
* Observable method to get the install status in the installation process
|
||||
* @public
|
||||
* @return {*} {(Observable<ProblemDetailsModel | null>)}
|
||||
* @return {*} {(Observable<ProblemDetails | null>)}
|
||||
* @memberof UmbInstallerContext
|
||||
*/
|
||||
public installStatusChanges(): Observable<ProblemDetailsModel | null> {
|
||||
public installStatusChanges(): Observable<ProblemDetails | null> {
|
||||
return this.installStatus;
|
||||
}
|
||||
|
||||
@@ -107,10 +107,10 @@ export class UmbInstallerContext {
|
||||
/**
|
||||
* Set the install status
|
||||
* @public
|
||||
* @param {(ProblemDetailsModel | null)} status
|
||||
* @param {(ProblemDetails | null)} status
|
||||
* @memberof UmbInstallerContext
|
||||
*/
|
||||
public setInstallStatus(status: ProblemDetailsModel | null): void {
|
||||
public setInstallStatus(status: ProblemDetails | null): void {
|
||||
this._installStatus.next(status);
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
export * from './src';
|
||||
export * from './src/index.js';
|
||||
|
||||
@@ -691,7 +691,6 @@ class UmbDataTypeData extends UmbEntityData<DataTypeResponseModel | FolderTreeIt
|
||||
name: folder.name,
|
||||
id: folder.id,
|
||||
parentId: folder.parentId,
|
||||
$type: 'FolderTreeItemResponseModel',
|
||||
isFolder: true,
|
||||
isContainer: false,
|
||||
};
|
||||
|
||||
@@ -41,7 +41,6 @@ const dictionaryTree: Array<EntityTreeItemResponseModel> = [
|
||||
hasChildren: true,
|
||||
type: 'dictionary-item',
|
||||
isContainer: false,
|
||||
icon: 'umb:book-alt',
|
||||
},
|
||||
{
|
||||
parentId: 'aae7d0ab-53ba-485d-b8bd-12537f9925cb',
|
||||
@@ -50,7 +49,6 @@ const dictionaryTree: Array<EntityTreeItemResponseModel> = [
|
||||
hasChildren: false,
|
||||
type: 'dictionary-item',
|
||||
isContainer: false,
|
||||
icon: 'umb:book-alt',
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -1057,7 +1057,6 @@ export const data: Array<DocumentTypeResponseModel> = [
|
||||
|
||||
export const treeData: Array<DocumentTypeTreeItemResponseModel> = [
|
||||
{
|
||||
$type: 'DocumentTypeTreeItemViewModel',
|
||||
name: 'All property editors document type',
|
||||
type: 'document-type',
|
||||
hasChildren: false,
|
||||
@@ -1067,7 +1066,6 @@ export const treeData: Array<DocumentTypeTreeItemResponseModel> = [
|
||||
icon: '',
|
||||
},
|
||||
{
|
||||
$type: 'DocumentTypeTreeItemViewModel',
|
||||
name: 'Page Document Type',
|
||||
type: 'document-type',
|
||||
hasChildren: false,
|
||||
@@ -1077,7 +1075,6 @@ export const treeData: Array<DocumentTypeTreeItemResponseModel> = [
|
||||
icon: 'umb:document',
|
||||
},
|
||||
{
|
||||
$type: 'DocumentTypeTreeItemViewModel',
|
||||
name: 'Page Document Type Compositional',
|
||||
type: 'document-type',
|
||||
hasChildren: false,
|
||||
@@ -1087,7 +1084,6 @@ export const treeData: Array<DocumentTypeTreeItemResponseModel> = [
|
||||
icon: 'umb:document',
|
||||
},
|
||||
{
|
||||
$type: 'DocumentTypeTreeItemViewModel',
|
||||
name: 'Page Document Type Inherited',
|
||||
type: 'document-type',
|
||||
hasChildren: false,
|
||||
@@ -1097,7 +1093,6 @@ export const treeData: Array<DocumentTypeTreeItemResponseModel> = [
|
||||
icon: 'umb:document',
|
||||
},
|
||||
{
|
||||
$type: 'DocumentTypeTreeItemViewModel',
|
||||
name: 'Simple Document Type',
|
||||
type: 'document-type',
|
||||
hasChildren: false,
|
||||
@@ -1107,7 +1102,6 @@ export const treeData: Array<DocumentTypeTreeItemResponseModel> = [
|
||||
icon: 'umb:document',
|
||||
},
|
||||
{
|
||||
$type: 'DocumentTypeTreeItemViewModel',
|
||||
name: 'Simple Document Type 2',
|
||||
type: 'document-type',
|
||||
hasChildren: false,
|
||||
|
||||
@@ -476,7 +476,6 @@ export const data: Array<DocumentResponseModel> = [
|
||||
|
||||
export const treeData: Array<DocumentTreeItemResponseModel> = [
|
||||
{
|
||||
$type: 'DocumentTreeItemViewModel',
|
||||
isProtected: false,
|
||||
isPublished: true,
|
||||
isEdited: false,
|
||||
@@ -491,7 +490,6 @@ export const treeData: Array<DocumentTreeItemResponseModel> = [
|
||||
hasChildren: false,
|
||||
},
|
||||
{
|
||||
$type: 'DocumentTreeItemViewModel',
|
||||
isProtected: false,
|
||||
isPublished: true,
|
||||
isEdited: false,
|
||||
@@ -506,7 +504,6 @@ export const treeData: Array<DocumentTreeItemResponseModel> = [
|
||||
hasChildren: true,
|
||||
},
|
||||
{
|
||||
$type: 'DocumentTreeItemViewModel',
|
||||
isProtected: false,
|
||||
isPublished: false,
|
||||
isEdited: false,
|
||||
@@ -521,7 +518,6 @@ export const treeData: Array<DocumentTreeItemResponseModel> = [
|
||||
hasChildren: false,
|
||||
},
|
||||
{
|
||||
$type: 'DocumentTreeItemViewModel',
|
||||
name: 'Document 5',
|
||||
type: 'document',
|
||||
icon: 'document',
|
||||
@@ -536,7 +532,6 @@ export const treeData: Array<DocumentTreeItemResponseModel> = [
|
||||
isTrashed: false,
|
||||
},
|
||||
{
|
||||
$type: 'DocumentTreeItemViewModel',
|
||||
name: 'Simple',
|
||||
type: 'document',
|
||||
icon: 'document',
|
||||
|
||||
@@ -5,7 +5,6 @@ import { FolderTreeItemResponseModel, PagedFolderTreeItemResponseModel } from '@
|
||||
|
||||
export const data: Array<MediaTypeDetails> = [
|
||||
{
|
||||
$type: 'media-type',
|
||||
name: 'Media Type 1',
|
||||
type: 'media-type',
|
||||
hasChildren: false,
|
||||
@@ -13,12 +12,10 @@ export const data: Array<MediaTypeDetails> = [
|
||||
isContainer: false,
|
||||
parentId: null,
|
||||
isFolder: false,
|
||||
icon: '',
|
||||
alias: 'mediaType1',
|
||||
properties: [],
|
||||
},
|
||||
{
|
||||
$type: 'media-type',
|
||||
name: 'Media Type 2',
|
||||
type: 'media-type',
|
||||
hasChildren: false,
|
||||
@@ -26,7 +23,6 @@ export const data: Array<MediaTypeDetails> = [
|
||||
isContainer: false,
|
||||
parentId: null,
|
||||
isFolder: false,
|
||||
icon: '',
|
||||
alias: 'mediaType2',
|
||||
properties: [],
|
||||
},
|
||||
|
||||
@@ -8,7 +8,6 @@ export const data: Array<MediaDetails> = [
|
||||
{
|
||||
name: 'Flipped Car',
|
||||
type: 'media',
|
||||
icon: 'picture',
|
||||
hasChildren: false,
|
||||
id: 'f2f81a40-c989-4b6b-84e2-057cecd3adc1',
|
||||
isContainer: false,
|
||||
@@ -34,7 +33,6 @@ export const data: Array<MediaDetails> = [
|
||||
{
|
||||
name: 'Umbracoffee',
|
||||
type: 'media',
|
||||
icon: 'picture',
|
||||
hasChildren: false,
|
||||
id: '69431027-8867-45bf-a93b-72bbdabfb177',
|
||||
isContainer: false,
|
||||
@@ -60,7 +58,6 @@ export const data: Array<MediaDetails> = [
|
||||
{
|
||||
name: 'People',
|
||||
type: 'media',
|
||||
icon: 'folder',
|
||||
hasChildren: true,
|
||||
id: '69461027-8867-45bf-a93b-72bbdabfb177',
|
||||
isContainer: true,
|
||||
@@ -74,7 +71,6 @@ export const data: Array<MediaDetails> = [
|
||||
{
|
||||
name: 'Products',
|
||||
type: 'media',
|
||||
icon: 'folder',
|
||||
hasChildren: true,
|
||||
id: '69461027-8867-45bf-a93b-5224dabfb177',
|
||||
isContainer: true,
|
||||
@@ -88,7 +84,6 @@ export const data: Array<MediaDetails> = [
|
||||
{
|
||||
name: 'John Smith',
|
||||
type: 'media',
|
||||
icon: 'picture',
|
||||
hasChildren: false,
|
||||
id: '69431027-8867-45s7-a93b-7uibdabfb177',
|
||||
isContainer: false,
|
||||
@@ -114,7 +109,6 @@ export const data: Array<MediaDetails> = [
|
||||
{
|
||||
name: 'Jane Doe',
|
||||
type: 'media',
|
||||
icon: 'picture',
|
||||
hasChildren: false,
|
||||
id: '69431027-8867-45s7-a93b-7uibdabf2147',
|
||||
isContainer: false,
|
||||
@@ -140,7 +134,6 @@ export const data: Array<MediaDetails> = [
|
||||
{
|
||||
name: 'A very nice hat',
|
||||
type: 'media',
|
||||
icon: 'picture',
|
||||
hasChildren: false,
|
||||
id: '694hdj27-8867-45s7-a93b-7uibdabf2147',
|
||||
isContainer: false,
|
||||
@@ -166,7 +159,6 @@ export const data: Array<MediaDetails> = [
|
||||
{
|
||||
name: 'Fancy old chair',
|
||||
type: 'media',
|
||||
icon: 'picture',
|
||||
hasChildren: false,
|
||||
id: '694hdj27-1237-45s7-a93b-7uibdabfas47',
|
||||
isContainer: false,
|
||||
|
||||
@@ -7,7 +7,6 @@ export const data: Array<MemberGroupDetails> = [
|
||||
{
|
||||
name: 'Member Group AAA',
|
||||
type: 'member-group',
|
||||
icon: 'umb:document',
|
||||
hasChildren: false,
|
||||
id: '76708ccd-4179-464c-b694-6969149dd9f9',
|
||||
isContainer: false,
|
||||
|
||||
@@ -7,7 +7,6 @@ export const data: Array<MemberTypeDetails> = [
|
||||
{
|
||||
name: 'Member Type 1',
|
||||
type: 'member-type',
|
||||
icon: 'icon-user',
|
||||
hasChildren: false,
|
||||
id: 'd59be02f-1df9-4228-aa1e-01917d806cda',
|
||||
isContainer: false,
|
||||
|
||||
@@ -10,7 +10,6 @@ export const data: Array<MemberDetails> = [
|
||||
{
|
||||
name: 'Member AAA',
|
||||
type: 'member',
|
||||
icon: 'umb:user',
|
||||
hasChildren: false,
|
||||
id: 'aaa08ccd-4179-464c-b634-6969149dd9f9',
|
||||
isContainer: false,
|
||||
|
||||
@@ -11,7 +11,6 @@ export const data: Array<FileSystemTreeItemPresentationModel> = [
|
||||
isFolder: true,
|
||||
name: 'blockgrid',
|
||||
type: 'partial-view',
|
||||
icon: 'umb:folder',
|
||||
hasChildren: true,
|
||||
},
|
||||
{
|
||||
@@ -19,7 +18,6 @@ export const data: Array<FileSystemTreeItemPresentationModel> = [
|
||||
isFolder: true,
|
||||
name: 'blocklist',
|
||||
type: 'partial-view',
|
||||
icon: 'umb:folder',
|
||||
hasChildren: true,
|
||||
},
|
||||
{
|
||||
@@ -27,7 +25,6 @@ export const data: Array<FileSystemTreeItemPresentationModel> = [
|
||||
isFolder: true,
|
||||
name: 'grid',
|
||||
type: 'partial-view',
|
||||
icon: 'umb:folder',
|
||||
hasChildren: true,
|
||||
},
|
||||
{
|
||||
@@ -35,7 +32,6 @@ export const data: Array<FileSystemTreeItemPresentationModel> = [
|
||||
isFolder: false,
|
||||
name: 'area.cshtml',
|
||||
type: 'partial-view',
|
||||
icon: 'umb:article',
|
||||
hasChildren: false,
|
||||
},
|
||||
{
|
||||
@@ -43,7 +39,6 @@ export const data: Array<FileSystemTreeItemPresentationModel> = [
|
||||
isFolder: false,
|
||||
name: 'items.cshtml',
|
||||
type: 'partial-view',
|
||||
icon: 'umb:article',
|
||||
hasChildren: false,
|
||||
},
|
||||
{
|
||||
@@ -51,7 +46,6 @@ export const data: Array<FileSystemTreeItemPresentationModel> = [
|
||||
isFolder: false,
|
||||
name: 'default.cshtml',
|
||||
type: 'partial-view',
|
||||
icon: 'umb:article',
|
||||
hasChildren: false,
|
||||
},
|
||||
{
|
||||
@@ -59,7 +53,6 @@ export const data: Array<FileSystemTreeItemPresentationModel> = [
|
||||
isFolder: false,
|
||||
name: 'editors',
|
||||
type: 'partial-view',
|
||||
icon: 'umb:folder',
|
||||
hasChildren: false,
|
||||
},
|
||||
{
|
||||
@@ -67,7 +60,6 @@ export const data: Array<FileSystemTreeItemPresentationModel> = [
|
||||
isFolder: false,
|
||||
name: 'items.cshtml',
|
||||
type: 'partial-view',
|
||||
icon: 'umb:article',
|
||||
hasChildren: false,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -74,47 +74,42 @@ export const data: Array<RelationTypeResponseModel> = [
|
||||
export const treeData: Array<EntityTreeItemResponseModel> = [
|
||||
{
|
||||
id: 'e0d39ff5-71d8-453f-b682-9d8d31ee5e06',
|
||||
$type: 'EntityTreeItemViewModel',
|
||||
|
||||
isContainer: false,
|
||||
parentId: null,
|
||||
name: 'Relate Document On Copy',
|
||||
icon: 'umb:trafic',
|
||||
type: 'relation-type',
|
||||
},
|
||||
{
|
||||
id: 'ac68cde6-763f-4231-a751-1101b57defd2',
|
||||
$type: 'EntityTreeItemViewModel',
|
||||
|
||||
isContainer: false,
|
||||
parentId: null,
|
||||
name: 'Relate Parent Document On Delete',
|
||||
icon: 'umb:trafic',
|
||||
type: 'relation-type',
|
||||
},
|
||||
{
|
||||
id: '6f9b800c-762c-42d4-85d9-bf40a77d689e',
|
||||
$type: 'EntityTreeItemViewModel',
|
||||
|
||||
isContainer: false,
|
||||
parentId: null,
|
||||
name: 'Relate Parent Media Folder On Delete',
|
||||
icon: 'umb:trafic',
|
||||
type: 'relation-type',
|
||||
},
|
||||
{
|
||||
id: 'd421727d-43de-4205-b4c6-037404f309ad',
|
||||
$type: 'EntityTreeItemViewModel',
|
||||
|
||||
isContainer: false,
|
||||
parentId: null,
|
||||
name: 'Related Media',
|
||||
icon: 'umb:trafic',
|
||||
type: 'relation-type',
|
||||
},
|
||||
{
|
||||
id: 'e9a0a28e-2d5b-4229-ac00-66f2df230513',
|
||||
$type: 'EntityTreeItemViewModel',
|
||||
|
||||
isContainer: false,
|
||||
parentId: null,
|
||||
name: 'Related Document',
|
||||
icon: 'umb:trafic',
|
||||
type: 'relation-type',
|
||||
},
|
||||
];
|
||||
|
||||
@@ -15,7 +15,6 @@ export const data: Array<StylesheetDBItem> = [
|
||||
isFolder: false,
|
||||
name: 'Stylesheet File 1.css',
|
||||
type: 'stylesheet',
|
||||
icon: 'umb:brackets',
|
||||
hasChildren: false,
|
||||
content: `Stylesheet content 1`,
|
||||
},
|
||||
@@ -24,7 +23,6 @@ export const data: Array<StylesheetDBItem> = [
|
||||
isFolder: false,
|
||||
name: 'Stylesheet File 2.css',
|
||||
type: 'stylesheet',
|
||||
icon: 'umb:brackets',
|
||||
hasChildren: false,
|
||||
content: `Stylesheet content 2`,
|
||||
},
|
||||
@@ -33,7 +31,6 @@ export const data: Array<StylesheetDBItem> = [
|
||||
isFolder: true,
|
||||
name: 'Folder 1',
|
||||
type: 'stylesheet',
|
||||
icon: 'umb:folder',
|
||||
hasChildren: true,
|
||||
content: `Stylesheet content 3`,
|
||||
},
|
||||
@@ -42,7 +39,6 @@ export const data: Array<StylesheetDBItem> = [
|
||||
isFolder: false,
|
||||
name: 'Stylesheet File 3.css',
|
||||
type: 'stylesheet',
|
||||
icon: 'umb:brackets',
|
||||
hasChildren: false,
|
||||
content: `Stylesheet content 3`,
|
||||
},
|
||||
|
||||
@@ -39,7 +39,6 @@ export const data: Array<TemplateDBItem> = [
|
||||
parentId: null,
|
||||
name: 'Doc 1',
|
||||
type: 'template',
|
||||
icon: 'umb:layout',
|
||||
hasChildren: false,
|
||||
alias: 'Doc1',
|
||||
content: `@using Umbraco.Extensions
|
||||
@@ -62,7 +61,6 @@ export const data: Array<TemplateDBItem> = [
|
||||
parentId: null,
|
||||
name: 'Test',
|
||||
type: 'template',
|
||||
icon: 'umb:layout',
|
||||
hasChildren: true,
|
||||
alias: 'Test',
|
||||
content:
|
||||
@@ -75,7 +73,6 @@ export const data: Array<TemplateDBItem> = [
|
||||
masterTemplateId: '9a84c0b3-03b4-4dd4-84ac-706740ac0f71',
|
||||
name: 'Child',
|
||||
type: 'template',
|
||||
icon: 'umb:layout',
|
||||
hasChildren: false,
|
||||
alias: 'Test',
|
||||
content:
|
||||
@@ -88,7 +85,6 @@ export const data: Array<TemplateDBItem> = [
|
||||
name: 'Has Master Template',
|
||||
masterTemplateId: '9a84c0b3-03b4-4dd4-84ac-706740ac0f71',
|
||||
type: 'template',
|
||||
icon: 'umb:layout',
|
||||
hasChildren: false,
|
||||
alias: 'hasMasterTemplate',
|
||||
content:
|
||||
|
||||
@@ -17,7 +17,6 @@ class UmbUserGroupsData extends UmbEntityData<UserGroupResponseModel> {
|
||||
|
||||
export const data: Array<UserGroupResponseModel> = [
|
||||
{
|
||||
$type: 'UserGroupResponseModel',
|
||||
id: 'c630d49e-4e7b-42ea-b2bc-edc0edacb6b1',
|
||||
name: 'Administrators',
|
||||
icon: 'umb:medal',
|
||||
|
||||
@@ -23,7 +23,6 @@ class UmbUsersData extends UmbData<UserResponseModel> {
|
||||
const firstUser = this.data[0];
|
||||
|
||||
return {
|
||||
$type: 'CurrentUserResponseModel',
|
||||
id: firstUser.id,
|
||||
name: firstUser.name,
|
||||
email: firstUser.email,
|
||||
@@ -113,7 +112,6 @@ export const data: Array<UserResponseModel & { type: string }> = [
|
||||
{
|
||||
id: 'bca6c733-a63d-4353-a271-9a8b6bcca8bd',
|
||||
type: 'user',
|
||||
$type: 'UserResponseModel',
|
||||
contentStartNodeIds: [],
|
||||
mediaStartNodeIds: [],
|
||||
name: 'Umbraco User',
|
||||
@@ -131,7 +129,6 @@ export const data: Array<UserResponseModel & { type: string }> = [
|
||||
{
|
||||
id: '82e11d3d-b91d-43c9-9071-34d28e62e81d',
|
||||
type: 'user',
|
||||
$type: 'UserResponseModel',
|
||||
contentStartNodeIds: [],
|
||||
mediaStartNodeIds: [],
|
||||
name: 'Amelie Walker',
|
||||
@@ -149,7 +146,6 @@ export const data: Array<UserResponseModel & { type: string }> = [
|
||||
{
|
||||
id: 'aa1d83a9-bc7f-47d2-b288-58d8a31f5017',
|
||||
type: 'user',
|
||||
$type: 'UserResponseModel',
|
||||
contentStartNodeIds: [],
|
||||
mediaStartNodeIds: [],
|
||||
name: 'Oliver Kim',
|
||||
@@ -167,7 +163,6 @@ export const data: Array<UserResponseModel & { type: string }> = [
|
||||
{
|
||||
id: 'ff2f4a50-d3d4-4bc4-869d-c7948c160e54',
|
||||
type: 'user',
|
||||
$type: 'UserResponseModel',
|
||||
contentStartNodeIds: [],
|
||||
mediaStartNodeIds: [],
|
||||
name: 'Eliana Nieves',
|
||||
@@ -185,7 +180,6 @@ export const data: Array<UserResponseModel & { type: string }> = [
|
||||
{
|
||||
id: 'c290c6d9-9f12-4838-8567-621b52a178de',
|
||||
type: 'user',
|
||||
$type: 'UserResponseModel',
|
||||
contentStartNodeIds: [],
|
||||
mediaStartNodeIds: [],
|
||||
name: 'Jasmine Patel',
|
||||
|
||||
@@ -13,7 +13,6 @@ export const createEntityTreeItem = (item: any): EntityTreeItemResponseModel =>
|
||||
return {
|
||||
name: item.name,
|
||||
type: item.type,
|
||||
icon: item.icon,
|
||||
hasChildren: item.hasChildren,
|
||||
id: item.id,
|
||||
isContainer: item.isContainer,
|
||||
@@ -24,7 +23,6 @@ export const createEntityTreeItem = (item: any): EntityTreeItemResponseModel =>
|
||||
export const createFolderTreeItem = (item: any): FolderTreeItemResponseModel => {
|
||||
return {
|
||||
...createEntityTreeItem(item),
|
||||
$type: 'FolderTreeItemResponseModel',
|
||||
isFolder: item.isFolder,
|
||||
};
|
||||
};
|
||||
@@ -45,7 +43,6 @@ export const createDocumentTreeItem = (
|
||||
): DocumentTreeItemResponseModel & { isTrashed: boolean } => {
|
||||
return {
|
||||
...createContentTreeItem(item),
|
||||
$type: 'DocumentTreeItemViewModel',
|
||||
type: 'document',
|
||||
icon: 'document', // TODO: Should get this from document type...
|
||||
name: item.variants?.[0].name ?? '',
|
||||
@@ -71,7 +68,6 @@ export const createFileSystemTreeItem = (item: any): FileSystemTreeItemPresentat
|
||||
return {
|
||||
name: item.name,
|
||||
type: item.type,
|
||||
icon: item.icon,
|
||||
hasChildren: item.hasChildren,
|
||||
path: item.path,
|
||||
isFolder: item.isFolder,
|
||||
|
||||
@@ -2,7 +2,7 @@ const { rest } = window.MockServiceWorker;
|
||||
import { umbDataTypeData } from '../../data/data-type.data.js';
|
||||
import { slug } from './slug.js';
|
||||
import { umbracoPath } from '@umbraco-cms/backoffice/utils';
|
||||
import { ProblemDetailsModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { ProblemDetails } from '@umbraco-cms/backoffice/backend-api';
|
||||
|
||||
export const folderHandlers = [
|
||||
rest.post(umbracoPath(`${slug}/folder`), async (req, res, ctx) => {
|
||||
@@ -44,7 +44,7 @@ export const folderHandlers = [
|
||||
} catch (error) {
|
||||
return res(
|
||||
ctx.status(404),
|
||||
ctx.json<ProblemDetailsModel>({
|
||||
ctx.json<ProblemDetails>({
|
||||
status: 404,
|
||||
type: 'error',
|
||||
detail: 'Not Found',
|
||||
|
||||
@@ -20,7 +20,6 @@ const importResponse: DictionaryItemResponseModel & EntityTreeItemResponseModel
|
||||
hasChildren: false,
|
||||
type: 'dictionary-item',
|
||||
isContainer: false,
|
||||
icon: 'umb:book-alt',
|
||||
translations: [
|
||||
{
|
||||
isoCode: 'en',
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
DatabaseInstallResponseModel,
|
||||
InstallVResponseModel,
|
||||
InstallSettingsResponseModel,
|
||||
ProblemDetailsModel,
|
||||
ProblemDetails,
|
||||
TelemetryLevelModel,
|
||||
} from '@umbraco-cms/backoffice/backend-api';
|
||||
import { umbracoPath } from '@umbraco-cms/backoffice/utils';
|
||||
@@ -84,7 +84,7 @@ export const handlers = [
|
||||
if (body.name === 'validate') {
|
||||
return res(
|
||||
ctx.status(400),
|
||||
ctx.json<ProblemDetailsModel>({
|
||||
ctx.json<ProblemDetails>({
|
||||
type: 'connection',
|
||||
status: 400,
|
||||
detail: 'Database connection failed',
|
||||
@@ -106,7 +106,7 @@ export const handlers = [
|
||||
// Respond with a 200 status code
|
||||
ctx.status(400),
|
||||
ctx.delay(1000),
|
||||
ctx.json<ProblemDetailsModel>({
|
||||
ctx.json<ProblemDetails>({
|
||||
type: 'validation',
|
||||
status: 400,
|
||||
detail: 'Something went wrong',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { rest } = window.MockServiceWorker;
|
||||
import { umbLanguagesData } from '../data/languages.data.js';
|
||||
import { LanguageResponseModel, ProblemDetailsModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { LanguageResponseModel, ProblemDetails } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { umbracoPath } from '@umbraco-cms/backoffice/utils';
|
||||
|
||||
// TODO: add schema
|
||||
@@ -48,7 +48,7 @@ export const handlers = [
|
||||
} catch (error) {
|
||||
return res(
|
||||
ctx.status(400),
|
||||
ctx.json<ProblemDetailsModel>({
|
||||
ctx.json<ProblemDetails>({
|
||||
status: 400,
|
||||
type: 'validation',
|
||||
detail: 'Something went wrong',
|
||||
|
||||
@@ -4,7 +4,7 @@ import { UmbFolderModalData, UmbFolderModalResult, UmbModalContext } from '@umbr
|
||||
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
|
||||
import { UmbFolderRepository } from '@umbraco-cms/backoffice/repository';
|
||||
import { createExtensionClass, ManifestBase } from '@umbraco-cms/backoffice/extension-api';
|
||||
import { FolderReponseModel, ProblemDetailsModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { FolderReponseModel, ProblemDetails } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { UmbObserverController } from '@umbraco-cms/backoffice/observable-api';
|
||||
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
|
||||
|
||||
@@ -102,7 +102,7 @@ export class UmbFolderModalElement extends UmbLitElement {
|
||||
const isValid = this._formElement?.checkValidity();
|
||||
if (!isValid) return;
|
||||
|
||||
let error: ProblemDetailsModel | undefined;
|
||||
let error: ProblemDetails | undefined;
|
||||
|
||||
const formData = new FormData(this._formElement);
|
||||
const folderName = formData.get('name') as string;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Observable } from '@umbraco-cms/backoffice/external/rxjs';
|
||||
import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
|
||||
import type { ProblemDetailsModel, TreeItemPresentationModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import type { ProblemDetails, TreeItemPresentationModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { UmbPagedData } from '@umbraco-cms/backoffice/repository';
|
||||
|
||||
export interface UmbTreeItemContext<TreeItemType extends TreeItemPresentationModel> {
|
||||
@@ -20,7 +20,7 @@ export interface UmbTreeItemContext<TreeItemType extends TreeItemPresentationMod
|
||||
setTreeItem(treeItem: TreeItemType | undefined): void;
|
||||
requestChildren(): Promise<{
|
||||
data?: UmbPagedData<TreeItemType> | undefined;
|
||||
error?: ProblemDetailsModel | undefined;
|
||||
error?: ProblemDetails | undefined;
|
||||
asObservable?: () => Observable<TreeItemType[]>;
|
||||
}>;
|
||||
toggleContextMenu(): void;
|
||||
|
||||
@@ -4,7 +4,7 @@ import { ManifestTree, umbExtensionsRegistry } from '@umbraco-cms/backoffice/ext
|
||||
import { UmbBooleanState } from '@umbraco-cms/backoffice/observable-api';
|
||||
import { UmbBaseController, UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { createExtensionClass } from '@umbraco-cms/backoffice/extension-api';
|
||||
import { ProblemDetailsModel, TreeItemPresentationModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { ProblemDetails, TreeItemPresentationModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { UmbContextProviderController } from '@umbraco-cms/backoffice/context-api';
|
||||
import { UmbSelectionManagerBase } from '@umbraco-cms/backoffice/utils';
|
||||
|
||||
@@ -22,7 +22,7 @@ export interface UmbTreeContext<TreeItemType extends TreeItemPresentationModel>
|
||||
deselect(unique: string | null): void;
|
||||
requestChildrenOf: (parentUnique: string | null) => Promise<{
|
||||
data?: UmbPagedData<TreeItemType>;
|
||||
error?: ProblemDetailsModel;
|
||||
error?: ProblemDetails;
|
||||
asObservable?: () => Observable<TreeItemType[]>;
|
||||
}>;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ export class UmbAllowedDocumentTypesModalElement extends UmbModalBaseElement<
|
||||
const { data } = await this.#documentTypeRepository.requestRootTreeItems();
|
||||
if (!data) return;
|
||||
|
||||
const allFullModels: Array<DocumentTypeResponseModel & { $type: '' }> = [];
|
||||
const allFullModels: Array<DocumentTypeResponseModel> = [];
|
||||
await Promise.all(
|
||||
data.items.map((item) => {
|
||||
if (item.id) {
|
||||
@@ -83,7 +83,7 @@ export class UmbAllowedDocumentTypesModalElement extends UmbModalBaseElement<
|
||||
|
||||
render() {
|
||||
return html`
|
||||
<umb-body-layout headline=${this._headline}>
|
||||
<umb-body-layout headline=${this._headline ?? ''}>
|
||||
<uui-box>
|
||||
${this._allowedDocumentTypes.length === 0 ? html`<p>No allowed types</p>` : nothing}
|
||||
${this._allowedDocumentTypes.map(
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
} from '@umbraco-cms/backoffice/backend-api';
|
||||
import { UmbNotificationContext, UMB_NOTIFICATION_CONTEXT_TOKEN } from '@umbraco-cms/backoffice/notification';
|
||||
|
||||
type ItemType = DocumentTypeResponseModel & { $type: string };
|
||||
type ItemType = DocumentTypeResponseModel;
|
||||
|
||||
export class UmbDocumentTypeRepository
|
||||
implements
|
||||
@@ -181,7 +181,7 @@ export class UmbDocumentTypeRepository
|
||||
|
||||
// Temporary hack while we are not in control of IDs:
|
||||
|
||||
const newDocument = { ...(await this.requestById(newId)).data, $type: '' };
|
||||
const newDocument = { ...(await this.requestById(newId)).data };
|
||||
|
||||
if (newDocument) {
|
||||
const notification = { data: { message: `Document Type created` } };
|
||||
@@ -255,7 +255,6 @@ export const createTreeItem = (item: ItemType): FolderTreeItemResponseModel => {
|
||||
|
||||
// TODO: needs parentID, this is missing in the current model. Should be good when updated to a createModel.
|
||||
return {
|
||||
$type: 'FolderTreeItemResponseModel',
|
||||
type: 'document-type',
|
||||
parentId: null,
|
||||
name: item.name,
|
||||
|
||||
@@ -56,10 +56,8 @@ export class UmbDocumentTypeServerDataSource
|
||||
* @memberof UmbDocumentTypeServerDataSource
|
||||
*/
|
||||
async createScaffold(parentId: string | null) {
|
||||
// TODO: Type hack to append $type and parentId to the DocumentTypeResponseModel.
|
||||
//, parentId: string | null
|
||||
const data: DocumentTypeResponseModel & { $type: string } = {
|
||||
$type: 'string',
|
||||
const data: DocumentTypeResponseModel = {
|
||||
id: UmbId.new(),
|
||||
//parentId: parentId,
|
||||
name: '',
|
||||
@@ -99,7 +97,6 @@ export class UmbDocumentTypeServerDataSource
|
||||
documentType = { ...documentType };
|
||||
|
||||
// TODO: Hack to remove some props that ruins the document-type post end-point.
|
||||
(documentType as any).$type = undefined;
|
||||
(documentType as any).id = undefined;
|
||||
|
||||
// TODO: Investigate if this matters (should go away anyway when we have the end-point accepts us defining the ids.)
|
||||
@@ -131,7 +128,6 @@ export class UmbDocumentTypeServerDataSource
|
||||
documentType = { ...documentType };
|
||||
|
||||
// TODO: Hack to remove some props that ruins the document-type post end-point.
|
||||
(documentType as any).$type = undefined;
|
||||
(documentType as any).id = undefined;
|
||||
|
||||
return tryExecuteAndNotify(this.#host, DocumentTypeResource.putDocumentTypeById({ id, requestBody: documentType }));
|
||||
|
||||
@@ -79,7 +79,6 @@ export class UmbDocumentTableCollectionViewElement extends UmbLitElement {
|
||||
if (!item.id) throw new Error('Item id is missing.');
|
||||
return {
|
||||
id: item.id,
|
||||
icon: item.icon,
|
||||
data: [
|
||||
{
|
||||
columnAlias: 'entityName',
|
||||
|
||||
@@ -65,7 +65,6 @@ export class UmbDocumentServerDataSource
|
||||
values: [],
|
||||
variants: [
|
||||
{
|
||||
$type: 'DocumentVariantRequestModel',
|
||||
state: ContentStateModel.DRAFT,
|
||||
publishDate: null,
|
||||
culture: null,
|
||||
@@ -92,12 +91,11 @@ export class UmbDocumentServerDataSource
|
||||
|
||||
// TODO: Hack to remove some props that ruins the document-type post end-point.
|
||||
const unFroozenDocument = { ...document };
|
||||
(unFroozenDocument as any).$type = undefined;
|
||||
(unFroozenDocument as any).id = undefined;
|
||||
|
||||
(unFroozenDocument.variants as any) =
|
||||
unFroozenDocument.variants?.map((variant) => {
|
||||
return { ...variant, $type: undefined };
|
||||
return { ...variant };
|
||||
}) ?? [];
|
||||
|
||||
return tryExecuteAndNotify(this.#host, DocumentResource.postDocument({ requestBody: unFroozenDocument }));
|
||||
@@ -114,12 +112,11 @@ export class UmbDocumentServerDataSource
|
||||
|
||||
// TODO: Hack to remove some props that ruins the document-type post end-point.
|
||||
const unFroozenDocument = { ...document };
|
||||
(unFroozenDocument as any).$type = undefined;
|
||||
(unFroozenDocument as any).id = undefined;
|
||||
|
||||
(unFroozenDocument.variants as any) =
|
||||
unFroozenDocument.variants?.map((variant) => {
|
||||
return { ...variant, $type: undefined };
|
||||
return { ...variant };
|
||||
}) ?? [];
|
||||
|
||||
return tryExecuteAndNotify(this.#host, DocumentResource.putDocumentById({ id, requestBody: unFroozenDocument }));
|
||||
|
||||
@@ -152,7 +152,7 @@ export class UmbDocumentWorkspaceContext
|
||||
}
|
||||
}
|
||||
setPropertyValue(alias: string, value: unknown, variantId?: UmbVariantId) {
|
||||
const entry = { $type: 'DocumentValueModel', ...variantId?.toObject(), alias, value };
|
||||
const entry = { ...variantId?.toObject(), alias, value };
|
||||
const currentData = this.#draft.value;
|
||||
if (currentData) {
|
||||
const values = appendToFrozenArray(
|
||||
|
||||
@@ -67,7 +67,6 @@ export class UmbMediaTableCollectionViewElement extends UmbLitElement {
|
||||
this._tableItems = mediaItems.map((item) => {
|
||||
return {
|
||||
id: item.id,
|
||||
icon: item.icon,
|
||||
data: [
|
||||
{
|
||||
columnAlias: 'mediaName',
|
||||
|
||||
@@ -45,7 +45,7 @@ export class UmbMemberTreeServerDataSource implements MemberTreeDataSource {
|
||||
return { data, error: undefined };
|
||||
|
||||
// if (ids) {
|
||||
// const error: ProblemDetailsModel = { title: 'Ids are missing' };
|
||||
// const error: ProblemDetails = { title: 'Ids are missing' };
|
||||
// return { error };
|
||||
// }
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DataTypeResponseModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
|
||||
export interface UmbDataTypeModel extends Omit<DataTypeResponseModel, '$type'> {
|
||||
export interface UmbDataTypeModel extends DataTypeResponseModel {
|
||||
type: 'data-type' | 'data-type-folder' | 'data-type-root';
|
||||
}
|
||||
|
||||
@@ -365,7 +365,6 @@ export const createTreeItem = (item: CreateDataTypeRequestModel): FolderTreeItem
|
||||
if (!item.id) throw new Error('item.id is null or undefined');
|
||||
|
||||
return {
|
||||
$type: 'FolderTreeItemResponseModel',
|
||||
type: 'data-type',
|
||||
parentId: item.parentId,
|
||||
name: item.name,
|
||||
|
||||
@@ -35,7 +35,6 @@ export class UmbDataTypeFolderServerDataSource implements UmbFolderDataSource {
|
||||
*/
|
||||
async createScaffold(parentId: string | null) {
|
||||
const scaffold: FolderReponseModel = {
|
||||
$type: 'FolderReponseModel',
|
||||
name: '',
|
||||
id: UmbId.new(),
|
||||
parentId,
|
||||
|
||||
@@ -132,11 +132,11 @@ const codeSnippets: Record<CodeEditorLanguage, string> = {
|
||||
}
|
||||
|
||||
setName(value: string) {
|
||||
this.#data.next({ ...this.#data.value, $type: this.#data.value?.$type || '', name: value });
|
||||
this.#data.next({ ...this.#data.value, name: value });
|
||||
}
|
||||
|
||||
setContent(value: string) {
|
||||
this.#data.next({ ...this.#data.value, $type: this.#data.value?.$type || '', content: value });
|
||||
this.#data.next({ ...this.#data.value, content: value });
|
||||
}
|
||||
|
||||
async load(entityId: string) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { UmbPartialViewsTreeStore, UMB_PARTIAL_VIEW_TREE_STORE_CONTEXT_TOKEN } f
|
||||
import { Observable } from '@umbraco-cms/backoffice/external/rxjs';
|
||||
import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { UmbContextConsumerController } from '@umbraco-cms/backoffice/context-api';
|
||||
import { ProblemDetailsModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { ProblemDetails } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { UmbDetailRepository, UmbTreeRepository } from '@umbraco-cms/backoffice/repository';
|
||||
import { UmbTreeRootEntityModel } from '@umbraco-cms/backoffice/tree';
|
||||
|
||||
@@ -30,7 +30,7 @@ export class UmbTemplateRepository implements UmbTreeRepository<any>, UmbDetailR
|
||||
]);
|
||||
}
|
||||
|
||||
requestTreeRoot(): Promise<{ data?: UmbTreeRootEntityModel | undefined; error?: ProblemDetailsModel | undefined }> {
|
||||
requestTreeRoot(): Promise<{ data?: UmbTreeRootEntityModel | undefined; error?: ProblemDetails | undefined }> {
|
||||
//throw new Error('Method not implemented.');
|
||||
return { data: undefined, error: undefined } as any;
|
||||
}
|
||||
@@ -38,7 +38,7 @@ export class UmbTemplateRepository implements UmbTreeRepository<any>, UmbDetailR
|
||||
requestItemsLegacy?:
|
||||
| ((uniques: string[]) => Promise<{
|
||||
data?: any[] | undefined;
|
||||
error?: ProblemDetailsModel | undefined;
|
||||
error?: ProblemDetails | undefined;
|
||||
asObservable?: (() => Observable<any[]>) | undefined;
|
||||
}>)
|
||||
| undefined;
|
||||
@@ -52,7 +52,7 @@ export class UmbTemplateRepository implements UmbTreeRepository<any>, UmbDetailR
|
||||
// TODO: This method to be done, or able to go away?
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
requestById(id: string): Promise<{ data?: any; error?: ProblemDetailsModel | undefined }> {
|
||||
requestById(id: string): Promise<{ data?: any; error?: ProblemDetails | undefined }> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ export class UmbTemplateRepository implements UmbTreeRepository<any>, UmbDetailR
|
||||
await this.#init;
|
||||
|
||||
if (!keys) {
|
||||
const error: ProblemDetailsModel = { title: 'Keys are missing' };
|
||||
const error: ProblemDetails = { title: 'Keys are missing' };
|
||||
return { data: undefined, error };
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { PartialViewsTreeDataSource } from './index.js';
|
||||
import { PartialViewResource, ProblemDetailsModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { PartialViewResource, ProblemDetails } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources';
|
||||
|
||||
@@ -24,7 +24,7 @@ export class UmbPartialViewsTreeServerDataSource implements PartialViewsTreeData
|
||||
take?: number | undefined;
|
||||
}) {
|
||||
if (!path) {
|
||||
const error: ProblemDetailsModel = { title: 'Path is missing' };
|
||||
const error: ProblemDetails = { title: 'Path is missing' };
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ export class UmbPartialViewsTreeServerDataSource implements PartialViewsTreeData
|
||||
|
||||
async getItem(id: Array<string>) {
|
||||
if (!id) {
|
||||
const error: ProblemDetailsModel = { title: 'Paths are missing' };
|
||||
const error: ProblemDetails = { title: 'Paths are missing' };
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,11 +31,11 @@ export class UmbPartialViewsWorkspaceContext extends UmbWorkspaceContext<UmbTemp
|
||||
}
|
||||
|
||||
setName(value: string) {
|
||||
this.#data.next({ ...this.#data.value, $type: this.#data.value?.$type || '', name: value });
|
||||
this.#data.next({ ...this.#data.value, name: value });
|
||||
}
|
||||
|
||||
setContent(value: string) {
|
||||
this.#data.next({ ...this.#data.value, $type: this.#data.value?.$type || '', content: value });
|
||||
this.#data.next({ ...this.#data.value, content: value });
|
||||
}
|
||||
|
||||
async load(entityKey: string) {
|
||||
|
||||
@@ -188,7 +188,7 @@ export class UmbTemplateRepository
|
||||
|
||||
// TODO: we currently don't use the detail store for anything.
|
||||
// Consider to look up the data before fetching from the server
|
||||
//this.#store?.append({ ...template, $type: 'EntityTreeItemResponseModel' });
|
||||
//this.#store?.append({ ...template });
|
||||
// TODO: Update tree store with the new item? or ask tree to request the new item?
|
||||
|
||||
return { error };
|
||||
|
||||
@@ -51,15 +51,15 @@ export class UmbTemplateWorkspaceContext extends UmbWorkspaceContext<UmbTemplate
|
||||
}
|
||||
|
||||
setName(value: string) {
|
||||
this.#data.next({ ...this.#data.value, $type: this.#data.value?.$type || '', name: value });
|
||||
this.#data.next({ ...this.#data.value, name: value });
|
||||
}
|
||||
|
||||
setAlias(value: string) {
|
||||
this.#data.next({ ...this.#data.value, $type: this.#data.value?.$type || '', alias: value });
|
||||
this.#data.next({ ...this.#data.value, alias: value });
|
||||
}
|
||||
|
||||
setContent(value: string) {
|
||||
this.#data.next({ ...this.#data.value, $type: this.#data.value?.$type || '', content: value });
|
||||
this.#data.next({ ...this.#data.value, content: value });
|
||||
}
|
||||
|
||||
getLayoutBlockRegexPattern() {
|
||||
@@ -156,7 +156,7 @@ ${currentContent}`;
|
||||
const { data } = await this.repository.createScaffold(parentId);
|
||||
if (!data) return;
|
||||
this.setIsNew(true);
|
||||
this.#data.next({ ...data, id: '', name: '', alias: '', $type: 'TemplateResponseModel' });
|
||||
this.#data.next({ ...data, id: '', name: '', alias: '' });
|
||||
if (!parentId) return;
|
||||
await this.setMasterTemplate(parentId);
|
||||
}
|
||||
|
||||
@@ -87,7 +87,6 @@ export class UmbDashboardTranslationDictionaryElement extends UmbLitElement {
|
||||
// TODO: Generate URL for editing the dictionary item
|
||||
const tableItem: UmbTableItem = {
|
||||
id: dictionary.name ?? '',
|
||||
icon: 'umb:book-alt',
|
||||
data: [
|
||||
{
|
||||
columnAlias: 'name',
|
||||
|
||||
@@ -21,7 +21,7 @@ import { Diff } from '@umbraco-cms/backoffice/utils';
|
||||
export function extendDataSourcePagedResponseData<
|
||||
ExtendedDataType extends IncomingDataType,
|
||||
IncomingDataType extends object = object,
|
||||
MissingPropsType extends object = Omit<Diff<IncomingDataType, ExtendedDataType>, '$type'>,
|
||||
MissingPropsType extends object = Diff<IncomingDataType, ExtendedDataType>,
|
||||
// Maybe this Omit<..., "$ype"> can be removed, but for now it kept showing up as a difference, though its not a difference on the two types.
|
||||
ToType = IncomingDataType & ExtendedDataType
|
||||
>(
|
||||
|
||||
@@ -21,8 +21,7 @@ import { Diff } from '@umbraco-cms/backoffice/utils';
|
||||
export function extendDataSourceResponseData<
|
||||
ExtendedDataType extends IncomingDataType,
|
||||
IncomingDataType extends object = object,
|
||||
MissingPropsType extends object = Omit<Diff<IncomingDataType, ExtendedDataType>, '$type'>,
|
||||
// Maybe this Omit<..., "$ype"> can be removed, but for now it kept showing up as a difference, though its not a difference on the two types.
|
||||
MissingPropsType extends object = Diff<IncomingDataType, ExtendedDataType>,
|
||||
ToType = IncomingDataType & ExtendedDataType
|
||||
>(response: DataSourceResponse<IncomingDataType>, appendData: MissingPropsType): DataSourceResponse<ToType> {
|
||||
if (response.data === undefined) return response as unknown as DataSourceResponse<ToType>;
|
||||
|
||||
@@ -2,23 +2,23 @@ import type {
|
||||
CreateFolderRequestModel,
|
||||
FolderModelBaseModel,
|
||||
FolderReponseModel,
|
||||
ProblemDetailsModel,
|
||||
ProblemDetails,
|
||||
UpdateFolderReponseModel,
|
||||
} from '@umbraco-cms/backoffice/backend-api';
|
||||
|
||||
export interface UmbFolderRepository {
|
||||
createFolderScaffold(parentId: string | null): Promise<{
|
||||
data?: FolderReponseModel;
|
||||
error?: ProblemDetailsModel;
|
||||
error?: ProblemDetails;
|
||||
}>;
|
||||
createFolder(folderRequest: CreateFolderRequestModel): Promise<{
|
||||
data?: string;
|
||||
error?: ProblemDetailsModel;
|
||||
error?: ProblemDetails;
|
||||
}>;
|
||||
|
||||
requestFolder(unique: string): Promise<{
|
||||
data?: FolderReponseModel;
|
||||
error?: ProblemDetailsModel;
|
||||
error?: ProblemDetails;
|
||||
}>;
|
||||
|
||||
updateFolder(
|
||||
@@ -26,10 +26,10 @@ export interface UmbFolderRepository {
|
||||
folder: FolderModelBaseModel
|
||||
): Promise<{
|
||||
data?: UpdateFolderReponseModel;
|
||||
error?: ProblemDetailsModel;
|
||||
error?: ProblemDetails;
|
||||
}>;
|
||||
|
||||
deleteFolder(id: string): Promise<{
|
||||
error?: ProblemDetailsModel;
|
||||
error?: ProblemDetails;
|
||||
}>;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { Observable } from '@umbraco-cms/backoffice/external/rxjs';
|
||||
import { ItemResponseModelBaseModel, ProblemDetailsModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { ItemResponseModelBaseModel, ProblemDetails } from '@umbraco-cms/backoffice/backend-api';
|
||||
|
||||
export interface UmbItemRepository<ItemType extends ItemResponseModelBaseModel> {
|
||||
requestItems: (uniques: string[]) => Promise<{
|
||||
data?: Array<ItemType> | undefined;
|
||||
error?: ProblemDetailsModel | undefined;
|
||||
error?: ProblemDetails | undefined;
|
||||
asObservable?: () => Observable<Array<ItemType>>;
|
||||
}>;
|
||||
items: (uniques: string[]) => Promise<Observable<Array<ItemType>>>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Observable } from '@umbraco-cms/backoffice/external/rxjs';
|
||||
import type { UmbTreeRootEntityModel, UmbTreeRootModel } from '@umbraco-cms/backoffice/tree';
|
||||
import { ProblemDetailsModel, EntityTreeItemResponseModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { ProblemDetails, EntityTreeItemResponseModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
|
||||
export interface UmbPagedData<T> {
|
||||
total: number;
|
||||
@@ -13,25 +13,25 @@ export interface UmbTreeRepository<
|
||||
> {
|
||||
requestTreeRoot: () => Promise<{
|
||||
data?: TreeRootType;
|
||||
error?: ProblemDetailsModel;
|
||||
error?: ProblemDetails;
|
||||
}>;
|
||||
|
||||
requestRootTreeItems: () => Promise<{
|
||||
data?: UmbPagedData<TreeItemType>;
|
||||
error?: ProblemDetailsModel;
|
||||
error?: ProblemDetails;
|
||||
asObservable?: () => Observable<TreeItemType[]>;
|
||||
}>;
|
||||
|
||||
requestTreeItemsOf: (parentUnique: string | null) => Promise<{
|
||||
data?: UmbPagedData<TreeItemType>;
|
||||
error?: ProblemDetailsModel;
|
||||
error?: ProblemDetails;
|
||||
asObservable?: () => Observable<TreeItemType[]>;
|
||||
}>;
|
||||
|
||||
// TODO: remove this when all repositories are migrated to the new interface items interface
|
||||
requestItemsLegacy?: (uniques: string[]) => Promise<{
|
||||
data?: Array<TreeItemType>;
|
||||
error?: ProblemDetailsModel;
|
||||
error?: ProblemDetails;
|
||||
asObservable?: () => Observable<any[]>;
|
||||
}>;
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ export class UmbResourceController extends UmbBaseController {
|
||||
// Cancelled - do nothing
|
||||
return {};
|
||||
} else {
|
||||
// ApiError - body could hold a ProblemDetailsModel from the server
|
||||
// ApiError - body could hold a ProblemDetails from the server
|
||||
if (typeof error.body !== 'undefined' && !!error.body) {
|
||||
try {
|
||||
(error as any).body = typeof error.body === 'string' ? JSON.parse(error.body) : error.body;
|
||||
|
||||
@@ -111,7 +111,7 @@ export interface UmbTreeItemContext<T> {
|
||||
|
||||
requestChildren(): Promise<{
|
||||
data: PagedResponse<T> | undefined;
|
||||
error: ProblemDetailsModel | undefined;
|
||||
error: ProblemDetails | undefined;
|
||||
asObservable?: () => Observable<T[]>;
|
||||
}>;
|
||||
toggleContextMenu(): void;
|
||||
|
||||
Reference in New Issue
Block a user