get name for dialog

This commit is contained in:
Niels Lyngsø
2024-05-15 22:28:24 +02:00
parent c81551cef4
commit e7cd4fb42e
6 changed files with 20 additions and 11 deletions

View File

@@ -7,7 +7,10 @@ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import type { UmbPropertyDatasetContext } from '@umbraco-cms/backoffice/property';
import { UMB_PROPERTY_DATASET_CONTEXT } from '@umbraco-cms/backoffice/property';
import { UmbDeleteEvent } from '@umbraco-cms/backoffice/event';
import { UMB_DOCUMENT_TYPE_PICKER_MODAL } from '@umbraco-cms/backoffice/document-type';
import {
UMB_DOCUMENT_TYPE_ITEM_STORE_CONTEXT,
UMB_DOCUMENT_TYPE_PICKER_MODAL,
} from '@umbraco-cms/backoffice/document-type';
import { UmbSorterController } from '@umbraco-cms/backoffice/sorter';
/** TODO: Look into sending a "change" event when there is a change, rather than create, delete, and change event. Make sure it doesn't break move for RTE/List/Grid. [LI] */
@@ -123,10 +126,13 @@ export class UmbInputBlockTypeElement<
}
async #onRequestDelete(item: BlockType) {
const store = await this.getContext(UMB_DOCUMENT_TYPE_ITEM_STORE_CONTEXT);
const contentType = store.getItems([item.contentElementTypeKey]);
await umbConfirmModal(this, {
color: 'danger',
headline: `Remove [TODO: Get name]?`,
content: 'Are you sure you want to remove this block type?',
headline: `Remove ${contentType[0]?.name}?`,
// TODO: Translations: [NL]
content: 'Are you sure you want to remove this Block Type Configuration?',
confirmLabel: 'Remove',
});
this.deleteItem(item.contentElementTypeKey);

View File

@@ -74,7 +74,7 @@ export class UmbStoreBase<StoreItemType = any> extends UmbContextBase<any> imple
* @returns {Array<StoreItemType>}
* @memberof UmbStoreBase
*/
getItems(uniques: Array<string>) {
getItems(uniques: Array<string>): Array<StoreItemType> {
return this._data.getValue().filter((item) => uniques.includes(this._data.getUniqueMethod(item) as string));
}

View File

@@ -0,0 +1,6 @@
import type { UmbDocumentTypeItemStore } from './document-type-item.store.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
export const UMB_DOCUMENT_TYPE_ITEM_STORE_CONTEXT = new UmbContextToken<UmbDocumentTypeItemStore>(
'UmbDocumentTypeItemStore',
);

View File

@@ -1,6 +1,6 @@
import type { UmbDocumentTypeItemModel } from './types.js';
import { UmbDocumentTypeItemServerDataSource } from './document-type-item.server.data-source.js';
import { UMB_DOCUMENT_TYPE_ITEM_STORE_CONTEXT } from './document-type-item.store.js';
import { UMB_DOCUMENT_TYPE_ITEM_STORE_CONTEXT } from './document-type-item-store.context-token.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbItemRepositoryBase } from '@umbraco-cms/backoffice/repository';

View File

@@ -1,5 +1,5 @@
import type { UmbDocumentTypeItemModel } from './types.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import { UMB_DOCUMENT_TYPE_ITEM_STORE_CONTEXT } from './document-type-item-store.context-token.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbItemStoreBase } from '@umbraco-cms/backoffice/store';
@@ -20,7 +20,3 @@ export class UmbDocumentTypeItemStore extends UmbItemStoreBase<UmbDocumentTypeIt
super(host, UMB_DOCUMENT_TYPE_ITEM_STORE_CONTEXT.toString());
}
}
export const UMB_DOCUMENT_TYPE_ITEM_STORE_CONTEXT = new UmbContextToken<UmbDocumentTypeItemStore>(
'UmbDocumentTypeItemStore',
);

View File

@@ -1,3 +1,4 @@
export { UmbDocumentTypeItemRepository } from './document-type-item.repository.js';
export { UMB_DOCUMENT_TYPE_ITEM_REPOSITORY_ALIAS, UMB_DOCUMENT_TYPE_ITEM_STORE_ALIAS } from './manifests.js';
export { UmbDocumentTypeItemRepository } from './document-type-item.repository.js';
export * from './document-type-item-store.context-token.js';
export * from './types.js';