Bugfix: Rename Modal Service (#571)
* rename file * rename class * rename token * rename all usages of modal service --------- Co-authored-by: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com>
This commit is contained in:
@@ -1,30 +1,30 @@
|
||||
import { UmbEntityActionBase } from '@umbraco-cms/entity-action';
|
||||
import { UmbContextConsumerController } from '@umbraco-cms/context-api';
|
||||
import { UmbControllerHostInterface } from '@umbraco-cms/controller';
|
||||
import { UmbModalService, UMB_MODAL_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/modal';
|
||||
import { UmbModalContext, UMB_MODAL_CONTEXT_TOKEN } from '@umbraco-cms/modal';
|
||||
|
||||
export class UmbDeleteEntityAction<
|
||||
T extends { delete(unique: string): Promise<void>; requestItems(uniques: Array<string>): any }
|
||||
> extends UmbEntityActionBase<T> {
|
||||
#modalService?: UmbModalService;
|
||||
#modalContext?: UmbModalContext;
|
||||
|
||||
constructor(host: UmbControllerHostInterface, repositoryAlias: string, unique: string) {
|
||||
super(host, repositoryAlias, unique);
|
||||
|
||||
new UmbContextConsumerController(this.host, UMB_MODAL_SERVICE_CONTEXT_TOKEN, (instance) => {
|
||||
this.#modalService = instance;
|
||||
new UmbContextConsumerController(this.host, UMB_MODAL_CONTEXT_TOKEN, (instance) => {
|
||||
this.#modalContext = instance;
|
||||
});
|
||||
}
|
||||
|
||||
async execute() {
|
||||
if (!this.repository || !this.#modalService) return;
|
||||
if (!this.repository || !this.#modalContext) return;
|
||||
|
||||
const { data } = await this.repository.requestItems([this.unique]);
|
||||
|
||||
if (data) {
|
||||
const item = data[0];
|
||||
|
||||
const modalHandler = this.#modalService.confirm({
|
||||
const modalHandler = this.#modalContext.confirm({
|
||||
headline: `Delete ${item.name}`,
|
||||
content: 'Are you sure you want to delete this item?',
|
||||
color: 'danger',
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import { UmbEntityActionBase } from '@umbraco-cms/entity-action';
|
||||
import { UmbContextConsumerController } from '@umbraco-cms/context-api';
|
||||
import { UmbControllerHostInterface } from '@umbraco-cms/controller';
|
||||
import { UmbModalService, UMB_MODAL_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/modal';
|
||||
import { UmbModalContext, UMB_MODAL_CONTEXT_TOKEN } from '@umbraco-cms/modal';
|
||||
|
||||
export class UmbTrashEntityAction<
|
||||
T extends { trash(unique: Array<string>): Promise<void>; requestTreeItems(uniques: Array<string>): any }
|
||||
> extends UmbEntityActionBase<T> {
|
||||
#modalService?: UmbModalService;
|
||||
#modalContext?: UmbModalContext;
|
||||
|
||||
constructor(host: UmbControllerHostInterface, repositoryAlias: string, unique: string) {
|
||||
super(host, repositoryAlias, unique);
|
||||
|
||||
new UmbContextConsumerController(this.host, UMB_MODAL_SERVICE_CONTEXT_TOKEN, (instance) => {
|
||||
this.#modalService = instance;
|
||||
new UmbContextConsumerController(this.host, UMB_MODAL_CONTEXT_TOKEN, (instance) => {
|
||||
this.#modalContext = instance;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ export class UmbTrashEntityAction<
|
||||
if (data) {
|
||||
const item = data[0];
|
||||
|
||||
const modalHandler = this.#modalService?.confirm({
|
||||
const modalHandler = this.#modalContext?.confirm({
|
||||
headline: `Trash ${item.name}`,
|
||||
content: 'Are you sure you want to move this item to the recycle bin?',
|
||||
color: 'danger',
|
||||
|
||||
Reference in New Issue
Block a user