Skip to content

Commit b9fbc32

Browse files
committed
lazy load apis
1 parent 576e851 commit b9fbc32

31 files changed

+124
-96
lines changed

src/packages/user/user-group/entity-bulk-actions/manifests.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { UMB_USER_GROUP_COLLECTION_ALIAS } from '../collection/index.js';
22
import { UMB_USER_GROUP_ENTITY_TYPE } from '../entity.js';
3-
import { UMB_USER_GROUP_DETAIL_REPOSITORY_ALIAS } from '../repository/index.js';
4-
import { UmbDeleteUserGroupEntityBulkAction } from './delete/delete.action.js';
53
import { UMB_COLLECTION_ALIAS_CONDITION } from '@umbraco-cms/backoffice/collection';
64
import type { ManifestEntityBulkAction, ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
75

@@ -11,7 +9,7 @@ const entityActions: Array<ManifestEntityBulkAction> = [
119
alias: 'Umb.EntityBulkAction.UserGroup.Delete',
1210
name: 'Delete User Group Entity Bulk Action',
1311
weight: 400,
14-
api: UmbDeleteUserGroupEntityBulkAction,
12+
api: () => import('./delete/delete.action.js'),
1513
forEntityTypes: [UMB_USER_GROUP_ENTITY_TYPE],
1614
meta: {
1715
label: 'Delete',
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
2+
3+
export const manifests: Array<ManifestTypes> = [
4+
{
5+
type: 'condition',
6+
name: 'User Allow Delete Action Condition',
7+
alias: 'Umb.Condition.User.AllowDeleteAction',
8+
api: () => import('./user-allow-delete-action.condition.js'),
9+
},
10+
];

src/packages/user/user/conditions/user-allow-delete-action.condition.ts renamed to src/packages/user/user/conditions/allow-delete/user-allow-delete-action.condition.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,3 @@ export class UmbUserAllowDeleteActionCondition extends UmbUserActionConditionBas
1111
}
1212
}
1313
}
14-
15-
export const manifest: ManifestCondition = {
16-
type: 'condition',
17-
name: 'User Allow Delete Action Condition',
18-
alias: 'Umb.Condition.User.AllowDeleteAction',
19-
api: UmbUserAllowDeleteActionCondition,
20-
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
2+
3+
export const manifests: Array<ManifestTypes> = [
4+
{
5+
type: 'condition',
6+
name: 'User Allow Disable Action Condition',
7+
alias: 'Umb.Condition.User.AllowDisableAction',
8+
api: () => import('./user-allow-disable-action.condition.js'),
9+
},
10+
];
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { UmbUserStateEnum } from '../types.js';
22
import { UmbUserActionConditionBase } from './user-allow-action-base.condition.js';
3-
import type { ManifestCondition } from '@umbraco-cms/backoffice/extension-api';
43

54
export class UmbUserAllowDisableActionCondition extends UmbUserActionConditionBase {
65
async _onUserDataChange() {
@@ -13,10 +12,3 @@ export class UmbUserAllowDisableActionCondition extends UmbUserActionConditionBa
1312
this.permitted = this.userState !== UmbUserStateEnum.DISABLED;
1413
}
1514
}
16-
17-
export const manifest: ManifestCondition = {
18-
type: 'condition',
19-
name: 'User Allow Disable Action Condition',
20-
alias: 'Umb.Condition.User.AllowDisableAction',
21-
api: UmbUserAllowDisableActionCondition,
22-
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
2+
3+
export const manifests: Array<ManifestTypes> = [
4+
{
5+
type: 'condition',
6+
name: 'User Allow Enable Action Condition',
7+
alias: 'Umb.Condition.User.AllowEnableAction',
8+
api: () => import('./user-allow-enable-action.condition.js'),
9+
},
10+
];
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { UmbUserStateEnum } from '../../types.js';
2+
import { UmbUserActionConditionBase } from '../user-allow-action-base.condition.js';
3+
4+
export class UmbUserAllowEnableActionCondition extends UmbUserActionConditionBase {
5+
async _onUserDataChange() {
6+
// don't allow the current user to enable themselves
7+
if (!this.userUnique || (await this.isCurrentUser())) {
8+
this.permitted = false;
9+
return;
10+
}
11+
12+
this.permitted = this.userState === UmbUserStateEnum.DISABLED;
13+
}
14+
}
15+
16+
export { UmbUserAllowEnableActionCondition as api };
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
2+
3+
export const manifests: Array<ManifestTypes> = [
4+
{
5+
type: 'condition',
6+
name: 'User Allow ExternalLogin Action Condition',
7+
alias: 'Umb.Condition.User.AllowExternalLoginAction',
8+
api: () => import('./user-allow-external-login-action.condition.js'),
9+
},
10+
];

src/packages/user/user/conditions/user-allow-external-login-action.condition.ts renamed to src/packages/user/user/conditions/allow-external-login/user-allow-external-login-action.condition.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
2-
import type { ManifestCondition } from '@umbraco-cms/backoffice/extension-api';
32
import { UmbConditionBase, umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
43

54
export class UmbUserAllowExternalLoginActionCondition extends UmbConditionBase<never> {
@@ -16,9 +15,4 @@ export class UmbUserAllowExternalLoginActionCondition extends UmbConditionBase<n
1615
}
1716
}
1817

19-
export const manifest: ManifestCondition = {
20-
type: 'condition',
21-
name: 'User Allow ExternalLogin Action Condition',
22-
alias: 'Umb.Condition.User.AllowExternalLoginAction',
23-
api: UmbUserAllowExternalLoginActionCondition,
24-
};
18+
export { UmbUserAllowExternalLoginActionCondition as api };
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export const manifests: Array<ManifestTypes> = [
2+
{
3+
type: 'condition',
4+
name: 'User Allow Mfa Action Condition',
5+
alias: 'Umb.Condition.User.AllowMfaAction',
6+
api: () => import('./user-allow-mfa-action.condition.js'),
7+
},
8+
];

0 commit comments

Comments
 (0)