refactor
This commit is contained in:
@@ -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<
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -40,7 +40,7 @@ export class UmbCreateDictionaryModalElement extends UmbModalBaseElement<
|
||||
|
||||
this.modalContext?.submit({
|
||||
name,
|
||||
parentId: this.data?.unique ?? undefined,
|
||||
parentId: this.data?.parentId ?? null,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user