File tree Expand file tree Collapse file tree 3 files changed +54
-0
lines changed
src/packages/user/user/entity-bulk-actions Expand file tree Collapse file tree 3 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 1
1
import { UmbDisableUserRepository } from '../../repository/index.js' ;
2
+ import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action' ;
2
3
import { UmbEntityBulkActionBase } from '@umbraco-cms/backoffice/entity-bulk-action' ;
4
+ import { UmbRequestReloadChildrenOfEntityEvent } from '@umbraco-cms/backoffice/entity-action' ;
5
+ import { UMB_ENTITY_CONTEXT } from '@umbraco-cms/backoffice/entity' ;
3
6
4
7
export class UmbDisableUserEntityBulkAction extends UmbEntityBulkActionBase < object > {
5
8
async execute ( ) {
6
9
const repository = new UmbDisableUserRepository ( this . _host ) ;
7
10
await repository . disable ( this . selection ) ;
11
+
12
+ const entityContext = await this . getContext ( UMB_ENTITY_CONTEXT ) ;
13
+ const entityType = entityContext . getEntityType ( ) ;
14
+ const unique = entityContext . getUnique ( ) ;
15
+
16
+ if ( ! entityType ) throw new Error ( 'Entity type not found' ) ;
17
+ if ( unique === undefined ) throw new Error ( 'Entity unique not found' ) ;
18
+
19
+ const eventContext = await this . getContext ( UMB_ACTION_EVENT_CONTEXT ) ;
20
+ const event = new UmbRequestReloadChildrenOfEntityEvent ( {
21
+ entityType,
22
+ unique,
23
+ } ) ;
24
+
25
+ eventContext . dispatchEvent ( event ) ;
8
26
}
9
27
}
Original file line number Diff line number Diff line change 1
1
import { UmbEnableUserRepository } from '../../repository/index.js' ;
2
+ import { UMB_ENTITY_CONTEXT } from '@umbraco-cms/backoffice/entity' ;
2
3
import { UmbEntityBulkActionBase } from '@umbraco-cms/backoffice/entity-bulk-action' ;
4
+ import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action' ;
5
+ import { UmbRequestReloadChildrenOfEntityEvent } from '@umbraco-cms/backoffice/entity-action' ;
3
6
4
7
export class UmbEnableUserEntityBulkAction extends UmbEntityBulkActionBase < object > {
5
8
async execute ( ) {
6
9
const repository = new UmbEnableUserRepository ( this . _host ) ;
7
10
await repository . enable ( this . selection ) ;
11
+
12
+ const entityContext = await this . getContext ( UMB_ENTITY_CONTEXT ) ;
13
+ const entityType = entityContext . getEntityType ( ) ;
14
+ const unique = entityContext . getUnique ( ) ;
15
+
16
+ if ( ! entityType ) throw new Error ( 'Entity type not found' ) ;
17
+ if ( unique === undefined ) throw new Error ( 'Entity unique not found' ) ;
18
+
19
+ const eventContext = await this . getContext ( UMB_ACTION_EVENT_CONTEXT ) ;
20
+ const event = new UmbRequestReloadChildrenOfEntityEvent ( {
21
+ entityType,
22
+ unique,
23
+ } ) ;
24
+
25
+ eventContext . dispatchEvent ( event ) ;
8
26
}
9
27
}
Original file line number Diff line number Diff line change 1
1
import { UmbUnlockUserRepository } from '../../repository/index.js' ;
2
+ import { UMB_ENTITY_CONTEXT } from '@umbraco-cms/backoffice/entity' ;
2
3
import { UmbEntityBulkActionBase } from '@umbraco-cms/backoffice/entity-bulk-action' ;
4
+ import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action' ;
5
+ import { UmbRequestReloadChildrenOfEntityEvent } from '@umbraco-cms/backoffice/entity-action' ;
3
6
4
7
export class UmbUnlockUserEntityBulkAction extends UmbEntityBulkActionBase < object > {
5
8
async execute ( ) {
6
9
const repository = new UmbUnlockUserRepository ( this . _host ) ;
7
10
await repository . unlock ( this . selection ) ;
11
+
12
+ const entityContext = await this . getContext ( UMB_ENTITY_CONTEXT ) ;
13
+ const entityType = entityContext . getEntityType ( ) ;
14
+ const unique = entityContext . getUnique ( ) ;
15
+
16
+ if ( ! entityType ) throw new Error ( 'Entity type not found' ) ;
17
+ if ( unique === undefined ) throw new Error ( 'Entity unique not found' ) ;
18
+
19
+ const eventContext = await this . getContext ( UMB_ACTION_EVENT_CONTEXT ) ;
20
+ const event = new UmbRequestReloadChildrenOfEntityEvent ( {
21
+ entityType,
22
+ unique,
23
+ } ) ;
24
+
25
+ eventContext . dispatchEvent ( event ) ;
8
26
}
9
27
}
You can’t perform that action at this time.
0 commit comments