From 6bc0d3678203cfe9dc1b013151c014c6e18e68cb Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Mon, 30 Sep 2024 17:19:20 +0200 Subject: [PATCH 1/9] add translation package including section registration --- package.json | 1 + src/apps/backoffice/backoffice.element.ts | 1 + src/packages/dictionary/section/constants.ts | 1 - src/packages/dictionary/section/index.ts | 1 - src/packages/dictionary/section/manifests.ts | 40 -------------------- src/packages/translation/constants.ts | 1 + src/packages/translation/index.ts | 1 + src/packages/translation/manifests.ts | 20 ++++++++++ src/packages/translation/umbraco-package.ts | 9 +++++ src/packages/translation/vite.config.ts | 12 ++++++ tsconfig.json | 1 + 11 files changed, 46 insertions(+), 42 deletions(-) delete mode 100644 src/packages/dictionary/section/constants.ts delete mode 100644 src/packages/dictionary/section/index.ts delete mode 100644 src/packages/dictionary/section/manifests.ts create mode 100644 src/packages/translation/constants.ts create mode 100644 src/packages/translation/index.ts create mode 100644 src/packages/translation/manifests.ts create mode 100644 src/packages/translation/umbraco-package.ts create mode 100644 src/packages/translation/vite.config.ts diff --git a/package.json b/package.json index faea40ec0f..0282f30fcb 100644 --- a/package.json +++ b/package.json @@ -94,6 +94,7 @@ "./temporary-file": "./dist-cms/packages/core/temporary-file/index.js", "./themes": "./dist-cms/packages/core/themes/index.js", "./tiny-mce": "./dist-cms/packages/tiny-mce/index.js", + "./translation": "./dist-cms/packages/translation/index.js", "./tree": "./dist-cms/packages/core/tree/index.js", "./ufm": "./dist-cms/packages/ufm/index.js", "./user-change-password": "./dist-cms/packages/user/change-password/index.js", diff --git a/src/apps/backoffice/backoffice.element.ts b/src/apps/backoffice/backoffice.element.ts index be9cc04a29..5e6655468a 100644 --- a/src/apps/backoffice/backoffice.element.ts +++ b/src/apps/backoffice/backoffice.element.ts @@ -41,6 +41,7 @@ const CORE_PACKAGES = [ import('../../packages/telemetry/umbraco-package.js'), import('../../packages/templating/umbraco-package.js'), import('../../packages/tiny-mce/umbraco-package.js'), + import('../../packages/translation/umbraco-package.js'), import('../../packages/ufm/umbraco-package.js'), import('../../packages/umbraco-news/umbraco-package.js'), import('../../packages/user/umbraco-package.js'), diff --git a/src/packages/dictionary/section/constants.ts b/src/packages/dictionary/section/constants.ts deleted file mode 100644 index 62ab444161..0000000000 --- a/src/packages/dictionary/section/constants.ts +++ /dev/null @@ -1 +0,0 @@ -export const UMB_DICTIONARY_SECTION_ALIAS = 'Umb.Section.Translation'; diff --git a/src/packages/dictionary/section/index.ts b/src/packages/dictionary/section/index.ts deleted file mode 100644 index 0390f90107..0000000000 --- a/src/packages/dictionary/section/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { UMB_DICTIONARY_SECTION_ALIAS } from './constants.js'; diff --git a/src/packages/dictionary/section/manifests.ts b/src/packages/dictionary/section/manifests.ts deleted file mode 100644 index 857f53d0cc..0000000000 --- a/src/packages/dictionary/section/manifests.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { UMB_DICTIONARY_ROOT_ENTITY_TYPE } from '../entity.js'; -import { UMB_DICTIONARY_MENU_ALIAS } from '../menu/index.js'; -import { UMB_DICTIONARY_SECTION_ALIAS } from './constants.js'; - -export const manifests: Array = [ - { - type: 'section', - alias: UMB_DICTIONARY_SECTION_ALIAS, - name: 'Dictionary Section', - weight: 400, - meta: { - label: '#sections_translation', - pathname: 'dictionary', - }, - conditions: [ - { - alias: 'Umb.Condition.SectionUserPermission', - match: UMB_DICTIONARY_SECTION_ALIAS, - }, - ], - }, - { - type: 'sectionSidebarApp', - kind: 'menuWithEntityActions', - alias: 'Umb.SidebarMenu.Dictionary', - name: 'Dictionary Sidebar Menu', - weight: 100, - meta: { - label: '#sections_translation', - menu: UMB_DICTIONARY_MENU_ALIAS, - entityType: UMB_DICTIONARY_ROOT_ENTITY_TYPE, - }, - conditions: [ - { - alias: 'Umb.Condition.SectionAlias', - match: UMB_DICTIONARY_SECTION_ALIAS, - }, - ], - }, -]; diff --git a/src/packages/translation/constants.ts b/src/packages/translation/constants.ts new file mode 100644 index 0000000000..da4a87bd38 --- /dev/null +++ b/src/packages/translation/constants.ts @@ -0,0 +1 @@ +export const UMB_TRANSLATION_SECTION_ALIAS = 'Umb.Section.Translation'; diff --git a/src/packages/translation/index.ts b/src/packages/translation/index.ts new file mode 100644 index 0000000000..4f07201dcf --- /dev/null +++ b/src/packages/translation/index.ts @@ -0,0 +1 @@ +export * from './constants.js'; diff --git a/src/packages/translation/manifests.ts b/src/packages/translation/manifests.ts new file mode 100644 index 0000000000..ec0d675b77 --- /dev/null +++ b/src/packages/translation/manifests.ts @@ -0,0 +1,20 @@ +import { UMB_TRANSLATION_SECTION_ALIAS } from './constants.js'; + +export const manifests: Array = [ + { + type: 'section', + alias: UMB_TRANSLATION_SECTION_ALIAS, + name: 'Translation Section', + weight: 400, + meta: { + label: '#sections_translation', + pathname: 'translation', + }, + conditions: [ + { + alias: 'Umb.Condition.SectionUserPermission', + match: UMB_TRANSLATION_SECTION_ALIAS, + }, + ], + }, +]; diff --git a/src/packages/translation/umbraco-package.ts b/src/packages/translation/umbraco-package.ts new file mode 100644 index 0000000000..31d727ab8e --- /dev/null +++ b/src/packages/translation/umbraco-package.ts @@ -0,0 +1,9 @@ +export const name = 'Umbraco.Core.Translation'; +export const extensions = [ + { + name: 'Umbraco Translation Bundle', + alias: 'Umb.Bundle.Translation', + type: 'bundle', + js: () => import('./manifests.js'), + }, +]; diff --git a/src/packages/translation/vite.config.ts b/src/packages/translation/vite.config.ts new file mode 100644 index 0000000000..d34f1799f5 --- /dev/null +++ b/src/packages/translation/vite.config.ts @@ -0,0 +1,12 @@ +import { defineConfig } from 'vite'; +import { rmSync } from 'fs'; +import { getDefaultConfig } from '../../vite-config-base'; + +const dist = '../../../dist-cms/packages/translation'; + +// delete the unbundled dist folder +rmSync(dist, { recursive: true, force: true }); + +export default defineConfig({ + ...getDefaultConfig({ dist }), +}); diff --git a/tsconfig.json b/tsconfig.json index 44fdddb1a2..2f92b70db4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -122,6 +122,7 @@ DON'T EDIT THIS FILE DIRECTLY. It is generated by /devops/tsconfig/index.js "@umbraco-cms/backoffice/temporary-file": ["./src/packages/core/temporary-file/index.ts"], "@umbraco-cms/backoffice/themes": ["./src/packages/core/themes/index.ts"], "@umbraco-cms/backoffice/tiny-mce": ["./src/packages/tiny-mce/index.ts"], + "@umbraco-cms/backoffice/translation": ["./src/packages/translation/index.ts"], "@umbraco-cms/backoffice/tree": ["./src/packages/core/tree/index.ts"], "@umbraco-cms/backoffice/ufm": ["./src/packages/ufm/index.ts"], "@umbraco-cms/backoffice/user-change-password": ["./src/packages/user/change-password/index.ts"], From d18c52032ad0e57c4cbfcdcc776c93709d9643d0 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Mon, 30 Sep 2024 17:19:38 +0200 Subject: [PATCH 2/9] update localization --- src/assets/lang/en-us.ts | 2 +- src/assets/lang/en.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assets/lang/en-us.ts b/src/assets/lang/en-us.ts index eb5bdaf5c7..cd803070bb 100644 --- a/src/assets/lang/en-us.ts +++ b/src/assets/lang/en-us.ts @@ -1309,7 +1309,7 @@ export default { packages: 'Packages', marketplace: 'Marketplace', settings: 'Settings', - translation: 'Dictionary', + translation: 'Translation', users: 'Users', }, help: { diff --git a/src/assets/lang/en.ts b/src/assets/lang/en.ts index 495129c5cc..042c78dec8 100644 --- a/src/assets/lang/en.ts +++ b/src/assets/lang/en.ts @@ -1327,7 +1327,7 @@ export default { packages: 'Packages', marketplace: 'Marketplace', settings: 'Settings', - translation: 'Dictionary', + translation: 'Translation', users: 'Users', }, help: { From c0919a2bed1e05e07150b23ee93d23379df75678 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Mon, 30 Sep 2024 17:21:49 +0200 Subject: [PATCH 3/9] register dictionary overview dashboard --- src/packages/dictionary/dashboard/manifests.ts | 6 +++--- src/packages/dictionary/manifests.ts | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/packages/dictionary/dashboard/manifests.ts b/src/packages/dictionary/dashboard/manifests.ts index 1f44cead79..3d3f01c245 100644 --- a/src/packages/dictionary/dashboard/manifests.ts +++ b/src/packages/dictionary/dashboard/manifests.ts @@ -1,4 +1,4 @@ -import { UMB_DICTIONARY_SECTION_ALIAS } from '../section/index.js'; +import { UMB_TRANSLATION_SECTION_ALIAS } from '@umbraco-cms/backoffice/translation'; export const manifests: Array = [ { @@ -8,12 +8,12 @@ export const manifests: Array = [ element: () => import('./dictionary-overview-dashboard.element.js'), meta: { label: '#dictionaryItem_overviewTitle', - pathname: '', + pathname: 'dictionary-overview', }, conditions: [ { alias: 'Umb.Condition.SectionAlias', - match: UMB_DICTIONARY_SECTION_ALIAS, + match: UMB_TRANSLATION_SECTION_ALIAS, }, ], }, diff --git a/src/packages/dictionary/manifests.ts b/src/packages/dictionary/manifests.ts index 29e09329db..dd4bd01954 100644 --- a/src/packages/dictionary/manifests.ts +++ b/src/packages/dictionary/manifests.ts @@ -3,7 +3,6 @@ import { manifests as dashboardManifests } from './dashboard/manifests.js'; import { manifests as entityActionManifests } from './entity-action/manifests.js'; import { manifests as menuManifests } from './menu/manifests.js'; import { manifests as repositoryManifests } from './repository/manifests.js'; -import { manifests as sectionManifests } from './section/manifests.js'; import { manifests as treeManifests } from './tree/manifests.js'; import { manifests as workspaceManifests } from './workspace/manifests.js'; @@ -13,7 +12,6 @@ export const manifests: Array = [ ...entityActionManifests, ...menuManifests, ...repositoryManifests, - ...sectionManifests, ...treeManifests, ...workspaceManifests, ]; From d9e4b2efa4ec0ef4d262da51610e829dc9007062 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Mon, 30 Sep 2024 19:22:31 +0200 Subject: [PATCH 4/9] move menu to translation module --- src/packages/dictionary/manifests.ts | 4 ++-- .../dictionary-menu-structure.context.ts | 0 .../{menu => menu-item}/manifests.ts | 9 ++------ src/packages/dictionary/menu/constants.ts | 1 - src/packages/dictionary/menu/index.ts | 1 - src/packages/translation/index.ts | 3 ++- src/packages/translation/manifests.ts | 22 +++---------------- src/packages/translation/menu/constants.ts | 1 + src/packages/translation/menu/index.ts | 1 + src/packages/translation/menu/manifests.ts | 9 ++++++++ .../translation/{ => section}/constants.ts | 0 src/packages/translation/section/index.ts | 1 + src/packages/translation/section/manifests.ts | 20 +++++++++++++++++ 13 files changed, 41 insertions(+), 31 deletions(-) rename src/packages/dictionary/{menu => menu-item}/dictionary-menu-structure.context.ts (100%) rename src/packages/dictionary/{menu => menu-item}/manifests.ts (85%) delete mode 100644 src/packages/dictionary/menu/constants.ts delete mode 100644 src/packages/dictionary/menu/index.ts create mode 100644 src/packages/translation/menu/constants.ts create mode 100644 src/packages/translation/menu/index.ts create mode 100644 src/packages/translation/menu/manifests.ts rename src/packages/translation/{ => section}/constants.ts (100%) create mode 100644 src/packages/translation/section/index.ts create mode 100644 src/packages/translation/section/manifests.ts diff --git a/src/packages/dictionary/manifests.ts b/src/packages/dictionary/manifests.ts index dd4bd01954..699256e02a 100644 --- a/src/packages/dictionary/manifests.ts +++ b/src/packages/dictionary/manifests.ts @@ -1,7 +1,7 @@ import { manifests as collectionManifests } from './collection/manifests.js'; import { manifests as dashboardManifests } from './dashboard/manifests.js'; import { manifests as entityActionManifests } from './entity-action/manifests.js'; -import { manifests as menuManifests } from './menu/manifests.js'; +import { manifests as menuItemManifests } from './menu-item/manifests.js'; import { manifests as repositoryManifests } from './repository/manifests.js'; import { manifests as treeManifests } from './tree/manifests.js'; import { manifests as workspaceManifests } from './workspace/manifests.js'; @@ -10,7 +10,7 @@ export const manifests: Array = [ ...collectionManifests, ...dashboardManifests, ...entityActionManifests, - ...menuManifests, + ...menuItemManifests, ...repositoryManifests, ...treeManifests, ...workspaceManifests, diff --git a/src/packages/dictionary/menu/dictionary-menu-structure.context.ts b/src/packages/dictionary/menu-item/dictionary-menu-structure.context.ts similarity index 100% rename from src/packages/dictionary/menu/dictionary-menu-structure.context.ts rename to src/packages/dictionary/menu-item/dictionary-menu-structure.context.ts diff --git a/src/packages/dictionary/menu/manifests.ts b/src/packages/dictionary/menu-item/manifests.ts similarity index 85% rename from src/packages/dictionary/menu/manifests.ts rename to src/packages/dictionary/menu-item/manifests.ts index f1aa21d016..447eb8727b 100644 --- a/src/packages/dictionary/menu/manifests.ts +++ b/src/packages/dictionary/menu-item/manifests.ts @@ -1,13 +1,8 @@ import { UMB_DICTIONARY_ENTITY_TYPE } from '../entity.js'; import { UMB_DICTIONARY_TREE_ALIAS } from '../tree/index.js'; -import { UMB_DICTIONARY_MENU_ALIAS } from './constants.js'; +import { UMB_TRANSLATION_MENU_ALIAS } from '@umbraco-cms/backoffice/translation'; export const manifests: Array = [ - { - type: 'menu', - alias: UMB_DICTIONARY_MENU_ALIAS, - name: 'Dictionary Menu', - }, { type: 'menuItem', kind: 'tree', @@ -18,7 +13,7 @@ export const manifests: Array = [ label: 'Dictionary', icon: 'icon-book-alt', entityType: UMB_DICTIONARY_ENTITY_TYPE, - menus: [UMB_DICTIONARY_MENU_ALIAS], + menus: [UMB_TRANSLATION_MENU_ALIAS], treeAlias: UMB_DICTIONARY_TREE_ALIAS, hideTreeRoot: true, }, diff --git a/src/packages/dictionary/menu/constants.ts b/src/packages/dictionary/menu/constants.ts deleted file mode 100644 index b92f703ad3..0000000000 --- a/src/packages/dictionary/menu/constants.ts +++ /dev/null @@ -1 +0,0 @@ -export const UMB_DICTIONARY_MENU_ALIAS = 'Umb.Menu.Dictionary'; diff --git a/src/packages/dictionary/menu/index.ts b/src/packages/dictionary/menu/index.ts deleted file mode 100644 index 2751aebdd2..0000000000 --- a/src/packages/dictionary/menu/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { UMB_DICTIONARY_MENU_ALIAS } from './constants.js'; diff --git a/src/packages/translation/index.ts b/src/packages/translation/index.ts index 4f07201dcf..0aa63cbd85 100644 --- a/src/packages/translation/index.ts +++ b/src/packages/translation/index.ts @@ -1 +1,2 @@ -export * from './constants.js'; +export * from './section/index.js'; +export * from './menu/index.js'; diff --git a/src/packages/translation/manifests.ts b/src/packages/translation/manifests.ts index ec0d675b77..58afeb83a5 100644 --- a/src/packages/translation/manifests.ts +++ b/src/packages/translation/manifests.ts @@ -1,20 +1,4 @@ -import { UMB_TRANSLATION_SECTION_ALIAS } from './constants.js'; +import { manifests as sectionManifests } from './section/manifests.js'; +import { manifests as menuManifests } from './menu/manifests.js'; -export const manifests: Array = [ - { - type: 'section', - alias: UMB_TRANSLATION_SECTION_ALIAS, - name: 'Translation Section', - weight: 400, - meta: { - label: '#sections_translation', - pathname: 'translation', - }, - conditions: [ - { - alias: 'Umb.Condition.SectionUserPermission', - match: UMB_TRANSLATION_SECTION_ALIAS, - }, - ], - }, -]; +export const manifests: Array = [...sectionManifests, ...menuManifests]; diff --git a/src/packages/translation/menu/constants.ts b/src/packages/translation/menu/constants.ts new file mode 100644 index 0000000000..5e223d54cf --- /dev/null +++ b/src/packages/translation/menu/constants.ts @@ -0,0 +1 @@ +export const UMB_TRANSLATION_MENU_ALIAS = 'Umb.Menu.Translation'; diff --git a/src/packages/translation/menu/index.ts b/src/packages/translation/menu/index.ts new file mode 100644 index 0000000000..4f07201dcf --- /dev/null +++ b/src/packages/translation/menu/index.ts @@ -0,0 +1 @@ +export * from './constants.js'; diff --git a/src/packages/translation/menu/manifests.ts b/src/packages/translation/menu/manifests.ts new file mode 100644 index 0000000000..f5c9573463 --- /dev/null +++ b/src/packages/translation/menu/manifests.ts @@ -0,0 +1,9 @@ +import { UMB_TRANSLATION_MENU_ALIAS } from './constants.js'; + +export const manifests: Array = [ + { + type: 'menu', + alias: UMB_TRANSLATION_MENU_ALIAS, + name: 'Translation Menu', + }, +]; diff --git a/src/packages/translation/constants.ts b/src/packages/translation/section/constants.ts similarity index 100% rename from src/packages/translation/constants.ts rename to src/packages/translation/section/constants.ts diff --git a/src/packages/translation/section/index.ts b/src/packages/translation/section/index.ts new file mode 100644 index 0000000000..4f07201dcf --- /dev/null +++ b/src/packages/translation/section/index.ts @@ -0,0 +1 @@ +export * from './constants.js'; diff --git a/src/packages/translation/section/manifests.ts b/src/packages/translation/section/manifests.ts new file mode 100644 index 0000000000..ec0d675b77 --- /dev/null +++ b/src/packages/translation/section/manifests.ts @@ -0,0 +1,20 @@ +import { UMB_TRANSLATION_SECTION_ALIAS } from './constants.js'; + +export const manifests: Array = [ + { + type: 'section', + alias: UMB_TRANSLATION_SECTION_ALIAS, + name: 'Translation Section', + weight: 400, + meta: { + label: '#sections_translation', + pathname: 'translation', + }, + conditions: [ + { + alias: 'Umb.Condition.SectionUserPermission', + match: UMB_TRANSLATION_SECTION_ALIAS, + }, + ], + }, +]; From 10327894ddbaf190907bcd300df482c3411ef747 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Mon, 30 Sep 2024 19:34:19 +0200 Subject: [PATCH 5/9] add paths --- ...ictionary-table-collection-view.element.ts | 11 ++++++----- src/packages/dictionary/index.ts | 1 + src/packages/dictionary/paths.ts | 19 +++++++++++++++++++ src/packages/translation/section/index.ts | 1 + src/packages/translation/section/paths.ts | 6 ++++++ 5 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 src/packages/dictionary/paths.ts create mode 100644 src/packages/translation/section/paths.ts diff --git a/src/packages/dictionary/collection/views/table/dictionary-table-collection-view.element.ts b/src/packages/dictionary/collection/views/table/dictionary-table-collection-view.element.ts index 1d692afb5f..5fd03c0e1c 100644 --- a/src/packages/dictionary/collection/views/table/dictionary-table-collection-view.element.ts +++ b/src/packages/dictionary/collection/views/table/dictionary-table-collection-view.element.ts @@ -1,4 +1,5 @@ import type { UmbDictionaryCollectionModel } from '../../types.js'; +import { UMB_EDIT_DICTIONARY_WORKSPACE_PATH_PATTERN } from '../../../paths.js'; import type { UmbDefaultCollectionContext } from '@umbraco-cms/backoffice/collection'; import { UMB_COLLECTION_CONTEXT } from '@umbraco-cms/backoffice/collection'; import type { UmbTableColumn, UmbTableConfig, UmbTableItem } from '@umbraco-cms/backoffice/components'; @@ -74,17 +75,17 @@ export class UmbDictionaryTableCollectionViewElement extends UmbLitElement { #createTableItems(dictionaries: Array, languages: Array) { this._tableItems = dictionaries.map((dictionary) => { + const editPath = UMB_EDIT_DICTIONARY_WORKSPACE_PATH_PATTERN.generateAbsolute({ + unique: dictionary.unique, + }); + return { id: dictionary.unique, icon: 'icon-book-alt-2', data: [ { columnAlias: 'name', - value: html` - ${dictionary.name} `, + value: html` ${dictionary.name} `, }, ...languages.map((language) => { return { diff --git a/src/packages/dictionary/index.ts b/src/packages/dictionary/index.ts index 5c7b94903c..696313ca04 100644 --- a/src/packages/dictionary/index.ts +++ b/src/packages/dictionary/index.ts @@ -3,3 +3,4 @@ export * from './tree/index.js'; export * from './modals/dictionary-picker-modal.token.js'; export * from './entity.js'; export * from './components/index.js'; +export * from './paths.js'; diff --git a/src/packages/dictionary/paths.ts b/src/packages/dictionary/paths.ts new file mode 100644 index 0000000000..7eb3abb18a --- /dev/null +++ b/src/packages/dictionary/paths.ts @@ -0,0 +1,19 @@ +import { UMB_DICTIONARY_ENTITY_TYPE } from './entity.js'; +import { UmbPathPattern } from '@umbraco-cms/backoffice/router'; +import { UMB_TRANSLATION_SECTION_PATHNAME } from '@umbraco-cms/backoffice/translation'; +import { UMB_WORKSPACE_PATH_PATTERN } from '@umbraco-cms/backoffice/workspace'; +import type { UmbEntityModel, UmbEntityUnique } from '@umbraco-cms/backoffice/entity'; + +export const UMB_DICTIONARY_WORKSPACE_PATH = UMB_WORKSPACE_PATH_PATTERN.generateAbsolute({ + sectionName: UMB_TRANSLATION_SECTION_PATHNAME, + entityType: UMB_DICTIONARY_ENTITY_TYPE, +}); + +export const UMB_CREATE_DICTIONARY_WORKSPACE_PATH_PATTERN = new UmbPathPattern<{ + parentEntityType: UmbEntityModel['entityType']; + parentUnique: UmbEntityUnique; +}>('create/parent/:parentEntityType/:parentUnique', UMB_DICTIONARY_WORKSPACE_PATH); + +export const UMB_EDIT_DICTIONARY_WORKSPACE_PATH_PATTERN = new UmbPathPattern<{ + unique: UmbEntityUnique; +}>('edit/:unique', UMB_DICTIONARY_WORKSPACE_PATH); diff --git a/src/packages/translation/section/index.ts b/src/packages/translation/section/index.ts index 4f07201dcf..14b140114e 100644 --- a/src/packages/translation/section/index.ts +++ b/src/packages/translation/section/index.ts @@ -1 +1,2 @@ export * from './constants.js'; +export * from './paths.js'; diff --git a/src/packages/translation/section/paths.ts b/src/packages/translation/section/paths.ts new file mode 100644 index 0000000000..7007c30aec --- /dev/null +++ b/src/packages/translation/section/paths.ts @@ -0,0 +1,6 @@ +import { UMB_SECTION_PATH_PATTERN } from '@umbraco-cms/backoffice/section'; + +export const UMB_TRANSLATION_SECTION_PATHNAME = 'translation'; +export const UMB_TRANSLATION_SECTION_PATH = UMB_SECTION_PATH_PATTERN.generateAbsolute({ + sectionName: UMB_TRANSLATION_SECTION_PATHNAME, +}); From 6306685c965e1fb34a4b260b3b8baaf6af6ec4c1 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Mon, 30 Sep 2024 20:33:44 +0200 Subject: [PATCH 6/9] add dashboard path pattern --- src/packages/core/dashboard/index.ts | 1 + src/packages/core/dashboard/paths.ts | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 src/packages/core/dashboard/paths.ts diff --git a/src/packages/core/dashboard/index.ts b/src/packages/core/dashboard/index.ts index 75d2827685..9b48ce1f79 100644 --- a/src/packages/core/dashboard/index.ts +++ b/src/packages/core/dashboard/index.ts @@ -1,2 +1,3 @@ export * from './dashboard.extension.js'; export * from './dashboard-element.interface.js'; +export * from './paths.js'; diff --git a/src/packages/core/dashboard/paths.ts b/src/packages/core/dashboard/paths.ts new file mode 100644 index 0000000000..fa9480efc0 --- /dev/null +++ b/src/packages/core/dashboard/paths.ts @@ -0,0 +1,7 @@ +import { UMB_SECTION_PATH_PATTERN } from '@umbraco-cms/backoffice/section'; +import { UmbPathPattern } from '@umbraco-cms/backoffice/router'; + +export const UMB_DASHBOARD_PATH_PATTERN = new UmbPathPattern< + { dashboardPathname: string }, + typeof UMB_SECTION_PATH_PATTERN.ABSOLUTE_PARAMS +>('dashboard/:dashboardPathname', UMB_SECTION_PATH_PATTERN); From 2d2bf78694ccccb700105595ae32213c5334c065 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Mon, 30 Sep 2024 20:34:00 +0200 Subject: [PATCH 7/9] add dictionary paths --- .../table/dictionary-table-collection-view.element.ts | 2 +- src/packages/dictionary/dashboard/index.ts | 1 + src/packages/dictionary/dashboard/paths.ts | 9 +++++++++ src/packages/dictionary/index.ts | 2 +- .../workspace/dictionary-workspace-editor.element.ts | 3 ++- src/packages/dictionary/{ => workspace}/paths.ts | 2 +- 6 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 src/packages/dictionary/dashboard/index.ts create mode 100644 src/packages/dictionary/dashboard/paths.ts rename src/packages/dictionary/{ => workspace}/paths.ts (93%) diff --git a/src/packages/dictionary/collection/views/table/dictionary-table-collection-view.element.ts b/src/packages/dictionary/collection/views/table/dictionary-table-collection-view.element.ts index 5fd03c0e1c..3f2e8901bf 100644 --- a/src/packages/dictionary/collection/views/table/dictionary-table-collection-view.element.ts +++ b/src/packages/dictionary/collection/views/table/dictionary-table-collection-view.element.ts @@ -1,5 +1,5 @@ import type { UmbDictionaryCollectionModel } from '../../types.js'; -import { UMB_EDIT_DICTIONARY_WORKSPACE_PATH_PATTERN } from '../../../paths.js'; +import { UMB_EDIT_DICTIONARY_WORKSPACE_PATH_PATTERN } from '../../../workspace/paths.js'; import type { UmbDefaultCollectionContext } from '@umbraco-cms/backoffice/collection'; import { UMB_COLLECTION_CONTEXT } from '@umbraco-cms/backoffice/collection'; import type { UmbTableColumn, UmbTableConfig, UmbTableItem } from '@umbraco-cms/backoffice/components'; diff --git a/src/packages/dictionary/dashboard/index.ts b/src/packages/dictionary/dashboard/index.ts new file mode 100644 index 0000000000..b3031d9a5d --- /dev/null +++ b/src/packages/dictionary/dashboard/index.ts @@ -0,0 +1 @@ +export * from './paths.js'; diff --git a/src/packages/dictionary/dashboard/paths.ts b/src/packages/dictionary/dashboard/paths.ts new file mode 100644 index 0000000000..1ecab677c6 --- /dev/null +++ b/src/packages/dictionary/dashboard/paths.ts @@ -0,0 +1,9 @@ +import { UMB_DASHBOARD_PATH_PATTERN } from '@umbraco-cms/backoffice/dashboard'; +import { UMB_TRANSLATION_SECTION_PATHNAME } from '@umbraco-cms/backoffice/translation'; + +export const UMB_DICTIONARY_OVERVIEW_DASHBOARD_PATHNAME = 'dictionary-overview'; + +export const UMB_DICTIONARY_OVERVIEW_DASHBOARD_PATH = UMB_DASHBOARD_PATH_PATTERN.generateAbsolute({ + sectionName: UMB_TRANSLATION_SECTION_PATHNAME, + dashboardPathname: UMB_DICTIONARY_OVERVIEW_DASHBOARD_PATHNAME, +}); diff --git a/src/packages/dictionary/index.ts b/src/packages/dictionary/index.ts index 696313ca04..c4694a0662 100644 --- a/src/packages/dictionary/index.ts +++ b/src/packages/dictionary/index.ts @@ -3,4 +3,4 @@ export * from './tree/index.js'; export * from './modals/dictionary-picker-modal.token.js'; export * from './entity.js'; export * from './components/index.js'; -export * from './paths.js'; +export * from './workspace/paths.js'; diff --git a/src/packages/dictionary/workspace/dictionary-workspace-editor.element.ts b/src/packages/dictionary/workspace/dictionary-workspace-editor.element.ts index 4a6fdadbc4..68314a2296 100644 --- a/src/packages/dictionary/workspace/dictionary-workspace-editor.element.ts +++ b/src/packages/dictionary/workspace/dictionary-workspace-editor.element.ts @@ -1,3 +1,4 @@ +import { UMB_DICTIONARY_OVERVIEW_DASHBOARD_PATH } from '../dashboard/index.js'; import { html, customElement } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; @@ -5,7 +6,7 @@ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; export class UmbDictionaryWorkspaceEditorElement extends UmbLitElement { override render() { return html` - + `; diff --git a/src/packages/dictionary/paths.ts b/src/packages/dictionary/workspace/paths.ts similarity index 93% rename from src/packages/dictionary/paths.ts rename to src/packages/dictionary/workspace/paths.ts index 7eb3abb18a..227fc080ef 100644 --- a/src/packages/dictionary/paths.ts +++ b/src/packages/dictionary/workspace/paths.ts @@ -1,4 +1,4 @@ -import { UMB_DICTIONARY_ENTITY_TYPE } from './entity.js'; +import { UMB_DICTIONARY_ENTITY_TYPE } from '../entity.js'; import { UmbPathPattern } from '@umbraco-cms/backoffice/router'; import { UMB_TRANSLATION_SECTION_PATHNAME } from '@umbraco-cms/backoffice/translation'; import { UMB_WORKSPACE_PATH_PATTERN } from '@umbraco-cms/backoffice/workspace'; From 710cf32225d00032f8ec064f503b868c5976fdde Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Mon, 30 Sep 2024 21:24:46 +0200 Subject: [PATCH 8/9] update create path --- .../entity-action/create/create.action.ts | 16 +++++++--------- src/packages/translation/menu/manifests.ts | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/packages/dictionary/entity-action/create/create.action.ts b/src/packages/dictionary/entity-action/create/create.action.ts index 3b96e6a695..5ee499e488 100644 --- a/src/packages/dictionary/entity-action/create/create.action.ts +++ b/src/packages/dictionary/entity-action/create/create.action.ts @@ -1,18 +1,16 @@ import type { UmbEntityActionArgs } from '@umbraco-cms/backoffice/entity-action'; import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; +import { UMB_CREATE_DICTIONARY_WORKSPACE_PATH_PATTERN } from '../../workspace/paths'; export class UmbCreateDictionaryEntityAction extends UmbEntityActionBase { - constructor(host: UmbControllerHost, args: UmbEntityActionArgs) { - super(host, args); - } - override async execute() { - history.pushState( - {}, - '', - `/section/dictionary/workspace/dictionary/create/parent/${this.args.entityType}/${this.args.unique ?? 'null'}`, - ); + const createPath = UMB_CREATE_DICTIONARY_WORKSPACE_PATH_PATTERN.generateAbsolute({ + parentEntityType: this.args.entityType, + parentUnique: this.args.unique ?? 'null', + }); + + history.pushState({}, '', createPath); } } diff --git a/src/packages/translation/menu/manifests.ts b/src/packages/translation/menu/manifests.ts index f5c9573463..3759c9de91 100644 --- a/src/packages/translation/menu/manifests.ts +++ b/src/packages/translation/menu/manifests.ts @@ -1,3 +1,4 @@ +import { UMB_TRANSLATION_SECTION_ALIAS } from '../section/index.js'; import { UMB_TRANSLATION_MENU_ALIAS } from './constants.js'; export const manifests: Array = [ @@ -6,4 +7,22 @@ export const manifests: Array = [ alias: UMB_TRANSLATION_MENU_ALIAS, name: 'Translation Menu', }, + { + type: 'sectionSidebarApp', + kind: 'menuWithEntityActions', + alias: 'Umb.SidebarMenu.Translation', + name: 'Translation Sidebar Menu', + weight: 100, + meta: { + label: '#sections_translation', + menu: UMB_TRANSLATION_MENU_ALIAS, + entityType: 'dictionary-root', // hard-coded on purpose to avoid circular dependency. We need another way to add actions to a menu kind. + }, + conditions: [ + { + alias: 'Umb.Condition.SectionAlias', + match: UMB_TRANSLATION_SECTION_ALIAS, + }, + ], + }, ]; From 8f35a9af1e3067be34128d67ec019584e8248504 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Mon, 30 Sep 2024 21:26:33 +0200 Subject: [PATCH 9/9] fix imports --- src/packages/dictionary/entity-action/create/create.action.ts | 4 +--- src/packages/dictionary/workspace/index.ts | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) create mode 100644 src/packages/dictionary/workspace/index.ts diff --git a/src/packages/dictionary/entity-action/create/create.action.ts b/src/packages/dictionary/entity-action/create/create.action.ts index 5ee499e488..23e6bb385e 100644 --- a/src/packages/dictionary/entity-action/create/create.action.ts +++ b/src/packages/dictionary/entity-action/create/create.action.ts @@ -1,7 +1,5 @@ -import type { UmbEntityActionArgs } from '@umbraco-cms/backoffice/entity-action'; import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action'; -import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; -import { UMB_CREATE_DICTIONARY_WORKSPACE_PATH_PATTERN } from '../../workspace/paths'; +import { UMB_CREATE_DICTIONARY_WORKSPACE_PATH_PATTERN } from '../../workspace/index.js'; export class UmbCreateDictionaryEntityAction extends UmbEntityActionBase { override async execute() { diff --git a/src/packages/dictionary/workspace/index.ts b/src/packages/dictionary/workspace/index.ts new file mode 100644 index 0000000000..b3031d9a5d --- /dev/null +++ b/src/packages/dictionary/workspace/index.ts @@ -0,0 +1 @@ +export * from './paths.js';