This commit is contained in:
Niels Lyngsø
2023-06-12 10:16:39 +02:00
parent 4ddb3ed9d3
commit 4e576ac8f1
5 changed files with 9 additions and 8 deletions

View File

@@ -2,13 +2,13 @@ import { Observable } from '@umbraco-cms/backoffice/external/rxjs';
import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
export interface UmbCreateDictionaryModalData {
unique: string | null;
parentId: string | null;
parentName?: Observable<string | undefined>;
}
export interface UmbCreateDictionaryModalResult {
name?: string;
parentId?: string;
name: string;
parentId: string | null;
}
export const UMB_CREATE_DICTIONARY_MODAL = new UmbModalToken<

View File

@@ -134,7 +134,8 @@ export class UmbDashboardTranslationDictionaryElement extends UmbLitElement {
if (!this.#modalContext) return;
if (!this.#repo) return;
const modalContext = this.#modalContext?.open(UMB_CREATE_DICTIONARY_MODAL, { unique: null });
console.log('open create:');
const modalContext = this.#modalContext?.open(UMB_CREATE_DICTIONARY_MODAL, { parentId: null });
const { name, parentId } = await modalContext.onSubmit();
if (!name || parentId === undefined) return;

View File

@@ -40,7 +40,7 @@ export class UmbCreateDictionaryModalElement extends UmbModalBaseElement<
this.modalContext?.submit({
name,
parentId: this.data?.unique ?? undefined,
parentId: this.data?.parentId ?? null,
});
}

View File

@@ -11,7 +11,7 @@ import {
} from '@umbraco-cms/backoffice/modal';
// TODO: temp import
import './create-dictionary-modal-layout.element.js';
import './create-dictionary-modal.element.js';
export default class UmbCreateDictionaryEntityAction extends UmbEntityActionBase<UmbDictionaryRepository> {
static styles = [UUITextStyles];
@@ -40,7 +40,7 @@ export default class UmbCreateDictionaryEntityAction extends UmbEntityActionBase
// TODO: how can we get the current entity detail in the modal? Passing the observable
// feels a bit hacky. Works, but hacky.
const modalContext = this.#modalContext?.open(UMB_CREATE_DICTIONARY_MODAL, {
unique: this.unique,
parentId: this.unique,
parentName: this.#sectionSidebarContext.headline,
});

View File

@@ -107,7 +107,7 @@ const modals: Array<ManifestModal> = [
type: 'modal',
alias: 'Umb.Modal.CreateDictionary',
name: 'Create Dictionary Modal',
loader: () => import('./create/create-dictionary-modal-layout.element.js'),
loader: () => import('./create/create-dictionary-modal.element.js'),
},
{
type: 'modal',