Merge pull request #1143 from umbraco/feature/static-files-and-dictionary-test-fixes

Small adjustments - fix of tests
This commit is contained in:
Mads Rasmussen
2024-01-23 13:51:24 +01:00
committed by GitHub
7 changed files with 57 additions and 48 deletions

View File

@@ -13,24 +13,11 @@ const folderRepository: ManifestRepository = {
};
const entityActions: Array<ManifestEntityAction> = [
{
type: 'entityAction',
alias: 'Umb.EntityAction.DataType.DeleteFolder',
name: 'Delete Data Type Folder Entity Action',
weight: 800,
api: UmbDeleteFolderEntityAction,
meta: {
icon: 'icon-trash',
label: 'Delete Folder...',
repositoryAlias: UMB_DATA_TYPE_FOLDER_REPOSITORY_ALIAS,
entityTypes: [UMB_DATA_TYPE_FOLDER_ENTITY_TYPE],
},
},
{
type: 'entityAction',
alias: 'Umb.EntityAction.DataType.RenameFolder',
name: 'Rename Data Type Folder Entity Action',
weight: 700,
weight: 800,
api: UmbFolderUpdateEntityAction,
meta: {
icon: 'icon-edit',
@@ -39,6 +26,19 @@ const entityActions: Array<ManifestEntityAction> = [
entityTypes: [UMB_DATA_TYPE_FOLDER_ENTITY_TYPE],
},
},
{
type: 'entityAction',
alias: 'Umb.EntityAction.DataType.DeleteFolder',
name: 'Delete Data Type Folder Entity Action',
weight: 700,
api: UmbDeleteFolderEntityAction,
meta: {
icon: 'icon-trash',
label: 'Delete Folder...',
repositoryAlias: UMB_DATA_TYPE_FOLDER_REPOSITORY_ALIAS,
entityTypes: [UMB_DATA_TYPE_FOLDER_ENTITY_TYPE],
},
},
];
export const manifests = [folderRepository, ...entityActions];

View File

@@ -1,5 +1,5 @@
import { UMB_DICTIONARY_REPOSITORY_ALIAS } from '../repository/manifests.js';
import { UMB_DICTIONARY_ENTITY_TYPE } from '../entities.js';
import { UMB_DICTIONARY_ENTITY_TYPE, UMB_DICTIONARY_ROOT_ENTITY_TYPE } from '../entities.js';
import UmbReloadDictionaryEntityAction from './reload.action.js';
import UmbImportDictionaryEntityAction from './import/import.action.js';
import UmbExportDictionaryEntityAction from './export/export.action.js';
@@ -18,7 +18,7 @@ const entityActions: Array<ManifestEntityAction> = [
icon: 'icon-add',
label: 'Create',
repositoryAlias: UMB_DICTIONARY_REPOSITORY_ALIAS,
entityTypes: [UMB_DICTIONARY_ENTITY_TYPE],
entityTypes: [UMB_DICTIONARY_ENTITY_TYPE, UMB_DICTIONARY_ROOT_ENTITY_TYPE],
},
},
{
@@ -57,7 +57,7 @@ const entityActions: Array<ManifestEntityAction> = [
icon: 'icon-page-up',
label: 'Import',
repositoryAlias: UMB_DICTIONARY_REPOSITORY_ALIAS,
entityTypes: [UMB_DICTIONARY_ENTITY_TYPE],
entityTypes: [UMB_DICTIONARY_ENTITY_TYPE, UMB_DICTIONARY_ROOT_ENTITY_TYPE],
},
},
{
@@ -70,7 +70,7 @@ const entityActions: Array<ManifestEntityAction> = [
icon: 'icon-refresh',
label: 'Reload',
repositoryAlias: UMB_DICTIONARY_REPOSITORY_ALIAS,
entityTypes: [UMB_DICTIONARY_ENTITY_TYPE],
entityTypes: [UMB_DICTIONARY_ENTITY_TYPE, UMB_DICTIONARY_ROOT_ENTITY_TYPE],
},
},
{

View File

@@ -83,7 +83,10 @@ export class UmbDictionaryWorkspaceContext
if (!this.#data.value.id) return;
if (this.getIsNew()) {
await this.repository.create(this.#data.value);
const { error } = await this.repository.create(this.#data.value);
if (error) {
return;
}
this.setIsNew(false);
} else {
await this.repository.save(this.#data.value.id, this.#data.value);

View File

@@ -1,3 +1,4 @@
import { UMB_DICTIONARY_ROOT_ENTITY_TYPE } from './dictionary/entities.js';
import type { ManifestDashboard, ManifestSection, ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
const sectionAlias = 'Umb.Section.Dictionary';
@@ -15,13 +16,14 @@ const section: ManifestSection = {
const menuSectionSidebarApp: ManifestTypes = {
type: 'sectionSidebarApp',
kind: 'menu',
kind: 'menuWithEntityActions',
alias: 'Umb.SidebarMenu.Dictionary',
name: 'Dictionary Sidebar Menu',
weight: 100,
meta: {
label: 'Dictionary',
menu: 'Umb.Menu.Dictionary',
entityType: UMB_DICTIONARY_ROOT_ENTITY_TYPE,
},
conditions: [
{

View File

@@ -13,24 +13,11 @@ const folderRepository: ManifestRepository = {
};
const entityActions: Array<ManifestEntityAction> = [
{
type: 'entityAction',
alias: 'Umb.EntityAction.DocumentType.DeleteFolder',
name: 'Delete Document Type Folder Entity Action',
weight: 800,
api: UmbDeleteFolderEntityAction,
meta: {
icon: 'icon-trash',
label: 'Delete Folder...',
repositoryAlias: UMB_DOCUMENT_TYPE_FOLDER_REPOSITORY_ALIAS,
entityTypes: [UMB_DOCUMENT_TYPE_FOLDER_ENTITY_TYPE],
},
},
{
type: 'entityAction',
alias: 'Umb.EntityAction.DocumentType.RenameFolder',
name: 'Rename Document Type Folder Entity Action',
weight: 700,
weight: 800,
api: UmbFolderUpdateEntityAction,
meta: {
icon: 'icon-edit',
@@ -39,6 +26,19 @@ const entityActions: Array<ManifestEntityAction> = [
entityTypes: [UMB_DOCUMENT_TYPE_FOLDER_ENTITY_TYPE],
},
},
{
type: 'entityAction',
alias: 'Umb.EntityAction.DocumentType.DeleteFolder',
name: 'Delete Document Type Folder Entity Action',
weight: 700,
api: UmbDeleteFolderEntityAction,
meta: {
icon: 'icon-trash',
label: 'Delete Folder...',
repositoryAlias: UMB_DOCUMENT_TYPE_FOLDER_REPOSITORY_ALIAS,
entityTypes: [UMB_DOCUMENT_TYPE_FOLDER_ENTITY_TYPE],
},
},
];
export const manifests = [folderRepository, ...entityActions];

View File

@@ -13,24 +13,11 @@ const folderRepository: ManifestRepository = {
};
const entityActions: Array<ManifestEntityAction> = [
{
type: 'entityAction',
alias: 'Umb.EntityAction.MediaType.DeleteFolder',
name: 'Delete Media Type Folder Entity Action',
weight: 800,
api: UmbDeleteFolderEntityAction,
meta: {
icon: 'icon-trash',
label: 'Delete Folder...',
repositoryAlias: UMB_MEDIA_TYPE_FOLDER_REPOSITORY_ALIAS,
entityTypes: [UMB_MEDIA_TYPE_FOLDER_ENTITY_TYPE],
},
},
{
type: 'entityAction',
alias: 'Umb.EntityAction.MediaType.RenameFolder',
name: 'Rename Media Type Folder Entity Action',
weight: 700,
weight: 800,
api: UmbFolderUpdateEntityAction,
meta: {
icon: 'icon-edit',
@@ -39,6 +26,19 @@ const entityActions: Array<ManifestEntityAction> = [
entityTypes: [UMB_MEDIA_TYPE_FOLDER_ENTITY_TYPE],
},
},
{
type: 'entityAction',
alias: 'Umb.EntityAction.MediaType.DeleteFolder',
name: 'Delete Media Type Folder Entity Action',
weight: 700,
api: UmbDeleteFolderEntityAction,
meta: {
icon: 'icon-trash',
label: 'Delete Folder...',
repositoryAlias: UMB_MEDIA_TYPE_FOLDER_REPOSITORY_ALIAS,
entityTypes: [UMB_MEDIA_TYPE_FOLDER_ENTITY_TYPE],
},
},
];
export const manifests = [folderRepository, ...entityActions];

View File

@@ -9,6 +9,7 @@ import { UmbBooleanState, UmbObjectState } from '@umbraco-cms/backoffice/observa
import type { TemplateItemResponseModel, TemplateResponseModel } from '@umbraco-cms/backoffice/backend-api';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import { UmbId } from '@umbraco-cms/backoffice/id';
export class UmbTemplateWorkspaceContext
extends UmbEditableWorkspaceContextBase<TemplateResponseModel>
@@ -138,7 +139,10 @@ ${currentContent}`;
const isNew = this.getIsNew();
if (isNew && template) {
const key = UmbId.new();
this.#data.update({ id: key });
await this.repository.create({
key: key,
name: template.name,
content: template.content,
alias: template.alias,