remove sort children success notification from repository (#19166)

This commit is contained in:
Mads Rasmussen
2025-04-28 08:52:35 +02:00
committed by GitHub
parent 2d32437779
commit 6bda0b9d4d
2 changed files with 4 additions and 48 deletions

View File

@@ -1,37 +1,15 @@
import { UmbSortChildrenOfDocumentServerDataSource } from './sort-children-of.server.data.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';
import type { UmbNotificationContext } from '@umbraco-cms/backoffice/notification';
import { UMB_NOTIFICATION_CONTEXT } from '@umbraco-cms/backoffice/notification';
import type { UmbSortChildrenOfArgs, UmbSortChildrenOfRepository } from '@umbraco-cms/backoffice/tree';
export class UmbSortChildrenOfDocumentRepository extends UmbControllerBase implements UmbSortChildrenOfRepository {
#dataSource: UmbSortChildrenOfDocumentServerDataSource;
#notificationContext?: UmbNotificationContext;
constructor(host: UmbControllerHost) {
super(host);
this.#dataSource = new UmbSortChildrenOfDocumentServerDataSource(this);
this.consumeContext(UMB_NOTIFICATION_CONTEXT, (instance) => {
this.#notificationContext = instance;
});
}
#dataSource = new UmbSortChildrenOfDocumentServerDataSource(this);
async sortChildrenOf(args: UmbSortChildrenOfArgs) {
if (args.unique === undefined) throw new Error('Unique is missing');
if (!args.sorting) throw new Error('Sorting details are missing');
const { error } = await this.#dataSource.sortChildrenOf(args);
if (!error) {
const notification = { data: { message: `Items sorted` } };
this.#notificationContext?.peek('positive', notification);
}
return { error };
return this.#dataSource.sortChildrenOf(args);
}
}

View File

@@ -1,37 +1,15 @@
import { UmbSortChildrenOfMediaServerDataSource } from './sort-children-of.server.data.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';
import type { UmbNotificationContext } from '@umbraco-cms/backoffice/notification';
import { UMB_NOTIFICATION_CONTEXT } from '@umbraco-cms/backoffice/notification';
import type { UmbSortChildrenOfArgs, UmbSortChildrenOfRepository } from '@umbraco-cms/backoffice/tree';
export class UmbSortChildrenOfMediaRepository extends UmbControllerBase implements UmbSortChildrenOfRepository {
#dataSource: UmbSortChildrenOfMediaServerDataSource;
#notificationContext?: UmbNotificationContext;
constructor(host: UmbControllerHost) {
super(host);
this.#dataSource = new UmbSortChildrenOfMediaServerDataSource(this);
this.consumeContext(UMB_NOTIFICATION_CONTEXT, (instance) => {
this.#notificationContext = instance;
});
}
#dataSource = new UmbSortChildrenOfMediaServerDataSource(this);
async sortChildrenOf(args: UmbSortChildrenOfArgs) {
if (args.unique === undefined) throw new Error('Unique is missing');
if (!args.sorting) throw new Error('Sorting details are missing');
const { error } = await this.#dataSource.sortChildrenOf(args);
if (!error) {
const notification = { data: { message: `Items sorted` } };
this.#notificationContext?.peek('positive', notification);
}
return { error };
return this.#dataSource.sortChildrenOf(args);
}
}