verben-authentication-ui 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/components/auth-callback/auth-callback.component.mjs +57 -0
- package/esm2022/lib/components/auth-callback/auth-callback.module.mjs +18 -0
- package/esm2022/lib/components/button/button.component.mjs +46 -0
- package/esm2022/lib/components/button/button.module.mjs +20 -0
- package/esm2022/lib/components/forgot-password/ForgotPasswordData.mjs +2 -0
- package/esm2022/lib/components/forgot-password/forgot-password.component.mjs +92 -0
- package/esm2022/lib/components/forgot-password/forgot-password.module.mjs +34 -0
- package/esm2022/lib/components/mail/mail.component.mjs +69 -0
- package/esm2022/lib/components/mail/mail.module.mjs +21 -0
- package/esm2022/lib/components/mail-validation/mail-validation.component.mjs +108 -0
- package/esm2022/lib/components/mail-validation/mail-validation.module.mjs +34 -0
- package/esm2022/lib/components/o-auth/o-auth.component.mjs +107 -0
- package/esm2022/lib/components/o-auth/o-auth.module.mjs +19 -0
- package/esm2022/lib/components/otp-input/otp-input.component.mjs +86 -0
- package/esm2022/lib/components/otp-input/otp-input.module.mjs +23 -0
- package/esm2022/lib/components/reset-password/ResetPasswordData.mjs +2 -0
- package/esm2022/lib/components/reset-password/reset-password.component.mjs +108 -0
- package/esm2022/lib/components/reset-password/reset-password.module.mjs +34 -0
- package/esm2022/lib/components/role-control/ChildrenType.mjs +6 -0
- package/esm2022/lib/components/role-control/MappedRole.mjs +2 -0
- package/esm2022/lib/components/role-control/MappedRoleAction.mjs +2 -0
- package/esm2022/lib/components/role-control/MappedRoleContext.mjs +2 -0
- package/esm2022/lib/components/role-control/UIActions.mjs +7 -0
- package/esm2022/lib/components/role-control/UIs.mjs +40 -0
- package/esm2022/lib/components/role-control/base-table-style.mjs +53 -0
- package/esm2022/lib/components/role-control/role-control.component.mjs +1608 -0
- package/esm2022/lib/components/role-control/role-control.module.mjs +18 -0
- package/esm2022/lib/components/role-control/role-control.service.mjs +54 -0
- package/esm2022/lib/components/sign-in/sign-in.component.mjs +318 -0
- package/esm2022/lib/components/sign-in/sign-in.module.mjs +24 -0
- package/esm2022/lib/components/sign-up/sign-up.component.mjs +229 -0
- package/esm2022/lib/components/sign-up/sign-up.module.mjs +24 -0
- package/esm2022/lib/components/sso/base-table-style.mjs +53 -0
- package/esm2022/lib/components/sso/helper.mjs +16 -0
- package/esm2022/lib/components/sso/sso-form/sso-form.component.mjs +74 -0
- package/esm2022/lib/components/sso/sso.columns.mjs +29 -0
- package/esm2022/lib/components/sso/sso.component.mjs +236 -0
- package/esm2022/lib/components/sso/sso.module.mjs +63 -0
- package/esm2022/lib/components/two-factor-auth-otp/two-factor-auth-otp.component.mjs +209 -0
- package/esm2022/lib/components/two-factor-auth-otp/two-factor-auth-otp.module.mjs +22 -0
- package/esm2022/lib/components/two-factor-auth-setup/two-factor-auth-setup.component.mjs +90 -0
- package/esm2022/lib/components/two-factor-auth-setup/two-factor-auth-setup.module.mjs +19 -0
- package/esm2022/lib/components/user-management/base-table-style.mjs +53 -0
- package/esm2022/lib/components/user-management/services/user-management.service.mjs +88 -0
- package/esm2022/lib/components/user-management/user-management-form/use-management-form.component.mjs +73 -0
- package/esm2022/lib/components/user-management/user-management.columns.mjs +53 -0
- package/esm2022/lib/components/user-management/user-management.component.mjs +536 -0
- package/esm2022/lib/components/user-management/user-management.module.mjs +85 -0
- package/esm2022/lib/components/user-management/user-status-badge/user-status-badge.component.mjs +26 -0
- package/esm2022/lib/components/user-request/user-request.component.mjs +320 -0
- package/esm2022/lib/components/user-request/user-request.module.mjs +38 -0
- package/esm2022/lib/components/user-request-approval/access-request.columns.mjs +29 -0
- package/esm2022/lib/components/user-request-approval/base-table-style.mjs +53 -0
- package/esm2022/lib/components/user-request-approval/facades/user-access-request.facade.mjs +260 -0
- package/esm2022/lib/components/user-request-approval/helper.mjs +56 -0
- package/esm2022/lib/components/user-request-approval/services/user-access-request.service.mjs +93 -0
- package/esm2022/lib/components/user-request-approval/states/user-access-request.state.mjs +92 -0
- package/esm2022/lib/components/user-request-approval/user-access-request-status-badge/user-access-request-status-badge.component.mjs +26 -0
- package/esm2022/lib/components/user-request-approval/user-request-approval.component.mjs +271 -0
- package/esm2022/lib/components/user-request-approval/user-request-approval.module.mjs +83 -0
- package/esm2022/lib/components/user-request-approval/user-request-form/use-request-form.component.mjs +86 -0
- package/esm2022/lib/models/ApplicationRoleAction.mjs +2 -0
- package/esm2022/lib/models/ApplicationRoleContext.mjs +2 -0
- package/esm2022/lib/models/ErrorResponse.mjs +11 -0
- package/esm2022/lib/models/OAuthParam.mjs +2 -0
- package/esm2022/lib/models/OAuthType.mjs +9 -0
- package/esm2022/lib/models/PagedResult.mjs +2 -0
- package/esm2022/lib/models/PasswordRequestParam.mjs +2 -0
- package/esm2022/lib/models/PermissionConfig.mjs +2 -0
- package/esm2022/lib/models/ResponseKeyValue.mjs +2 -0
- package/esm2022/lib/models/Role.mjs +2 -0
- package/esm2022/lib/models/RoleAction.mjs +2 -0
- package/esm2022/lib/models/RoleContext.mjs +2 -0
- package/esm2022/lib/models/SearchDynamicWrapper.mjs +2 -0
- package/esm2022/lib/models/SearchOperator.mjs +6 -0
- package/esm2022/lib/models/SearchPropertySign.mjs +11 -0
- package/esm2022/lib/models/SearchPropertyValue.mjs +2 -0
- package/esm2022/lib/models/SearchPropertyValueType.mjs +11 -0
- package/esm2022/lib/models/SortDirection.mjs +7 -0
- package/esm2022/lib/models/Tag.mjs +2 -0
- package/esm2022/lib/models/TenantConfig.mjs +2 -0
- package/esm2022/lib/models/UserRequest.mjs +2 -0
- package/esm2022/lib/models/auth-mechanism.mjs +8 -0
- package/esm2022/lib/models/base.mjs +2 -0
- package/esm2022/lib/models/conditions.mjs +13 -0
- package/esm2022/lib/models/log-in.mjs +2 -0
- package/esm2022/lib/models/mainUser.mjs +2 -0
- package/esm2022/lib/models/oauth-resp.mjs +2 -0
- package/esm2022/lib/models/oauth-response.mjs +2 -0
- package/esm2022/lib/models/object-state.mjs +8 -0
- package/esm2022/lib/models/otpValue.mjs +2 -0
- package/esm2022/lib/models/paged.mjs +2 -0
- package/esm2022/lib/models/query-params.mjs +2 -0
- package/esm2022/lib/models/request-status.mjs +5 -0
- package/esm2022/lib/models/resend-otp-data.mjs +2 -0
- package/esm2022/lib/models/sign-up.mjs +2 -0
- package/esm2022/lib/models/single-sign-on.mjs +2 -0
- package/esm2022/lib/models/status.mjs +6 -0
- package/esm2022/lib/models/user-access-request-status.mjs +7 -0
- package/esm2022/lib/models/user-access-request.mjs +2 -0
- package/esm2022/lib/models/user.mjs +2 -0
- package/esm2022/lib/pipes/async-label.pipe.mjs +25 -0
- package/esm2022/lib/services/authorization.service.mjs +26 -0
- package/esm2022/lib/services/encryption.service.mjs +52 -0
- package/esm2022/lib/services/environment.service.mjs +26 -0
- package/esm2022/lib/services/http-web-request.service.mjs +85 -0
- package/esm2022/lib/services/label.service.mjs +134 -0
- package/esm2022/lib/services/util.service.mjs +55 -0
- package/esm2022/lib/shared/shared.module.mjs +84 -0
- package/esm2022/public-api.mjs +48 -0
- package/esm2022/verben-authentication-ui.mjs +5 -0
- package/fesm2022/verben-authentication-ui.mjs +6622 -0
- package/fesm2022/verben-authentication-ui.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/auth-callback/auth-callback.component.d.ts +17 -0
- package/lib/components/auth-callback/auth-callback.module.d.ts +8 -0
- package/lib/components/button/button.component.d.ts +17 -0
- package/lib/components/button/button.module.d.ts +10 -0
- package/{src/lib/components/forgot-password/ForgotPasswordData.ts → lib/components/forgot-password/ForgotPasswordData.d.ts} +1 -1
- package/lib/components/forgot-password/forgot-password.component.d.ts +30 -0
- package/lib/components/forgot-password/forgot-password.module.d.ts +10 -0
- package/lib/components/mail/mail.component.d.ts +32 -0
- package/lib/components/mail/mail.module.d.ts +11 -0
- package/lib/components/mail-validation/mail-validation.component.d.ts +42 -0
- package/lib/components/mail-validation/mail-validation.module.d.ts +10 -0
- package/lib/components/o-auth/o-auth.component.d.ts +30 -0
- package/lib/components/o-auth/o-auth.module.d.ts +9 -0
- package/lib/components/otp-input/otp-input.component.d.ts +21 -0
- package/lib/components/otp-input/otp-input.module.d.ts +13 -0
- package/lib/components/reset-password/ResetPasswordData.d.ts +5 -0
- package/lib/components/reset-password/reset-password.component.d.ts +30 -0
- package/lib/components/reset-password/reset-password.module.d.ts +10 -0
- package/lib/components/role-control/ChildrenType.d.ts +4 -0
- package/{src/lib/components/role-control/MappedRole.ts → lib/components/role-control/MappedRole.d.ts} +2 -3
- package/{src/lib/components/role-control/MappedRoleAction.ts → lib/components/role-control/MappedRoleAction.d.ts} +1 -2
- package/{src/lib/components/role-control/MappedRoleContext.ts → lib/components/role-control/MappedRoleContext.d.ts} +3 -4
- package/lib/components/role-control/UIActions.d.ts +5 -0
- package/lib/components/role-control/UIs.d.ts +38 -0
- package/lib/components/role-control/base-table-style.d.ts +1 -0
- package/lib/components/role-control/role-control.component.d.ts +131 -0
- package/lib/components/role-control/role-control.module.d.ts +8 -0
- package/lib/components/role-control/role-control.service.d.ts +9 -0
- package/lib/components/sign-in/sign-in.component.d.ts +95 -0
- package/lib/components/sign-in/sign-in.module.d.ts +13 -0
- package/lib/components/sign-up/sign-up.component.d.ts +68 -0
- package/lib/components/sign-up/sign-up.module.d.ts +13 -0
- package/lib/components/sso/base-table-style.d.ts +1 -0
- package/lib/components/sso/helper.d.ts +2 -0
- package/lib/components/sso/sso-form/sso-form.component.d.ts +21 -0
- package/lib/components/sso/sso.columns.d.ts +3 -0
- package/lib/components/sso/sso.component.d.ts +54 -0
- package/lib/components/sso/sso.module.d.ts +11 -0
- package/lib/components/two-factor-auth-otp/two-factor-auth-otp.component.d.ts +67 -0
- package/lib/components/two-factor-auth-otp/two-factor-auth-otp.module.d.ts +12 -0
- package/lib/components/two-factor-auth-setup/two-factor-auth-setup.component.d.ts +39 -0
- package/lib/components/two-factor-auth-setup/two-factor-auth-setup.module.d.ts +9 -0
- package/lib/components/user-management/base-table-style.d.ts +1 -0
- package/lib/components/user-management/services/user-management.service.d.ts +44 -0
- package/lib/components/user-management/user-management-form/use-management-form.component.d.ts +24 -0
- package/lib/components/user-management/user-management.columns.d.ts +3 -0
- package/lib/components/user-management/user-management.component.d.ts +134 -0
- package/lib/components/user-management/user-management.module.d.ts +14 -0
- package/lib/components/user-management/user-status-badge/user-status-badge.component.d.ts +12 -0
- package/lib/components/user-request/user-request.component.d.ts +80 -0
- package/lib/components/user-request/user-request.module.d.ts +11 -0
- package/lib/components/user-request-approval/access-request.columns.d.ts +3 -0
- package/lib/components/user-request-approval/base-table-style.d.ts +1 -0
- package/lib/components/user-request-approval/facades/user-access-request.facade.d.ts +39 -0
- package/lib/components/user-request-approval/helper.d.ts +7 -0
- package/lib/components/user-request-approval/services/user-access-request.service.d.ts +65 -0
- package/lib/components/user-request-approval/states/user-access-request.state.d.ts +35 -0
- package/lib/components/user-request-approval/user-access-request-status-badge/user-access-request-status-badge.component.d.ts +12 -0
- package/lib/components/user-request-approval/user-request-approval.component.d.ts +69 -0
- package/lib/components/user-request-approval/user-request-approval.module.d.ts +12 -0
- package/lib/components/user-request-approval/user-request-form/use-request-form.component.d.ts +25 -0
- package/lib/models/ApplicationRoleAction.d.ts +9 -0
- package/{src/lib/models/ApplicationRoleContext copy.ts → lib/models/ApplicationRoleContext.d.ts} +5 -6
- package/lib/models/ErrorResponse.d.ts +6 -0
- package/lib/models/OAuthParam.d.ts +9 -0
- package/lib/models/OAuthType.d.ts +7 -0
- package/lib/models/PagedResult.d.ts +9 -0
- package/lib/models/PasswordRequestParam.d.ts +5 -0
- package/{src/lib/models/PermissionConfig.ts → lib/models/PermissionConfig.d.ts} +3 -4
- package/lib/models/ResponseKeyValue.d.ts +5 -0
- package/{src/lib/models/Role.ts → lib/models/Role.d.ts} +5 -6
- package/lib/models/RoleAction.d.ts +10 -0
- package/lib/models/RoleContext.d.ts +10 -0
- package/{src/lib/models/SearchDynamicWrapper.ts → lib/models/SearchDynamicWrapper.d.ts} +2 -3
- package/lib/models/SearchOperator.d.ts +4 -0
- package/lib/models/SearchPropertySign.d.ts +9 -0
- package/{src/lib/models/SearchPropertyValue.ts → lib/models/SearchPropertyValue.d.ts} +6 -7
- package/lib/models/SearchPropertyValueType.d.ts +9 -0
- package/lib/models/SortDirection.d.ts +5 -0
- package/{src/lib/models/Tag.ts → lib/models/Tag.d.ts} +3 -4
- package/lib/models/TenantConfig.d.ts +18 -0
- package/lib/models/UserRequest.d.ts +32 -0
- package/lib/models/auth-mechanism.d.ts +14 -0
- package/lib/models/base.d.ts +12 -0
- package/lib/models/conditions.d.ts +11 -0
- package/lib/models/log-in.d.ts +8 -0
- package/{src/lib/models/mainUser.ts → lib/models/mainUser.d.ts} +2 -3
- package/lib/models/oauth-resp.d.ts +6 -0
- package/{src/lib/models/oauth-response.ts → lib/models/oauth-response.d.ts} +1 -1
- package/lib/models/object-state.d.ts +6 -0
- package/{src/lib/models/otpValue.ts → lib/models/otpValue.d.ts} +2 -4
- package/lib/models/paged.d.ts +9 -0
- package/lib/models/query-params.d.ts +8 -0
- package/lib/models/request-status.d.ts +3 -0
- package/lib/models/resend-otp-data.d.ts +8 -0
- package/lib/models/sign-up.d.ts +9 -0
- package/lib/models/single-sign-on.d.ts +7 -0
- package/lib/models/status.d.ts +4 -0
- package/lib/models/user-access-request-status.d.ts +5 -0
- package/{src/lib/models/user-access-request.ts → lib/models/user-access-request.d.ts} +4 -5
- package/lib/models/user.d.ts +18 -0
- package/lib/pipes/async-label.pipe.d.ts +11 -0
- package/lib/services/authorization.service.d.ts +14 -0
- package/lib/services/encryption.service.d.ts +13 -0
- package/lib/services/environment.service.d.ts +22 -0
- package/lib/services/http-web-request.service.d.ts +23 -0
- package/lib/services/label.service.d.ts +15 -0
- package/lib/services/util.service.d.ts +11 -0
- package/lib/shared/shared.module.d.ts +10 -0
- package/package.json +14 -10
- package/{src/public-api.ts → public-api.d.ts} +0 -24
- package/ng-package.json +0 -8
- package/src/lib/base/base-data.component.ts +0 -86
- package/src/lib/base/base-data.facade.ts +0 -157
- package/src/lib/base/base-data.service.ts +0 -49
- package/src/lib/base/base-data.state.ts +0 -94
- package/src/lib/base/models.ts +0 -14
- package/src/lib/components/auth-callback/auth-callback.component.css +0 -30
- package/src/lib/components/auth-callback/auth-callback.component.html +0 -6
- package/src/lib/components/auth-callback/auth-callback.component.spec.ts +0 -23
- package/src/lib/components/auth-callback/auth-callback.component.ts +0 -56
- package/src/lib/components/auth-callback/auth-callback.module.ts +0 -10
- package/src/lib/components/button/button.component.css +0 -3
- package/src/lib/components/button/button.component.html +0 -13
- package/src/lib/components/button/button.component.spec.ts +0 -23
- package/src/lib/components/button/button.component.ts +0 -24
- package/src/lib/components/button/button.module.ts +0 -11
- package/src/lib/components/forgot-password/forgot-password.component.css +0 -50
- package/src/lib/components/forgot-password/forgot-password.component.html +0 -38
- package/src/lib/components/forgot-password/forgot-password.component.spec.ts +0 -23
- package/src/lib/components/forgot-password/forgot-password.component.ts +0 -90
- package/src/lib/components/forgot-password/forgot-password.module.ts +0 -18
- package/src/lib/components/mail/mail.component.css +0 -0
- package/src/lib/components/mail/mail.component.html +0 -11
- package/src/lib/components/mail/mail.component.spec.ts +0 -23
- package/src/lib/components/mail/mail.component.ts +0 -47
- package/src/lib/components/mail/mail.module.ts +0 -13
- package/src/lib/components/mail-validation/mail-validation.component.css +0 -59
- package/src/lib/components/mail-validation/mail-validation.component.html +0 -37
- package/src/lib/components/mail-validation/mail-validation.component.spec.ts +0 -23
- package/src/lib/components/mail-validation/mail-validation.component.ts +0 -66
- package/src/lib/components/mail-validation/mail-validation.module.ts +0 -18
- package/src/lib/components/o-auth/o-auth.component.css +0 -26
- package/src/lib/components/o-auth/o-auth.component.html +0 -26
- package/src/lib/components/o-auth/o-auth.component.spec.ts +0 -23
- package/src/lib/components/o-auth/o-auth.component.ts +0 -115
- package/src/lib/components/o-auth/o-auth.module.ts +0 -11
- package/src/lib/components/otp-input/otp-input.component.css +0 -19
- package/src/lib/components/otp-input/otp-input.component.html +0 -15
- package/src/lib/components/otp-input/otp-input.component.spec.ts +0 -23
- package/src/lib/components/otp-input/otp-input.component.ts +0 -88
- package/src/lib/components/otp-input/otp-input.module.ts +0 -15
- package/src/lib/components/reset-password/ResetPasswordData.ts +0 -5
- package/src/lib/components/reset-password/reset-password.component.css +0 -29
- package/src/lib/components/reset-password/reset-password.component.html +0 -24
- package/src/lib/components/reset-password/reset-password.component.spec.ts +0 -23
- package/src/lib/components/reset-password/reset-password.component.ts +0 -108
- package/src/lib/components/reset-password/reset-password.module.ts +0 -18
- package/src/lib/components/role-control/ChildrenType.ts +0 -4
- package/src/lib/components/role-control/UIActions.ts +0 -5
- package/src/lib/components/role-control/UIs.ts +0 -38
- package/src/lib/components/role-control/base-table-style.ts +0 -52
- package/src/lib/components/role-control/role-control.component.css +0 -87
- package/src/lib/components/role-control/role-control.component.html +0 -603
- package/src/lib/components/role-control/role-control.component.spec.ts +0 -23
- package/src/lib/components/role-control/role-control.component.ts +0 -1884
- package/src/lib/components/role-control/role-control.module.ts +0 -10
- package/src/lib/components/role-control/role-control.service.spec.ts +0 -16
- package/src/lib/components/role-control/role-control.service.ts +0 -53
- package/src/lib/components/sign-in/sign-in.component.css +0 -21
- package/src/lib/components/sign-in/sign-in.component.html +0 -83
- package/src/lib/components/sign-in/sign-in.component.spec.ts +0 -23
- package/src/lib/components/sign-in/sign-in.component.ts +0 -267
- package/src/lib/components/sign-in/sign-in.module.ts +0 -17
- package/src/lib/components/sign-up/sign-up.component.css +0 -36
- package/src/lib/components/sign-up/sign-up.component.html +0 -132
- package/src/lib/components/sign-up/sign-up.component.spec.ts +0 -23
- package/src/lib/components/sign-up/sign-up.component.ts +0 -180
- package/src/lib/components/sign-up/sign-up.module.ts +0 -15
- package/src/lib/components/sso/base-table-style.ts +0 -52
- package/src/lib/components/sso/helper.ts +0 -17
- package/src/lib/components/sso/sso-form/sso-form.component.css +0 -13
- package/src/lib/components/sso/sso-form/sso-form.component.html +0 -109
- package/src/lib/components/sso/sso-form/sso-form.component.spec.ts +0 -23
- package/src/lib/components/sso/sso-form/sso-form.component.ts +0 -70
- package/src/lib/components/sso/sso.columns.ts +0 -32
- package/src/lib/components/sso/sso.component.css +0 -47
- package/src/lib/components/sso/sso.component.html +0 -208
- package/src/lib/components/sso/sso.component.spec.ts +0 -23
- package/src/lib/components/sso/sso.component.ts +0 -261
- package/src/lib/components/sso/sso.module.ts +0 -40
- package/src/lib/components/two-factor-auth-otp/two-factor-auth-otp.component.css +0 -8
- package/src/lib/components/two-factor-auth-otp/two-factor-auth-otp.component.html +0 -30
- package/src/lib/components/two-factor-auth-otp/two-factor-auth-otp.component.spec.ts +0 -23
- package/src/lib/components/two-factor-auth-otp/two-factor-auth-otp.component.ts +0 -155
- package/src/lib/components/two-factor-auth-otp/two-factor-auth-otp.module.ts +0 -15
- package/src/lib/components/two-factor-auth-setup/two-factor-auth-setup.component.css +0 -17
- package/src/lib/components/two-factor-auth-setup/two-factor-auth-setup.component.html +0 -45
- package/src/lib/components/two-factor-auth-setup/two-factor-auth-setup.component.spec.ts +0 -23
- package/src/lib/components/two-factor-auth-setup/two-factor-auth-setup.component.ts +0 -57
- package/src/lib/components/two-factor-auth-setup/two-factor-auth-setup.module.ts +0 -11
- package/src/lib/components/user-management/base-table-style.ts +0 -52
- package/src/lib/components/user-management/facades/user-management.facades.ts +0 -133
- package/src/lib/components/user-management/helper.ts +0 -38
- package/src/lib/components/user-management/index.ts +0 -4
- package/src/lib/components/user-management/services/user-management.service.spec.ts +0 -16
- package/src/lib/components/user-management/services/user-management.service.ts +0 -111
- package/src/lib/components/user-management/states/user-management.state.ts +0 -65
- package/src/lib/components/user-management/user-management-form/use-management-form.component.ts +0 -74
- package/src/lib/components/user-management/user-management-form/user-management-form.component.css +0 -0
- package/src/lib/components/user-management/user-management-form/user-management-form.component.html +0 -89
- package/src/lib/components/user-management/user-management-form/user-management-form.component.spec.ts +0 -23
- package/src/lib/components/user-management/user-management.columns.ts +0 -57
- package/src/lib/components/user-management/user-management.component.css +0 -31
- package/src/lib/components/user-management/user-management.component.html +0 -455
- package/src/lib/components/user-management/user-management.component.spec.ts +0 -23
- package/src/lib/components/user-management/user-management.component.ts +0 -626
- package/src/lib/components/user-management/user-management.module.ts +0 -60
- package/src/lib/components/user-management/user-status-badge/user-status-badge.component.css +0 -0
- package/src/lib/components/user-management/user-status-badge/user-status-badge.component.html +0 -8
- package/src/lib/components/user-management/user-status-badge/user-status-badge.component.spec.ts +0 -22
- package/src/lib/components/user-management/user-status-badge/user-status-badge.component.ts +0 -22
- package/src/lib/components/user-request/user-request.component.css +0 -91
- package/src/lib/components/user-request/user-request.component.html +0 -137
- package/src/lib/components/user-request/user-request.component.spec.ts +0 -23
- package/src/lib/components/user-request/user-request.component.ts +0 -306
- package/src/lib/components/user-request/user-request.module.ts +0 -20
- package/src/lib/components/user-request-approval/access-request.columns.ts +0 -31
- package/src/lib/components/user-request-approval/base-table-style.ts +0 -52
- package/src/lib/components/user-request-approval/facades/user-access-request.facade.ts +0 -324
- package/src/lib/components/user-request-approval/helper.ts +0 -61
- package/src/lib/components/user-request-approval/services/user-access-request.service.spec.ts +0 -16
- package/src/lib/components/user-request-approval/services/user-access-request.service.ts +0 -122
- package/src/lib/components/user-request-approval/states/user-access-request.state.ts +0 -109
- package/src/lib/components/user-request-approval/user-access-request-status-badge/user-access-request-status-badge.component.css +0 -0
- package/src/lib/components/user-request-approval/user-access-request-status-badge/user-access-request-status-badge.component.html +0 -8
- package/src/lib/components/user-request-approval/user-access-request-status-badge/user-access-request-status-badge.component.spec.ts +0 -23
- package/src/lib/components/user-request-approval/user-access-request-status-badge/user-access-request-status-badge.component.ts +0 -22
- package/src/lib/components/user-request-approval/user-request-approval.component.css +0 -6
- package/src/lib/components/user-request-approval/user-request-approval.component.html +0 -273
- package/src/lib/components/user-request-approval/user-request-approval.component.spec.ts +0 -23
- package/src/lib/components/user-request-approval/user-request-approval.component.ts +0 -328
- package/src/lib/components/user-request-approval/user-request-approval.module.ts +0 -56
- package/src/lib/components/user-request-approval/user-request-form/use-request-form.component.ts +0 -98
- package/src/lib/components/user-request-approval/user-request-form/user-request-form.component.css +0 -0
- package/src/lib/components/user-request-approval/user-request-form/user-request-form.component.html +0 -94
- package/src/lib/components/user-request-approval/user-request-form/user-request-form.component.spec.ts +0 -23
- package/src/lib/components/user-request-process/user-request-process.component.css +0 -0
- package/src/lib/components/user-request-process/user-request-process.component.html +0 -1
- package/src/lib/components/user-request-process/user-request-process.component.spec.ts +0 -23
- package/src/lib/components/user-request-process/user-request-process.component.ts +0 -12
- package/src/lib/components/user-request-process/user-request-process.module.ts +0 -12
- package/src/lib/models/ApplicationRoleAction.ts +0 -10
- package/src/lib/models/ApplicationRoleContext.ts +0 -10
- package/src/lib/models/ErrorResponse.ts +0 -7
- package/src/lib/models/FilterTypes.ts +0 -8
- package/src/lib/models/MailConfig.ts +0 -13
- package/src/lib/models/MessageConfig.ts +0 -5
- package/src/lib/models/MessageMedium.ts +0 -4
- package/src/lib/models/OAuthParam.ts +0 -10
- package/src/lib/models/OAuthType.ts +0 -7
- package/src/lib/models/PagedResult.ts +0 -9
- package/src/lib/models/PasswordRequestParam.ts +0 -5
- package/src/lib/models/PeriodMode.ts +0 -10
- package/src/lib/models/ReportSchedule.ts +0 -23
- package/src/lib/models/ReportType.ts +0 -5
- package/src/lib/models/ResponseKeyValue.ts +0 -5
- package/src/lib/models/RoleAction.ts +0 -11
- package/src/lib/models/RoleContext.ts +0 -11
- package/src/lib/models/SMSConfig.ts +0 -11
- package/src/lib/models/SearchOperator.ts +0 -4
- package/src/lib/models/SearchPropertySign.ts +0 -9
- package/src/lib/models/SearchPropertyValueType.ts +0 -9
- package/src/lib/models/SortDirection.ts +0 -5
- package/src/lib/models/TaskNotification.ts +0 -14
- package/src/lib/models/TaskNotificationMessageType.ts +0 -4
- package/src/lib/models/TaskNotificationType.ts +0 -4
- package/src/lib/models/Tenant.ts +0 -22
- package/src/lib/models/TenantConfig.ts +0 -19
- package/src/lib/models/UserRequest.ts +0 -38
- package/src/lib/models/auth-mechanism.ts +0 -15
- package/src/lib/models/base.ts +0 -13
- package/src/lib/models/conditions.ts +0 -11
- package/src/lib/models/log-in.ts +0 -8
- package/src/lib/models/oauth-resp.ts +0 -6
- package/src/lib/models/object-state.ts +0 -6
- package/src/lib/models/paged.ts +0 -9
- package/src/lib/models/query-params.ts +0 -9
- package/src/lib/models/request-status.ts +0 -4
- package/src/lib/models/resend-otp-data.ts +0 -8
- package/src/lib/models/resource.ts +0 -27
- package/src/lib/models/sign-up.ts +0 -11
- package/src/lib/models/single-sign-on.ts +0 -9
- package/src/lib/models/status.ts +0 -5
- package/src/lib/models/user-access-request-status.ts +0 -5
- package/src/lib/models/user-object-state.ts +0 -6
- package/src/lib/models/user.ts +0 -19
- package/src/lib/pipes/async-label.pipe.spec.ts +0 -8
- package/src/lib/pipes/async-label.pipe.ts +0 -20
- package/src/lib/services/authorization.service.spec.ts +0 -16
- package/src/lib/services/authorization.service.ts +0 -24
- package/src/lib/services/encryption.service.ts +0 -57
- package/src/lib/services/environment.service.spec.ts +0 -16
- package/src/lib/services/environment.service.ts +0 -30
- package/src/lib/services/http-web-request.service.spec.ts +0 -16
- package/src/lib/services/http-web-request.service.ts +0 -114
- package/src/lib/services/label.service.spec.ts +0 -16
- package/src/lib/services/label.service.ts +0 -177
- package/src/lib/services/util.service.spec.ts +0 -16
- package/src/lib/services/util.service.ts +0 -49
- package/src/lib/shared/shared.module.ts +0 -55
- package/src/styles.css +0 -96
- package/src/theme/tailwind-setup.css +0 -3
- package/src/theme/tailwind.css +0 -1035
- package/src/utils/components/base-data-view.component.ts +0 -131
- package/src/utils/models/DataViewConfig.ts +0 -19
- package/tailwind.config.js +0 -20
- package/tsconfig.lib.json +0 -15
- package/tsconfig.lib.prod.json +0 -11
- package/tsconfig.spec.json +0 -15
|
@@ -1,1884 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectorRef,
|
|
3
|
-
Component,
|
|
4
|
-
Input,
|
|
5
|
-
OnInit,
|
|
6
|
-
QueryList,
|
|
7
|
-
ViewChild,
|
|
8
|
-
ViewChildren,
|
|
9
|
-
} from '@angular/core';
|
|
10
|
-
import { RoleControlService } from './role-control.service';
|
|
11
|
-
import {
|
|
12
|
-
CardData,
|
|
13
|
-
CardDataViewComponent,
|
|
14
|
-
ColumnDefinition,
|
|
15
|
-
DataFilterType,
|
|
16
|
-
DataTableComponent,
|
|
17
|
-
DataViewComponent,
|
|
18
|
-
IDataFilter,
|
|
19
|
-
VerbenPopUpComponent,
|
|
20
|
-
} from 'verben-ng-ui';
|
|
21
|
-
import { Role } from '../../models/Role';
|
|
22
|
-
import { baseStyle } from './base-table-style';
|
|
23
|
-
import { ObjectState } from '../../models/object-state';
|
|
24
|
-
import { RoleContext } from '../../models/RoleContext';
|
|
25
|
-
import { UIs } from './UIs';
|
|
26
|
-
import { RoleAction } from '../../models/RoleAction';
|
|
27
|
-
import { UIActions } from './UIActions';
|
|
28
|
-
import { MappedRole } from './MappedRole';
|
|
29
|
-
import {
|
|
30
|
-
AuthorizationConfig,
|
|
31
|
-
AuthorizationService,
|
|
32
|
-
} from '../../services/authorization.service';
|
|
33
|
-
import { MappedRoleContext } from './MappedRoleContext';
|
|
34
|
-
import { MappedRoleAction } from './MappedRoleAction';
|
|
35
|
-
import { ChildrenType } from './ChildrenType';
|
|
36
|
-
import {
|
|
37
|
-
FormBuilder,
|
|
38
|
-
FormControl,
|
|
39
|
-
FormGroup,
|
|
40
|
-
Validators,
|
|
41
|
-
} from '@angular/forms';
|
|
42
|
-
import { UtilService } from '../../services/util.service';
|
|
43
|
-
import { HttpWebRequestService } from '../../services/http-web-request.service';
|
|
44
|
-
import { ErrorResponse } from '../../models/ErrorResponse';
|
|
45
|
-
import { PagedResult } from '../../models/PagedResult';
|
|
46
|
-
import { SearchPropertyValue } from '../../models/SearchPropertyValue';
|
|
47
|
-
import { SearchOperator } from '../../models/SearchOperator';
|
|
48
|
-
import { SearchPropertySign } from '../../models/SearchPropertySign';
|
|
49
|
-
import { EnvironmentService } from '../../services/environment.service';
|
|
50
|
-
import { ApplicationRoleContext } from '../../models/ApplicationRoleContext';
|
|
51
|
-
import { ApplicationRoleAction } from '../../models/ApplicationRoleAction';
|
|
52
|
-
import { SearchPropertyValueType } from '../../models/SearchPropertyValueType';
|
|
53
|
-
import { debounceTime, Subject } from 'rxjs';
|
|
54
|
-
import { SortDirection } from '../../models/SortDirection';
|
|
55
|
-
import { PermissionConfig } from '../../models/PermissionConfig';
|
|
56
|
-
|
|
57
|
-
enum DateFilterTypes {
|
|
58
|
-
Before = SearchPropertySign.LT,
|
|
59
|
-
On = SearchPropertySign.EQ,
|
|
60
|
-
After = SearchPropertySign.GT,
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
@Component({
|
|
64
|
-
selector: 'lib-role-control',
|
|
65
|
-
templateUrl: './role-control.component.html',
|
|
66
|
-
styleUrl: './role-control.component.css',
|
|
67
|
-
})
|
|
68
|
-
export class RoleControlComponent implements OnInit {
|
|
69
|
-
visibleColumnDef: ColumnDefinition<MappedRole>[] = [];
|
|
70
|
-
styles = baseStyle;
|
|
71
|
-
data: MappedRole[] = [];
|
|
72
|
-
cardData: CardData[] = [];
|
|
73
|
-
//dataCopy: CardData[] = [];
|
|
74
|
-
|
|
75
|
-
currentData: CardData | null = null;
|
|
76
|
-
currentExpandedCard: CardData | null = null;
|
|
77
|
-
cardContext: CardData | null = null;
|
|
78
|
-
cardContextHistory: CardData[] = [];
|
|
79
|
-
cardContextHistoryData: CardData[][] = [];
|
|
80
|
-
//dataCopyHistory: CardData[][] = [];
|
|
81
|
-
@ViewChild('vdcv') cardDataView!: CardDataViewComponent;
|
|
82
|
-
@ViewChild('vdv') dataView!: DataViewComponent;
|
|
83
|
-
@ViewChildren('popup') popUps!: QueryList<VerbenPopUpComponent>;
|
|
84
|
-
@ViewChild('dt') tableView!: DataTableComponent<MappedRole>;
|
|
85
|
-
@Input() isGlobal: boolean = true;
|
|
86
|
-
@Input() serviceName: string | null = null;
|
|
87
|
-
@Input() application: string | null = null;
|
|
88
|
-
@Input() pageSize: number = 10;
|
|
89
|
-
@Input() searchDebounceTime: number = 500;
|
|
90
|
-
@Input() permissionConfig: PermissionConfig | null = null;
|
|
91
|
-
pageState: PagedResult<Role> | null = null;
|
|
92
|
-
sourceData: AuthorizationConfig[] = [];
|
|
93
|
-
isOpen: boolean = false;
|
|
94
|
-
openDropdownId: string | null = null;
|
|
95
|
-
currentFilters: IDataFilter[] = [];
|
|
96
|
-
currentSorts: IDataFilter[] = [];
|
|
97
|
-
searchTerm$ = new Subject<string>();
|
|
98
|
-
|
|
99
|
-
visibleColumns: IDataFilter[] = [];
|
|
100
|
-
|
|
101
|
-
filterArray: IDataFilter[] = [
|
|
102
|
-
{
|
|
103
|
-
name: 'CreatedAt',
|
|
104
|
-
type: DataFilterType.Date,
|
|
105
|
-
checked: false,
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
name: 'UpdatedAt',
|
|
109
|
-
type: DataFilterType.Date,
|
|
110
|
-
checked: false,
|
|
111
|
-
},
|
|
112
|
-
];
|
|
113
|
-
|
|
114
|
-
sortOptions: IDataFilter[] = [
|
|
115
|
-
{
|
|
116
|
-
name: 'CreatedAt',
|
|
117
|
-
type: DataFilterType.Date,
|
|
118
|
-
checked: false,
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
name: 'UpdatedAt',
|
|
122
|
-
type: DataFilterType.Date,
|
|
123
|
-
checked: false,
|
|
124
|
-
},
|
|
125
|
-
];
|
|
126
|
-
|
|
127
|
-
searchContext: string = '';
|
|
128
|
-
searchContextHistory: string[] = [];
|
|
129
|
-
isInputFocused: boolean = false;
|
|
130
|
-
|
|
131
|
-
// private _searchItem: string = '';
|
|
132
|
-
// get searchItem(): string {
|
|
133
|
-
// return this._searchItem
|
|
134
|
-
// }
|
|
135
|
-
// set searchItem(value: string) {
|
|
136
|
-
// this._searchItem = value;
|
|
137
|
-
// this.searchTerm$.next(value);
|
|
138
|
-
// }
|
|
139
|
-
|
|
140
|
-
// form: FormGroup;
|
|
141
|
-
childPermissionRef: ChildrenType = ChildrenType.Permission;
|
|
142
|
-
|
|
143
|
-
roleContextsStore: ApplicationRoleContext[] = [];
|
|
144
|
-
roleActionsStore: ApplicationRoleAction[] = [];
|
|
145
|
-
private currentSearchTerm: string = '';
|
|
146
|
-
|
|
147
|
-
constructor(
|
|
148
|
-
private authService: AuthorizationService,
|
|
149
|
-
private roleControlSvc: RoleControlService,
|
|
150
|
-
private utilService: UtilService,
|
|
151
|
-
private server: HttpWebRequestService,
|
|
152
|
-
private cdr: ChangeDetectorRef,
|
|
153
|
-
private fb: FormBuilder,
|
|
154
|
-
private envSvc: EnvironmentService
|
|
155
|
-
) {
|
|
156
|
-
this.visibleColumnDef = roleControlSvc.roleColumns;
|
|
157
|
-
this.visibleColumns = roleControlSvc.roleColumns.map((col) => ({
|
|
158
|
-
checked: true,
|
|
159
|
-
name: typeof col.header === 'string' ? col.header : col.id,
|
|
160
|
-
type: DataFilterType.Bool,
|
|
161
|
-
}));
|
|
162
|
-
// this.form = this.fb.group({
|
|
163
|
-
// Name: new FormControl<string | null>(null, Validators.required),
|
|
164
|
-
// });
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
async ngOnInit(): Promise<void> {
|
|
168
|
-
const mockData = this.getMockRoles();
|
|
169
|
-
const roles = await this.getAllRoles();
|
|
170
|
-
const contextsRes = await this.getSavedContexts();
|
|
171
|
-
if (this.isGlobal) {
|
|
172
|
-
if (contextsRes) {
|
|
173
|
-
this.roleContextsStore = contextsRes;
|
|
174
|
-
this.roleActionsStore = contextsRes.flatMap((x) => x.RoleActions);
|
|
175
|
-
const authConfig: AuthorizationConfig[] = contextsRes.map((x) => {
|
|
176
|
-
return {
|
|
177
|
-
Name: x.Name,
|
|
178
|
-
Actions: x.RoleActions.map((y) => {
|
|
179
|
-
return y.Name;
|
|
180
|
-
}),
|
|
181
|
-
};
|
|
182
|
-
});
|
|
183
|
-
this.sourceData = authConfig;
|
|
184
|
-
}
|
|
185
|
-
} else {
|
|
186
|
-
this.sourceData = this.authService.authorizationConfig;
|
|
187
|
-
}
|
|
188
|
-
if (roles) {
|
|
189
|
-
this.setUpMappedData(roles);
|
|
190
|
-
this.setUpCardData();
|
|
191
|
-
}
|
|
192
|
-
this.searchTerm$
|
|
193
|
-
.pipe(debounceTime(this.searchDebounceTime)) // Adjust debounce time here (in ms)
|
|
194
|
-
.subscribe(async (searchTerm) => {
|
|
195
|
-
this.currentSearchTerm = searchTerm;
|
|
196
|
-
this.updateFiltersAndSorts(true);
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
async getSavedContexts(): Promise<ApplicationRoleContext[] | undefined> {
|
|
201
|
-
if (!this.isGlobal || !this.application) {
|
|
202
|
-
return undefined;
|
|
203
|
-
}
|
|
204
|
-
var payload: SearchPropertyValue[] = [
|
|
205
|
-
{
|
|
206
|
-
PropertyName: 'Application',
|
|
207
|
-
EntityValue: this.application,
|
|
208
|
-
Operator: SearchOperator.And,
|
|
209
|
-
Sign: SearchPropertySign.EQ,
|
|
210
|
-
},
|
|
211
|
-
// {
|
|
212
|
-
// PropertyName: 'APIKey',
|
|
213
|
-
// EntityValue: this.envSvc.environment.APIKey,
|
|
214
|
-
// Operator: SearchOperator.And,
|
|
215
|
-
// Sign: SearchPropertySign.EQ,
|
|
216
|
-
// },
|
|
217
|
-
];
|
|
218
|
-
this.utilService.sendBI(true);
|
|
219
|
-
const res = await this.server.post(
|
|
220
|
-
`Application/SearchApplicationRoleContexts/0/0`,
|
|
221
|
-
payload
|
|
222
|
-
);
|
|
223
|
-
this.utilService.sendBI(false);
|
|
224
|
-
if (res instanceof ErrorResponse) {
|
|
225
|
-
return undefined;
|
|
226
|
-
} else {
|
|
227
|
-
var result = (res as PagedResult<ApplicationRoleContext>).Result;
|
|
228
|
-
return result;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
async getAllRoles(): Promise<Role[] | undefined> {
|
|
232
|
-
// var payload: SearchPropertyValue[] = [
|
|
233
|
-
// {
|
|
234
|
-
// PropertyName: 'APIKey',
|
|
235
|
-
// EntityValue: this.envSvc.environment.APIKey,
|
|
236
|
-
// Operator: SearchOperator.And,
|
|
237
|
-
// Sign: SearchPropertySign.EQ
|
|
238
|
-
// }
|
|
239
|
-
// ]
|
|
240
|
-
this.utilService.sendBI(true);
|
|
241
|
-
const res = await this.server.get(`Role/GetRoles/0/${this.pageSize}`);
|
|
242
|
-
this.utilService.sendBI(false);
|
|
243
|
-
if (res instanceof ErrorResponse) {
|
|
244
|
-
return undefined;
|
|
245
|
-
} else {
|
|
246
|
-
this.pageState = res as PagedResult<Role>;
|
|
247
|
-
var result = (res as PagedResult<Role>).Result;
|
|
248
|
-
return result;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
async loadMore() {
|
|
253
|
-
if (!this.pageState) {
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
this.utilService.sendBI(true);
|
|
257
|
-
const res =
|
|
258
|
-
this.currentFilters.length > 0 ||
|
|
259
|
-
this.currentSorts.length > 0 ||
|
|
260
|
-
this.currentSearchTerm.trim().length > 0
|
|
261
|
-
? await this.loadMoreFiltersAndSorts()
|
|
262
|
-
: await this.server.get(
|
|
263
|
-
`Role/GetRoles/${this.pageState.Skip}/${this.pageSize}`
|
|
264
|
-
);
|
|
265
|
-
this.utilService.sendBI(false);
|
|
266
|
-
if (res instanceof ErrorResponse) {
|
|
267
|
-
return;
|
|
268
|
-
} else {
|
|
269
|
-
this.pageState = res as PagedResult<Role>;
|
|
270
|
-
var result = (res as PagedResult<Role>).Result;
|
|
271
|
-
const data = this.setUpMappedDataExtra(result);
|
|
272
|
-
this.data = this.data.concat(data);
|
|
273
|
-
this.setUpCardDataExtra(data);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
getApplicationContextCode(name: string): string {
|
|
278
|
-
const item = this.roleContextsStore.find((x) => x.Name == name);
|
|
279
|
-
return item ? item.Code : '';
|
|
280
|
-
}
|
|
281
|
-
getApplicationActionCode(name: string): string {
|
|
282
|
-
const item = this.roleActionsStore.find((x) => x.Name == name);
|
|
283
|
-
return item ? item.Code : '';
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
findParent(cardData: CardData[], target: CardData): CardData | null {
|
|
287
|
-
for (const item of cardData) {
|
|
288
|
-
if (item.children.includes(target)) {
|
|
289
|
-
return item; // Immediate parent found
|
|
290
|
-
}
|
|
291
|
-
const parent = this.findParent(item.children, target);
|
|
292
|
-
if (parent) {
|
|
293
|
-
return parent;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
return null; // Not found
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
isAllSelected(item: CardData): boolean {
|
|
300
|
-
const parent =
|
|
301
|
-
this.cardContextHistoryData.length > 0
|
|
302
|
-
? this.findParent(this.cardContextHistoryData[0], item)
|
|
303
|
-
: this.findParent(this.cardData, item);
|
|
304
|
-
if (
|
|
305
|
-
parent &&
|
|
306
|
-
parent.data.ChildrenType &&
|
|
307
|
-
parent.data.ChildrenType == ChildrenType.Action &&
|
|
308
|
-
(parent.data as MappedRoleContext).RoleActions.some((y) => !y.Selected)
|
|
309
|
-
) {
|
|
310
|
-
return false;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
if (
|
|
314
|
-
parent &&
|
|
315
|
-
parent.data.ChildrenType &&
|
|
316
|
-
parent.data.ChildrenType == ChildrenType.Permission &&
|
|
317
|
-
(parent.data as MappedRole).RoleContexts.some((y) => !y.Selected)
|
|
318
|
-
) {
|
|
319
|
-
return false;
|
|
320
|
-
}
|
|
321
|
-
return true;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
isCheckboxDisabled(item: CardData): boolean {
|
|
325
|
-
const parent =
|
|
326
|
-
this.cardContextHistoryData.length > 0
|
|
327
|
-
? this.findParent(this.cardContextHistoryData[0], item)
|
|
328
|
-
: this.findParent(this.cardData, item);
|
|
329
|
-
if (
|
|
330
|
-
parent &&
|
|
331
|
-
parent.data.ChildrenType &&
|
|
332
|
-
parent.data.ChildrenType == ChildrenType.Action &&
|
|
333
|
-
(parent.data.Selected == false ||
|
|
334
|
-
(this.permissionConfig != null &&
|
|
335
|
-
!this.permissionConfig.Actions['AddAction']))
|
|
336
|
-
) {
|
|
337
|
-
return true;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
if (
|
|
341
|
-
parent &&
|
|
342
|
-
parent.data.ChildrenType &&
|
|
343
|
-
parent.data.ChildrenType == ChildrenType.Permission &&
|
|
344
|
-
this.permissionConfig != null &&
|
|
345
|
-
!this.permissionConfig.Actions['AddContext']
|
|
346
|
-
) {
|
|
347
|
-
return true;
|
|
348
|
-
}
|
|
349
|
-
return false;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
setUpMappedData(data: Role[]) {
|
|
353
|
-
this.data = data.map((x) => {
|
|
354
|
-
return {
|
|
355
|
-
...x,
|
|
356
|
-
Id: x.Code,
|
|
357
|
-
ChildrenType: ChildrenType.Permission,
|
|
358
|
-
RoleContexts: this.sourceData.map((config) => {
|
|
359
|
-
const existingId = x.RoleContexts.findIndex(
|
|
360
|
-
(y) => y.Name == config.Name
|
|
361
|
-
);
|
|
362
|
-
var context: MappedRoleContext = {
|
|
363
|
-
ChildrenType: ChildrenType.Action,
|
|
364
|
-
Selected: existingId > -1 ? true : false,
|
|
365
|
-
RoleActions: config.Actions.map((action) => {
|
|
366
|
-
const existingAction =
|
|
367
|
-
existingId > -1
|
|
368
|
-
? x.RoleContexts[existingId].RoleActions.findIndex(
|
|
369
|
-
(c) => c.Name == action
|
|
370
|
-
)
|
|
371
|
-
: -1;
|
|
372
|
-
|
|
373
|
-
var act: MappedRoleAction = {
|
|
374
|
-
Selected: existingAction > -1 ? true : false,
|
|
375
|
-
Name: action,
|
|
376
|
-
Role: x.Code,
|
|
377
|
-
Context: '',
|
|
378
|
-
id:
|
|
379
|
-
existingAction > -1
|
|
380
|
-
? x.RoleContexts[existingId].RoleActions[existingAction]
|
|
381
|
-
.Code
|
|
382
|
-
: '',
|
|
383
|
-
Id:
|
|
384
|
-
existingAction > -1
|
|
385
|
-
? x.RoleContexts[existingId].RoleActions[existingAction]
|
|
386
|
-
.Code
|
|
387
|
-
: '',
|
|
388
|
-
CreatedAt: new Date(),
|
|
389
|
-
UpdatedAt: new Date(),
|
|
390
|
-
DataState: ObjectState.New,
|
|
391
|
-
TenantId: x.TenantId,
|
|
392
|
-
Code:
|
|
393
|
-
existingAction > -1
|
|
394
|
-
? x.RoleContexts[existingId].RoleActions[existingAction]
|
|
395
|
-
.Code
|
|
396
|
-
: '',
|
|
397
|
-
ServiceName:
|
|
398
|
-
existingAction > -1
|
|
399
|
-
? x.RoleContexts[existingId].RoleActions[existingAction]
|
|
400
|
-
.ServiceName
|
|
401
|
-
: '',
|
|
402
|
-
APIKey:
|
|
403
|
-
existingAction > -1
|
|
404
|
-
? x.RoleContexts[existingId].RoleActions[existingAction]
|
|
405
|
-
.APIKey
|
|
406
|
-
: this.envSvc.environment.APIKey,
|
|
407
|
-
ApplicationRoleAction: this.getApplicationActionCode(action),
|
|
408
|
-
};
|
|
409
|
-
return act;
|
|
410
|
-
}),
|
|
411
|
-
Name: config.Name,
|
|
412
|
-
Role: x.Code,
|
|
413
|
-
id: existingId > -1 ? x.RoleContexts[existingId].Code : '',
|
|
414
|
-
Id: existingId > -1 ? x.RoleContexts[existingId].Code : '',
|
|
415
|
-
CreatedAt: new Date(),
|
|
416
|
-
UpdatedAt: new Date(),
|
|
417
|
-
DataState: ObjectState.New,
|
|
418
|
-
TenantId: x.TenantId,
|
|
419
|
-
Code: existingId > -1 ? x.RoleContexts[existingId].Code : '',
|
|
420
|
-
ServiceName:
|
|
421
|
-
existingId > -1 ? x.RoleContexts[existingId].ServiceName : '',
|
|
422
|
-
APIKey:
|
|
423
|
-
existingId > -1
|
|
424
|
-
? x.RoleContexts[existingId].APIKey
|
|
425
|
-
: this.envSvc.environment.APIKey,
|
|
426
|
-
ApplicationRoleContext: this.getApplicationContextCode(config.Name),
|
|
427
|
-
};
|
|
428
|
-
|
|
429
|
-
return context;
|
|
430
|
-
}),
|
|
431
|
-
};
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
setUpMappedDataExtra(data: Role[]): MappedRole[] {
|
|
435
|
-
return data.map((x) => {
|
|
436
|
-
return {
|
|
437
|
-
...x,
|
|
438
|
-
Id: x.Code,
|
|
439
|
-
ChildrenType: ChildrenType.Permission,
|
|
440
|
-
RoleContexts: this.sourceData.map((config) => {
|
|
441
|
-
const existingId = x.RoleContexts.findIndex(
|
|
442
|
-
(y) => y.Name == config.Name
|
|
443
|
-
);
|
|
444
|
-
var context: MappedRoleContext = {
|
|
445
|
-
ChildrenType: ChildrenType.Action,
|
|
446
|
-
Selected: existingId > -1 ? true : false,
|
|
447
|
-
RoleActions: config.Actions.map((action) => {
|
|
448
|
-
const existingAction =
|
|
449
|
-
existingId > -1
|
|
450
|
-
? x.RoleContexts[existingId].RoleActions.findIndex(
|
|
451
|
-
(c) => c.Name == action
|
|
452
|
-
)
|
|
453
|
-
: -1;
|
|
454
|
-
|
|
455
|
-
var act: MappedRoleAction = {
|
|
456
|
-
Selected: existingAction > -1 ? true : false,
|
|
457
|
-
Name: action,
|
|
458
|
-
Role: x.Code,
|
|
459
|
-
Context: '',
|
|
460
|
-
id:
|
|
461
|
-
existingAction > -1
|
|
462
|
-
? x.RoleContexts[existingId].RoleActions[existingAction]
|
|
463
|
-
.Code
|
|
464
|
-
: '',
|
|
465
|
-
Id:
|
|
466
|
-
existingAction > -1
|
|
467
|
-
? x.RoleContexts[existingId].RoleActions[existingAction]
|
|
468
|
-
.Code
|
|
469
|
-
: '',
|
|
470
|
-
CreatedAt: new Date(),
|
|
471
|
-
UpdatedAt: new Date(),
|
|
472
|
-
DataState: ObjectState.New,
|
|
473
|
-
TenantId: x.TenantId,
|
|
474
|
-
Code:
|
|
475
|
-
existingAction > -1
|
|
476
|
-
? x.RoleContexts[existingId].RoleActions[existingAction]
|
|
477
|
-
.Code
|
|
478
|
-
: '',
|
|
479
|
-
ServiceName:
|
|
480
|
-
existingAction > -1
|
|
481
|
-
? x.RoleContexts[existingId].RoleActions[existingAction]
|
|
482
|
-
.ServiceName
|
|
483
|
-
: '',
|
|
484
|
-
APIKey:
|
|
485
|
-
existingAction > -1
|
|
486
|
-
? x.RoleContexts[existingId].RoleActions[existingAction]
|
|
487
|
-
.APIKey
|
|
488
|
-
: this.envSvc.environment.APIKey,
|
|
489
|
-
ApplicationRoleAction: this.getApplicationActionCode(action),
|
|
490
|
-
};
|
|
491
|
-
return act;
|
|
492
|
-
}),
|
|
493
|
-
Name: config.Name,
|
|
494
|
-
Role: x.Code,
|
|
495
|
-
id: existingId > -1 ? x.RoleContexts[existingId].Code : '',
|
|
496
|
-
Id: existingId > -1 ? x.RoleContexts[existingId].Code : '',
|
|
497
|
-
CreatedAt: new Date(),
|
|
498
|
-
UpdatedAt: new Date(),
|
|
499
|
-
DataState: ObjectState.New,
|
|
500
|
-
TenantId: x.TenantId,
|
|
501
|
-
Code: existingId > -1 ? x.RoleContexts[existingId].Code : '',
|
|
502
|
-
ServiceName:
|
|
503
|
-
existingId > -1 ? x.RoleContexts[existingId].ServiceName : '',
|
|
504
|
-
APIKey:
|
|
505
|
-
existingId > -1
|
|
506
|
-
? x.RoleContexts[existingId].APIKey
|
|
507
|
-
: this.envSvc.environment.APIKey,
|
|
508
|
-
ApplicationRoleContext: this.getApplicationContextCode(config.Name),
|
|
509
|
-
};
|
|
510
|
-
|
|
511
|
-
return context;
|
|
512
|
-
}),
|
|
513
|
-
};
|
|
514
|
-
});
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
setUpCardData() {
|
|
518
|
-
const cardData: CardData[] = this.data.map((x) => {
|
|
519
|
-
return {
|
|
520
|
-
selected: false,
|
|
521
|
-
title: x.Name,
|
|
522
|
-
data: x,
|
|
523
|
-
body: [],
|
|
524
|
-
children: x.RoleContexts.map((c) => {
|
|
525
|
-
return {
|
|
526
|
-
selected: false,
|
|
527
|
-
title: this.getFormattedName(c.Name),
|
|
528
|
-
data: c,
|
|
529
|
-
body: [],
|
|
530
|
-
children: c.RoleActions.map((a) => {
|
|
531
|
-
return {
|
|
532
|
-
selected: false,
|
|
533
|
-
title: this.getFormattedName(a.Name),
|
|
534
|
-
data: a,
|
|
535
|
-
body: [],
|
|
536
|
-
children: [],
|
|
537
|
-
};
|
|
538
|
-
}),
|
|
539
|
-
};
|
|
540
|
-
}),
|
|
541
|
-
};
|
|
542
|
-
});
|
|
543
|
-
this.cardData = cardData;
|
|
544
|
-
}
|
|
545
|
-
setUpCardDataExtra(baseData: MappedRole[]) {
|
|
546
|
-
const cardData: CardData[] = baseData.map((x) => {
|
|
547
|
-
return {
|
|
548
|
-
selected: false,
|
|
549
|
-
title: x.Name,
|
|
550
|
-
data: x,
|
|
551
|
-
body: [],
|
|
552
|
-
children: x.RoleContexts.map((c) => {
|
|
553
|
-
return {
|
|
554
|
-
selected: false,
|
|
555
|
-
title: this.getFormattedName(c.Name),
|
|
556
|
-
data: c,
|
|
557
|
-
body: [],
|
|
558
|
-
children: c.RoleActions.map((a) => {
|
|
559
|
-
return {
|
|
560
|
-
selected: false,
|
|
561
|
-
title: this.getFormattedName(a.Name),
|
|
562
|
-
data: a,
|
|
563
|
-
body: [],
|
|
564
|
-
children: [],
|
|
565
|
-
};
|
|
566
|
-
}),
|
|
567
|
-
};
|
|
568
|
-
}),
|
|
569
|
-
};
|
|
570
|
-
});
|
|
571
|
-
this.cardData = this.cardData.concat(cardData);
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
getFormattedName(name: string): string {
|
|
575
|
-
// Split the key on capital letters, handling "And" as lowercase
|
|
576
|
-
const words = name
|
|
577
|
-
.split(/(?=[A-Z])/)
|
|
578
|
-
.map((word) => (word === 'And' ? 'and' : word));
|
|
579
|
-
// Join the words with spaces
|
|
580
|
-
return words.join(' ');
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
viewDetailsFromTable(data: MappedRole) {
|
|
584
|
-
const cardData = this.cardData.find((x) => x.data == data);
|
|
585
|
-
console.log({ Data: data });
|
|
586
|
-
console.log({ CardData: this.cardData });
|
|
587
|
-
if (cardData) {
|
|
588
|
-
this.dataView.isTableView = false;
|
|
589
|
-
this.viewDetails(cardData);
|
|
590
|
-
}
|
|
591
|
-
this.closePopUp();
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
viewDetails(context: CardData) {
|
|
595
|
-
this.cardContextHistory.push(context);
|
|
596
|
-
this.cardContextHistoryData.push(this.cardData);
|
|
597
|
-
if (
|
|
598
|
-
context.data.ChildrenType &&
|
|
599
|
-
context.data.ChildrenType != this.childPermissionRef
|
|
600
|
-
) {
|
|
601
|
-
this.searchContextHistory.push(this.searchContext);
|
|
602
|
-
this.searchContext = '';
|
|
603
|
-
}
|
|
604
|
-
this.cardData = context.children;
|
|
605
|
-
this.cardDataView.clearData();
|
|
606
|
-
}
|
|
607
|
-
viewDetailsChild(context: CardData) {
|
|
608
|
-
if (this.currentExpandedCard) {
|
|
609
|
-
this.cardContextHistory.push(this.currentExpandedCard);
|
|
610
|
-
this.cardContextHistory.push(context);
|
|
611
|
-
this.cardContextHistoryData.push(this.cardData);
|
|
612
|
-
this.cardContextHistoryData.push(this.currentExpandedCard.children);
|
|
613
|
-
this.cardData = context.children;
|
|
614
|
-
this.cardDataView.clearData();
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
roleCardClicked(item: CardData) {
|
|
619
|
-
this.currentData = this.cardDataView.onItemClick(item);
|
|
620
|
-
// if (this.currentData) {
|
|
621
|
-
// this.form.controls['Name'].setValue(this.currentData.data?.Name);
|
|
622
|
-
// }
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
toggleChildren(item: CardData) {
|
|
626
|
-
var currToggleState = item.isChildrenExpanded;
|
|
627
|
-
this.cardData.forEach((_) => {
|
|
628
|
-
_.isChildrenExpanded = false;
|
|
629
|
-
});
|
|
630
|
-
item.isChildrenExpanded = !currToggleState;
|
|
631
|
-
if (item.isChildrenExpanded) {
|
|
632
|
-
this.currentExpandedCard = item;
|
|
633
|
-
} else {
|
|
634
|
-
this.currentExpandedCard = null;
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
goToTableView() {
|
|
639
|
-
if (!this.currentData) {
|
|
640
|
-
return;
|
|
641
|
-
}
|
|
642
|
-
this.dataView.toggleView();
|
|
643
|
-
const id = this.currentData.data ? this.currentData.data.Id : '';
|
|
644
|
-
if (id.trim().length > 0 && !this.tableView.isRowEditing(id)) {
|
|
645
|
-
this.tableView.toggleRowEdit(id);
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
closeDetails() {
|
|
649
|
-
this.cardData =
|
|
650
|
-
this.cardContextHistoryData[this.cardContextHistoryData.length - 1];
|
|
651
|
-
this.cardContextHistoryData.pop();
|
|
652
|
-
this.cardContextHistory.pop();
|
|
653
|
-
|
|
654
|
-
if (this.searchContextHistory.length > 0) {
|
|
655
|
-
this.searchContext =
|
|
656
|
-
this.searchContextHistory[this.searchContextHistory.length - 1];
|
|
657
|
-
this.searchContextHistory.pop();
|
|
658
|
-
} else {
|
|
659
|
-
this.searchContext = '';
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
setTimeout(() => {
|
|
663
|
-
if (this.dataView.isTableView) {
|
|
664
|
-
this.dataView.toggleView();
|
|
665
|
-
}
|
|
666
|
-
}, 200);
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
getCardSubCaption(item: CardData) {
|
|
670
|
-
const selected = item.children.filter((x) => x.data.Selected).length;
|
|
671
|
-
const total = item.children.length;
|
|
672
|
-
return `${selected} of ${total} ${
|
|
673
|
-
total > 1 ? item.data.ChildrenType + 's' : item.data.ChildrenType
|
|
674
|
-
}`;
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
getUpdatedRole(role: MappedRole): Role {
|
|
678
|
-
const newRole = role;
|
|
679
|
-
newRole.RoleContexts = role.RoleContexts.filter((x) => x.Selected).map(
|
|
680
|
-
(y) => {
|
|
681
|
-
y.RoleActions = y.RoleActions.filter((z) => z.Selected);
|
|
682
|
-
return y;
|
|
683
|
-
}
|
|
684
|
-
);
|
|
685
|
-
newRole.DataState =
|
|
686
|
-
newRole.DataState == ObjectState.New
|
|
687
|
-
? ObjectState.New
|
|
688
|
-
: ObjectState.Changed;
|
|
689
|
-
newRole.Id = '';
|
|
690
|
-
return newRole as Role;
|
|
691
|
-
}
|
|
692
|
-
async saveRole() {
|
|
693
|
-
if (this.currentData) {
|
|
694
|
-
var role: MappedRole = this.currentData.data as MappedRole;
|
|
695
|
-
// role.Name = this.form.controls['Name'].value;
|
|
696
|
-
if (this.currentData.data.Name.trim().length == 0) {
|
|
697
|
-
this.utilService.showInfo('Role name cannot be empty');
|
|
698
|
-
return;
|
|
699
|
-
}
|
|
700
|
-
const mappedRole = this.getUpdatedRole(JSON.parse(JSON.stringify(role)));
|
|
701
|
-
this.utilService.sendBI(true);
|
|
702
|
-
const res = await this.server.post(`Role/SaveRoles`, [mappedRole]);
|
|
703
|
-
this.utilService.sendBI(false);
|
|
704
|
-
if (res instanceof ErrorResponse) {
|
|
705
|
-
} else {
|
|
706
|
-
this.utilService.showSuccess('Role saved successfully');
|
|
707
|
-
const result = res as Role[];
|
|
708
|
-
if (result.length > 0) {
|
|
709
|
-
var roleResult = result[0];
|
|
710
|
-
var mappedRoleSave: MappedRole = {
|
|
711
|
-
...roleResult,
|
|
712
|
-
ChildrenType: ChildrenType.Permission,
|
|
713
|
-
RoleContexts: this.sourceData.map((config) => {
|
|
714
|
-
const existingId = roleResult.RoleContexts.findIndex(
|
|
715
|
-
(y) => y.Name == config.Name
|
|
716
|
-
);
|
|
717
|
-
var context: MappedRoleContext = {
|
|
718
|
-
ChildrenType: ChildrenType.Action,
|
|
719
|
-
Selected: existingId > -1 ? true : false,
|
|
720
|
-
RoleActions: config.Actions.map((action) => {
|
|
721
|
-
const existingAction =
|
|
722
|
-
existingId > -1
|
|
723
|
-
? roleResult.RoleContexts[
|
|
724
|
-
existingId
|
|
725
|
-
].RoleActions.findIndex((c) => c.Name == action)
|
|
726
|
-
: -1;
|
|
727
|
-
|
|
728
|
-
var act: MappedRoleAction = {
|
|
729
|
-
Selected: existingAction > -1 ? true : false,
|
|
730
|
-
Name: action,
|
|
731
|
-
Role: roleResult.Code,
|
|
732
|
-
Context: '',
|
|
733
|
-
id:
|
|
734
|
-
existingAction > -1
|
|
735
|
-
? roleResult.RoleContexts[existingId].RoleActions[
|
|
736
|
-
existingAction
|
|
737
|
-
].Code
|
|
738
|
-
: '',
|
|
739
|
-
Id:
|
|
740
|
-
existingAction > -1
|
|
741
|
-
? roleResult.RoleContexts[existingId].RoleActions[
|
|
742
|
-
existingAction
|
|
743
|
-
].Code
|
|
744
|
-
: '',
|
|
745
|
-
CreatedAt: new Date(),
|
|
746
|
-
UpdatedAt: new Date(),
|
|
747
|
-
DataState: ObjectState.New,
|
|
748
|
-
TenantId: roleResult.TenantId,
|
|
749
|
-
Code:
|
|
750
|
-
existingAction > -1
|
|
751
|
-
? roleResult.RoleContexts[existingId].RoleActions[
|
|
752
|
-
existingAction
|
|
753
|
-
].Code
|
|
754
|
-
: '',
|
|
755
|
-
ServiceName:
|
|
756
|
-
existingAction > -1
|
|
757
|
-
? roleResult.RoleContexts[existingId].RoleActions[
|
|
758
|
-
existingAction
|
|
759
|
-
].ServiceName
|
|
760
|
-
: '',
|
|
761
|
-
APIKey:
|
|
762
|
-
existingAction > -1
|
|
763
|
-
? roleResult.RoleContexts[existingId].RoleActions[
|
|
764
|
-
existingAction
|
|
765
|
-
].APIKey
|
|
766
|
-
: this.envSvc.environment.APIKey,
|
|
767
|
-
ApplicationRoleAction:
|
|
768
|
-
this.getApplicationActionCode(action),
|
|
769
|
-
};
|
|
770
|
-
return act;
|
|
771
|
-
}),
|
|
772
|
-
Name: config.Name,
|
|
773
|
-
Role: roleResult.Code,
|
|
774
|
-
id:
|
|
775
|
-
existingId > -1
|
|
776
|
-
? roleResult.RoleContexts[existingId].Code
|
|
777
|
-
: '',
|
|
778
|
-
Id:
|
|
779
|
-
existingId > -1
|
|
780
|
-
? roleResult.RoleContexts[existingId].Code
|
|
781
|
-
: '',
|
|
782
|
-
CreatedAt: new Date(),
|
|
783
|
-
UpdatedAt: new Date(),
|
|
784
|
-
DataState: ObjectState.New,
|
|
785
|
-
TenantId: roleResult.TenantId,
|
|
786
|
-
Code:
|
|
787
|
-
existingId > -1
|
|
788
|
-
? roleResult.RoleContexts[existingId].Code
|
|
789
|
-
: '',
|
|
790
|
-
ServiceName:
|
|
791
|
-
existingId > -1
|
|
792
|
-
? roleResult.RoleContexts[existingId].ServiceName
|
|
793
|
-
: '',
|
|
794
|
-
APIKey:
|
|
795
|
-
existingId > -1
|
|
796
|
-
? roleResult.RoleContexts[existingId].APIKey
|
|
797
|
-
: this.envSvc.environment.APIKey,
|
|
798
|
-
ApplicationRoleContext: this.getApplicationContextCode(
|
|
799
|
-
config.Name
|
|
800
|
-
),
|
|
801
|
-
};
|
|
802
|
-
|
|
803
|
-
return context;
|
|
804
|
-
}),
|
|
805
|
-
};
|
|
806
|
-
|
|
807
|
-
const itemIndex = this.data.findIndex(
|
|
808
|
-
(x) => x == this.currentData?.data
|
|
809
|
-
);
|
|
810
|
-
if (itemIndex > -1) {
|
|
811
|
-
this.data[itemIndex].Code = mappedRoleSave.Code;
|
|
812
|
-
this.data[itemIndex].Id = mappedRoleSave.Code;
|
|
813
|
-
this.data[itemIndex].DataState = mappedRoleSave.DataState;
|
|
814
|
-
this.data[itemIndex].TenantId = mappedRoleSave.TenantId;
|
|
815
|
-
this.data[itemIndex].ServiceName = mappedRoleSave.ServiceName;
|
|
816
|
-
mappedRoleSave.RoleContexts.forEach((x, i) => {
|
|
817
|
-
this.data[itemIndex].RoleContexts[i].Role = mappedRoleSave.Code;
|
|
818
|
-
this.data[itemIndex].RoleContexts[i].Code = x.Code;
|
|
819
|
-
this.data[itemIndex].RoleContexts[i].ServiceName = x.ServiceName;
|
|
820
|
-
x.RoleActions.forEach((y, j) => {
|
|
821
|
-
this.data[itemIndex].RoleContexts[i].RoleActions[j].Role =
|
|
822
|
-
mappedRoleSave.Code;
|
|
823
|
-
this.data[itemIndex].RoleContexts[i].RoleActions[j].Code =
|
|
824
|
-
y.Code;
|
|
825
|
-
this.data[itemIndex].RoleContexts[i].RoleActions[
|
|
826
|
-
j
|
|
827
|
-
].ServiceName = y.ServiceName;
|
|
828
|
-
});
|
|
829
|
-
});
|
|
830
|
-
this.data = this.data.map((x) => x);
|
|
831
|
-
this.cacheItem(this.data[itemIndex]);
|
|
832
|
-
// this.currentData = {
|
|
833
|
-
// selected: true,
|
|
834
|
-
// title: mappedRoleSave.Name,
|
|
835
|
-
// data: mappedRoleSave,
|
|
836
|
-
// isChildrenExpanded: this.currentData.isChildrenExpanded,
|
|
837
|
-
// body: [],
|
|
838
|
-
// children: mappedRoleSave.RoleContexts.map((c) => {
|
|
839
|
-
// return {
|
|
840
|
-
// selected: false,
|
|
841
|
-
// title: this.getFormattedName(c.Name),
|
|
842
|
-
// data: c,
|
|
843
|
-
// body: [],
|
|
844
|
-
// children: c.RoleActions.map((a) => {
|
|
845
|
-
// return {
|
|
846
|
-
// selected: false,
|
|
847
|
-
// title: this.getFormattedName(a.Name),
|
|
848
|
-
// data: a,
|
|
849
|
-
// body: [],
|
|
850
|
-
// children: [],
|
|
851
|
-
// };
|
|
852
|
-
// }),
|
|
853
|
-
// };
|
|
854
|
-
// }),
|
|
855
|
-
// };
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
async tableSaveRole(role: MappedRole, callBack: () => any) {
|
|
862
|
-
if (role.Name.trim().length == 0) {
|
|
863
|
-
this.utilService.showInfo('Role name cannot be empty');
|
|
864
|
-
return;
|
|
865
|
-
}
|
|
866
|
-
const mappedRole = this.getUpdatedRole(JSON.parse(JSON.stringify(role)));
|
|
867
|
-
this.utilService.sendBI(true);
|
|
868
|
-
const res = await this.server.post(`Role/SaveRoles`, [mappedRole]);
|
|
869
|
-
this.utilService.sendBI(false);
|
|
870
|
-
if (res instanceof ErrorResponse) {
|
|
871
|
-
} else {
|
|
872
|
-
this.utilService.showSuccess('Role saved successfully');
|
|
873
|
-
const result = res as Role[];
|
|
874
|
-
if (result.length > 0) {
|
|
875
|
-
var roleResult = result[0];
|
|
876
|
-
var mappedRoleSave: MappedRole = {
|
|
877
|
-
...roleResult,
|
|
878
|
-
ChildrenType: ChildrenType.Permission,
|
|
879
|
-
RoleContexts: this.sourceData.map((config) => {
|
|
880
|
-
const existingId = roleResult.RoleContexts.findIndex(
|
|
881
|
-
(y) => y.Name == config.Name
|
|
882
|
-
);
|
|
883
|
-
var context: MappedRoleContext = {
|
|
884
|
-
ChildrenType: ChildrenType.Action,
|
|
885
|
-
Selected: existingId > -1 ? true : false,
|
|
886
|
-
RoleActions: config.Actions.map((action) => {
|
|
887
|
-
const existingAction =
|
|
888
|
-
existingId > -1
|
|
889
|
-
? roleResult.RoleContexts[existingId].RoleActions.findIndex(
|
|
890
|
-
(c) => c.Name == action
|
|
891
|
-
)
|
|
892
|
-
: -1;
|
|
893
|
-
|
|
894
|
-
var act: MappedRoleAction = {
|
|
895
|
-
Selected: existingAction > -1 ? true : false,
|
|
896
|
-
Name: action,
|
|
897
|
-
Role: roleResult.Code,
|
|
898
|
-
Context: '',
|
|
899
|
-
id:
|
|
900
|
-
existingAction > -1
|
|
901
|
-
? roleResult.RoleContexts[existingId].RoleActions[
|
|
902
|
-
existingAction
|
|
903
|
-
].Code
|
|
904
|
-
: '',
|
|
905
|
-
Id:
|
|
906
|
-
existingAction > -1
|
|
907
|
-
? roleResult.RoleContexts[existingId].RoleActions[
|
|
908
|
-
existingAction
|
|
909
|
-
].Code
|
|
910
|
-
: '',
|
|
911
|
-
CreatedAt: new Date(),
|
|
912
|
-
UpdatedAt: new Date(),
|
|
913
|
-
DataState: ObjectState.New,
|
|
914
|
-
TenantId: roleResult.TenantId,
|
|
915
|
-
Code:
|
|
916
|
-
existingAction > -1
|
|
917
|
-
? roleResult.RoleContexts[existingId].RoleActions[
|
|
918
|
-
existingAction
|
|
919
|
-
].Code
|
|
920
|
-
: '',
|
|
921
|
-
ServiceName:
|
|
922
|
-
existingAction > -1
|
|
923
|
-
? roleResult.RoleContexts[existingId].RoleActions[
|
|
924
|
-
existingAction
|
|
925
|
-
].ServiceName
|
|
926
|
-
: '',
|
|
927
|
-
APIKey:
|
|
928
|
-
existingAction > -1
|
|
929
|
-
? roleResult.RoleContexts[existingId].RoleActions[
|
|
930
|
-
existingAction
|
|
931
|
-
].APIKey
|
|
932
|
-
: this.envSvc.environment.APIKey,
|
|
933
|
-
ApplicationRoleAction: this.getApplicationActionCode(action),
|
|
934
|
-
};
|
|
935
|
-
return act;
|
|
936
|
-
}),
|
|
937
|
-
Name: config.Name,
|
|
938
|
-
Role: roleResult.Code,
|
|
939
|
-
id:
|
|
940
|
-
existingId > -1 ? roleResult.RoleContexts[existingId].Code : '',
|
|
941
|
-
Id:
|
|
942
|
-
existingId > -1 ? roleResult.RoleContexts[existingId].Code : '',
|
|
943
|
-
CreatedAt: new Date(),
|
|
944
|
-
UpdatedAt: new Date(),
|
|
945
|
-
DataState: ObjectState.New,
|
|
946
|
-
TenantId: roleResult.TenantId,
|
|
947
|
-
Code:
|
|
948
|
-
existingId > -1 ? roleResult.RoleContexts[existingId].Code : '',
|
|
949
|
-
ServiceName:
|
|
950
|
-
existingId > -1
|
|
951
|
-
? roleResult.RoleContexts[existingId].ServiceName
|
|
952
|
-
: '',
|
|
953
|
-
APIKey:
|
|
954
|
-
existingId > -1
|
|
955
|
-
? roleResult.RoleContexts[existingId].APIKey
|
|
956
|
-
: this.envSvc.environment.APIKey,
|
|
957
|
-
ApplicationRoleContext: this.getApplicationContextCode(
|
|
958
|
-
config.Name
|
|
959
|
-
),
|
|
960
|
-
};
|
|
961
|
-
|
|
962
|
-
return context;
|
|
963
|
-
}),
|
|
964
|
-
};
|
|
965
|
-
|
|
966
|
-
const itemIndex = this.data.findIndex(
|
|
967
|
-
(x) => x == this.currentData?.data
|
|
968
|
-
);
|
|
969
|
-
if (itemIndex > -1) {
|
|
970
|
-
this.data[itemIndex].Code = mappedRoleSave.Code;
|
|
971
|
-
this.data[itemIndex].Id = mappedRoleSave.Code;
|
|
972
|
-
this.data[itemIndex].DataState = mappedRoleSave.DataState;
|
|
973
|
-
this.data[itemIndex].TenantId = mappedRoleSave.TenantId;
|
|
974
|
-
this.data[itemIndex].ServiceName = mappedRoleSave.ServiceName;
|
|
975
|
-
mappedRoleSave.RoleContexts.forEach((x, i) => {
|
|
976
|
-
this.data[itemIndex].RoleContexts[i].Role = mappedRoleSave.Code;
|
|
977
|
-
this.data[itemIndex].RoleContexts[i].Code = x.Code;
|
|
978
|
-
this.data[itemIndex].RoleContexts[i].ServiceName = x.ServiceName;
|
|
979
|
-
x.RoleActions.forEach((y, j) => {
|
|
980
|
-
this.data[itemIndex].RoleContexts[i].RoleActions[j].Role =
|
|
981
|
-
mappedRoleSave.Code;
|
|
982
|
-
this.data[itemIndex].RoleContexts[i].RoleActions[j].Code = y.Code;
|
|
983
|
-
this.data[itemIndex].RoleContexts[i].RoleActions[j].ServiceName =
|
|
984
|
-
y.ServiceName;
|
|
985
|
-
});
|
|
986
|
-
});
|
|
987
|
-
this.data = this.data.map((x) => x);
|
|
988
|
-
this.cacheItem(this.data[itemIndex]);
|
|
989
|
-
}
|
|
990
|
-
callBack();
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
async saveRoleDynamic(item: CardData) {
|
|
996
|
-
if (this.isCheckboxDisabled(item)) {
|
|
997
|
-
this.utilService.showInfo('Parent UI not selected');
|
|
998
|
-
return;
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
var role: CardData | null =
|
|
1002
|
-
this.cardContextHistory.length > 0
|
|
1003
|
-
? this.cardContextHistory[0]
|
|
1004
|
-
: this.currentExpandedCard
|
|
1005
|
-
? this.currentExpandedCard
|
|
1006
|
-
: null;
|
|
1007
|
-
var cardDataRef: CardData[] | null =
|
|
1008
|
-
this.cardContextHistoryData.length > 0
|
|
1009
|
-
? this.cardContextHistoryData[0]
|
|
1010
|
-
: this.currentExpandedCard
|
|
1011
|
-
? this.cardData
|
|
1012
|
-
: null;
|
|
1013
|
-
// const isExpandedCard: boolean =
|
|
1014
|
-
// this.cardContextHistory.length > 0
|
|
1015
|
-
// ? false
|
|
1016
|
-
// : this.currentExpandedCard
|
|
1017
|
-
// ? true
|
|
1018
|
-
// : false;
|
|
1019
|
-
if (!role) {
|
|
1020
|
-
return;
|
|
1021
|
-
}
|
|
1022
|
-
if (role.data.Name.trim().length == 0) {
|
|
1023
|
-
item.data.Selected = false;
|
|
1024
|
-
this.utilService.showInfo('Role name cannot be empty');
|
|
1025
|
-
return;
|
|
1026
|
-
}
|
|
1027
|
-
item.data.Selected = !item.data.Selected;
|
|
1028
|
-
const mappedRole = this.getUpdatedRole(
|
|
1029
|
-
JSON.parse(JSON.stringify(role.data))
|
|
1030
|
-
);
|
|
1031
|
-
this.utilService.sendBI(true);
|
|
1032
|
-
const res = await this.server.post(`Role/SaveRoles`, [mappedRole]);
|
|
1033
|
-
this.utilService.sendBI(false);
|
|
1034
|
-
if (res instanceof ErrorResponse) {
|
|
1035
|
-
item.data.Selected = false;
|
|
1036
|
-
} else {
|
|
1037
|
-
this.utilService.showSuccess('Role saved successfully');
|
|
1038
|
-
const result = res as Role[];
|
|
1039
|
-
if (result.length > 0) {
|
|
1040
|
-
var roleResult = result[0];
|
|
1041
|
-
var mappedRoleSave: MappedRole = {
|
|
1042
|
-
...roleResult,
|
|
1043
|
-
ChildrenType: ChildrenType.Permission,
|
|
1044
|
-
RoleContexts: this.sourceData.map((config) => {
|
|
1045
|
-
const existingId = roleResult.RoleContexts.findIndex(
|
|
1046
|
-
(y) => y.Name == config.Name
|
|
1047
|
-
);
|
|
1048
|
-
var context: MappedRoleContext = {
|
|
1049
|
-
ChildrenType: ChildrenType.Action,
|
|
1050
|
-
Selected: existingId > -1 ? true : false,
|
|
1051
|
-
RoleActions: config.Actions.map((action) => {
|
|
1052
|
-
const existingAction =
|
|
1053
|
-
existingId > -1
|
|
1054
|
-
? roleResult.RoleContexts[existingId].RoleActions.findIndex(
|
|
1055
|
-
(c) => c.Name == action
|
|
1056
|
-
)
|
|
1057
|
-
: -1;
|
|
1058
|
-
var act: MappedRoleAction = {
|
|
1059
|
-
Selected: existingAction > -1 ? true : false,
|
|
1060
|
-
Name: action,
|
|
1061
|
-
Role: roleResult.Code,
|
|
1062
|
-
Context: '',
|
|
1063
|
-
id:
|
|
1064
|
-
existingAction > -1
|
|
1065
|
-
? roleResult.RoleContexts[existingId].RoleActions[
|
|
1066
|
-
existingAction
|
|
1067
|
-
].Code
|
|
1068
|
-
: '',
|
|
1069
|
-
Id:
|
|
1070
|
-
existingAction > -1
|
|
1071
|
-
? roleResult.RoleContexts[existingId].RoleActions[
|
|
1072
|
-
existingAction
|
|
1073
|
-
].Code
|
|
1074
|
-
: '',
|
|
1075
|
-
CreatedAt: new Date(),
|
|
1076
|
-
UpdatedAt: new Date(),
|
|
1077
|
-
DataState: ObjectState.New,
|
|
1078
|
-
TenantId: roleResult.TenantId,
|
|
1079
|
-
Code:
|
|
1080
|
-
existingAction > -1
|
|
1081
|
-
? roleResult.RoleContexts[existingId].RoleActions[
|
|
1082
|
-
existingAction
|
|
1083
|
-
].Code
|
|
1084
|
-
: '',
|
|
1085
|
-
ServiceName:
|
|
1086
|
-
existingAction > -1
|
|
1087
|
-
? roleResult.RoleContexts[existingId].RoleActions[
|
|
1088
|
-
existingAction
|
|
1089
|
-
].ServiceName
|
|
1090
|
-
: '',
|
|
1091
|
-
APIKey:
|
|
1092
|
-
existingAction > -1
|
|
1093
|
-
? roleResult.RoleContexts[existingId].RoleActions[
|
|
1094
|
-
existingAction
|
|
1095
|
-
].APIKey
|
|
1096
|
-
: this.envSvc.environment.APIKey,
|
|
1097
|
-
ApplicationRoleAction: this.getApplicationActionCode(action),
|
|
1098
|
-
};
|
|
1099
|
-
return act;
|
|
1100
|
-
}),
|
|
1101
|
-
Name: config.Name,
|
|
1102
|
-
Role: roleResult.Code,
|
|
1103
|
-
id:
|
|
1104
|
-
existingId > -1 ? roleResult.RoleContexts[existingId].Code : '',
|
|
1105
|
-
Id:
|
|
1106
|
-
existingId > -1 ? roleResult.RoleContexts[existingId].Code : '',
|
|
1107
|
-
CreatedAt: new Date(),
|
|
1108
|
-
UpdatedAt: new Date(),
|
|
1109
|
-
DataState: ObjectState.New,
|
|
1110
|
-
TenantId: roleResult.TenantId,
|
|
1111
|
-
Code:
|
|
1112
|
-
existingId > -1 ? roleResult.RoleContexts[existingId].Code : '',
|
|
1113
|
-
ServiceName:
|
|
1114
|
-
existingId > -1
|
|
1115
|
-
? roleResult.RoleContexts[existingId].ServiceName
|
|
1116
|
-
: '',
|
|
1117
|
-
APIKey:
|
|
1118
|
-
existingId > -1
|
|
1119
|
-
? roleResult.RoleContexts[existingId].APIKey
|
|
1120
|
-
: this.envSvc.environment.APIKey,
|
|
1121
|
-
ApplicationRoleContext: this.getApplicationContextCode(
|
|
1122
|
-
config.Name
|
|
1123
|
-
),
|
|
1124
|
-
};
|
|
1125
|
-
return context;
|
|
1126
|
-
}),
|
|
1127
|
-
};
|
|
1128
|
-
const itemIndex = cardDataRef
|
|
1129
|
-
? cardDataRef.findIndex((x) => x.data == role?.data)
|
|
1130
|
-
: -1;
|
|
1131
|
-
if (itemIndex > -1) {
|
|
1132
|
-
this.data[itemIndex].Code = mappedRoleSave.Code;
|
|
1133
|
-
this.data[itemIndex].Id = mappedRoleSave.Code;
|
|
1134
|
-
this.data[itemIndex].DataState = mappedRoleSave.DataState;
|
|
1135
|
-
this.data[itemIndex].TenantId = mappedRoleSave.TenantId;
|
|
1136
|
-
this.data[itemIndex].ServiceName = mappedRoleSave.ServiceName;
|
|
1137
|
-
mappedRoleSave.RoleContexts.forEach((x, i) => {
|
|
1138
|
-
this.data[itemIndex].RoleContexts[i].Role = mappedRoleSave.Code;
|
|
1139
|
-
this.data[itemIndex].RoleContexts[i].Code = x.Code;
|
|
1140
|
-
this.data[itemIndex].RoleContexts[i].ServiceName = x.ServiceName;
|
|
1141
|
-
x.RoleActions.forEach((y, j) => {
|
|
1142
|
-
this.data[itemIndex].RoleContexts[i].RoleActions[j].Role =
|
|
1143
|
-
mappedRoleSave.Code;
|
|
1144
|
-
this.data[itemIndex].RoleContexts[i].RoleActions[j].Code = y.Code;
|
|
1145
|
-
this.data[itemIndex].RoleContexts[i].RoleActions[j].ServiceName =
|
|
1146
|
-
y.ServiceName;
|
|
1147
|
-
});
|
|
1148
|
-
});
|
|
1149
|
-
// this.data[itemIndex].RoleContexts = mappedRoleSave.RoleContexts;
|
|
1150
|
-
|
|
1151
|
-
this.data = this.data.map((x) => x);
|
|
1152
|
-
// if (cardDataRef) {
|
|
1153
|
-
// console.log({
|
|
1154
|
-
// XDataIsHere: JSON.parse(JSON.stringify(cardDataRef)),
|
|
1155
|
-
// });
|
|
1156
|
-
// cardDataRef[itemIndex] = {
|
|
1157
|
-
// selected: cardDataRef[itemIndex].selected,
|
|
1158
|
-
// isChildrenExpanded: cardDataRef[itemIndex].isChildrenExpanded,
|
|
1159
|
-
// title: mappedRoleSave.Name,
|
|
1160
|
-
// data: mappedRoleSave,
|
|
1161
|
-
// body: [],
|
|
1162
|
-
// children: mappedRoleSave.RoleContexts.map((c) => {
|
|
1163
|
-
// return {
|
|
1164
|
-
// selected: false,
|
|
1165
|
-
// title: this.getFormattedName(c.Name),
|
|
1166
|
-
// data: c,
|
|
1167
|
-
// body: [],
|
|
1168
|
-
// children: c.RoleActions.map((a) => {
|
|
1169
|
-
// return {
|
|
1170
|
-
// selected: false,
|
|
1171
|
-
// title: this.getFormattedName(a.Name),
|
|
1172
|
-
// data: a,
|
|
1173
|
-
// body: [],
|
|
1174
|
-
// children: [],
|
|
1175
|
-
// };
|
|
1176
|
-
// }),
|
|
1177
|
-
// };
|
|
1178
|
-
// }),
|
|
1179
|
-
// };
|
|
1180
|
-
// }
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1186
|
-
async saveAllRoleDynamic(item: CardData) {
|
|
1187
|
-
if (this.isCheckboxDisabled(item)) {
|
|
1188
|
-
this.utilService.showInfo('Parent UI not selected');
|
|
1189
|
-
return;
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
|
-
var role: CardData | null =
|
|
1193
|
-
this.cardContextHistory.length > 0
|
|
1194
|
-
? this.cardContextHistory[0]
|
|
1195
|
-
: this.currentExpandedCard
|
|
1196
|
-
? this.currentExpandedCard
|
|
1197
|
-
: null;
|
|
1198
|
-
var cardDataRef: CardData[] | null =
|
|
1199
|
-
this.cardContextHistoryData.length > 0
|
|
1200
|
-
? this.cardContextHistoryData[0]
|
|
1201
|
-
: this.currentExpandedCard
|
|
1202
|
-
? this.cardData
|
|
1203
|
-
: null;
|
|
1204
|
-
// const isExpandedCard: boolean =
|
|
1205
|
-
// this.cardContextHistory.length > 0
|
|
1206
|
-
// ? false
|
|
1207
|
-
// : this.currentExpandedCard
|
|
1208
|
-
// ? true
|
|
1209
|
-
// : false;
|
|
1210
|
-
if (!role) {
|
|
1211
|
-
return;
|
|
1212
|
-
}
|
|
1213
|
-
if (role.data.Name.trim().length == 0) {
|
|
1214
|
-
this.utilService.showInfo('Role name cannot be empty');
|
|
1215
|
-
return;
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
const isAllSelected = this.isAllSelected(item);
|
|
1219
|
-
|
|
1220
|
-
const parent =
|
|
1221
|
-
this.cardContextHistoryData.length > 0
|
|
1222
|
-
? this.findParent(this.cardContextHistoryData[0], item)
|
|
1223
|
-
: this.findParent(this.cardData, item);
|
|
1224
|
-
if (
|
|
1225
|
-
parent &&
|
|
1226
|
-
parent.data.ChildrenType &&
|
|
1227
|
-
parent.data.ChildrenType == ChildrenType.Action
|
|
1228
|
-
) {
|
|
1229
|
-
(parent.data as MappedRoleContext).RoleActions.forEach((x) => {
|
|
1230
|
-
x.Selected = !isAllSelected;
|
|
1231
|
-
});
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
if (
|
|
1235
|
-
parent &&
|
|
1236
|
-
parent.data.ChildrenType &&
|
|
1237
|
-
parent.data.ChildrenType == ChildrenType.Permission
|
|
1238
|
-
) {
|
|
1239
|
-
(parent.data as MappedRole).RoleContexts.forEach((x) => {
|
|
1240
|
-
x.Selected = !isAllSelected;
|
|
1241
|
-
});
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
const mappedRole = this.getUpdatedRole(
|
|
1245
|
-
JSON.parse(JSON.stringify(role.data))
|
|
1246
|
-
);
|
|
1247
|
-
this.utilService.sendBI(true);
|
|
1248
|
-
const res = await this.server.post(`Role/SaveRoles`, [mappedRole]);
|
|
1249
|
-
this.utilService.sendBI(false);
|
|
1250
|
-
if (res instanceof ErrorResponse) {
|
|
1251
|
-
item.data.Selected = false;
|
|
1252
|
-
} else {
|
|
1253
|
-
this.utilService.showSuccess('Role saved successfully');
|
|
1254
|
-
const result = res as Role[];
|
|
1255
|
-
if (result.length > 0) {
|
|
1256
|
-
var roleResult = result[0];
|
|
1257
|
-
var mappedRoleSave: MappedRole = {
|
|
1258
|
-
...roleResult,
|
|
1259
|
-
ChildrenType: ChildrenType.Permission,
|
|
1260
|
-
RoleContexts: this.sourceData.map((config) => {
|
|
1261
|
-
const existingId = roleResult.RoleContexts.findIndex(
|
|
1262
|
-
(y) => y.Name == config.Name
|
|
1263
|
-
);
|
|
1264
|
-
var context: MappedRoleContext = {
|
|
1265
|
-
ChildrenType: ChildrenType.Action,
|
|
1266
|
-
Selected: existingId > -1 ? true : false,
|
|
1267
|
-
RoleActions: config.Actions.map((action) => {
|
|
1268
|
-
const existingAction =
|
|
1269
|
-
existingId > -1
|
|
1270
|
-
? roleResult.RoleContexts[existingId].RoleActions.findIndex(
|
|
1271
|
-
(c) => c.Name == action
|
|
1272
|
-
)
|
|
1273
|
-
: -1;
|
|
1274
|
-
var act: MappedRoleAction = {
|
|
1275
|
-
Selected: existingAction > -1 ? true : false,
|
|
1276
|
-
Name: action,
|
|
1277
|
-
Role: roleResult.Code,
|
|
1278
|
-
Context: '',
|
|
1279
|
-
id:
|
|
1280
|
-
existingAction > -1
|
|
1281
|
-
? roleResult.RoleContexts[existingId].RoleActions[
|
|
1282
|
-
existingAction
|
|
1283
|
-
].Code
|
|
1284
|
-
: '',
|
|
1285
|
-
Id:
|
|
1286
|
-
existingAction > -1
|
|
1287
|
-
? roleResult.RoleContexts[existingId].RoleActions[
|
|
1288
|
-
existingAction
|
|
1289
|
-
].Code
|
|
1290
|
-
: '',
|
|
1291
|
-
CreatedAt: new Date(),
|
|
1292
|
-
UpdatedAt: new Date(),
|
|
1293
|
-
DataState: ObjectState.New,
|
|
1294
|
-
TenantId: roleResult.TenantId,
|
|
1295
|
-
Code:
|
|
1296
|
-
existingAction > -1
|
|
1297
|
-
? roleResult.RoleContexts[existingId].RoleActions[
|
|
1298
|
-
existingAction
|
|
1299
|
-
].Code
|
|
1300
|
-
: '',
|
|
1301
|
-
ServiceName:
|
|
1302
|
-
existingAction > -1
|
|
1303
|
-
? roleResult.RoleContexts[existingId].RoleActions[
|
|
1304
|
-
existingAction
|
|
1305
|
-
].ServiceName
|
|
1306
|
-
: '',
|
|
1307
|
-
APIKey:
|
|
1308
|
-
existingAction > -1
|
|
1309
|
-
? roleResult.RoleContexts[existingId].RoleActions[
|
|
1310
|
-
existingAction
|
|
1311
|
-
].APIKey
|
|
1312
|
-
: this.envSvc.environment.APIKey,
|
|
1313
|
-
ApplicationRoleAction: this.getApplicationActionCode(action),
|
|
1314
|
-
};
|
|
1315
|
-
return act;
|
|
1316
|
-
}),
|
|
1317
|
-
Name: config.Name,
|
|
1318
|
-
Role: roleResult.Code,
|
|
1319
|
-
id:
|
|
1320
|
-
existingId > -1 ? roleResult.RoleContexts[existingId].Code : '',
|
|
1321
|
-
Id:
|
|
1322
|
-
existingId > -1 ? roleResult.RoleContexts[existingId].Code : '',
|
|
1323
|
-
CreatedAt: new Date(),
|
|
1324
|
-
UpdatedAt: new Date(),
|
|
1325
|
-
DataState: ObjectState.New,
|
|
1326
|
-
TenantId: roleResult.TenantId,
|
|
1327
|
-
Code:
|
|
1328
|
-
existingId > -1 ? roleResult.RoleContexts[existingId].Code : '',
|
|
1329
|
-
ServiceName:
|
|
1330
|
-
existingId > -1
|
|
1331
|
-
? roleResult.RoleContexts[existingId].ServiceName
|
|
1332
|
-
: '',
|
|
1333
|
-
APIKey:
|
|
1334
|
-
existingId > -1
|
|
1335
|
-
? roleResult.RoleContexts[existingId].APIKey
|
|
1336
|
-
: this.envSvc.environment.APIKey,
|
|
1337
|
-
ApplicationRoleContext: this.getApplicationContextCode(
|
|
1338
|
-
config.Name
|
|
1339
|
-
),
|
|
1340
|
-
};
|
|
1341
|
-
return context;
|
|
1342
|
-
}),
|
|
1343
|
-
};
|
|
1344
|
-
const itemIndex = cardDataRef
|
|
1345
|
-
? cardDataRef.findIndex((x) => x.data == role?.data)
|
|
1346
|
-
: -1;
|
|
1347
|
-
if (itemIndex > -1) {
|
|
1348
|
-
this.data[itemIndex].Code = mappedRoleSave.Code;
|
|
1349
|
-
this.data[itemIndex].Id = mappedRoleSave.Code;
|
|
1350
|
-
this.data[itemIndex].DataState = mappedRoleSave.DataState;
|
|
1351
|
-
this.data[itemIndex].TenantId = mappedRoleSave.TenantId;
|
|
1352
|
-
this.data[itemIndex].ServiceName = mappedRoleSave.ServiceName;
|
|
1353
|
-
mappedRoleSave.RoleContexts.forEach((x, i) => {
|
|
1354
|
-
this.data[itemIndex].RoleContexts[i].Role = mappedRoleSave.Code;
|
|
1355
|
-
this.data[itemIndex].RoleContexts[i].Code = x.Code;
|
|
1356
|
-
this.data[itemIndex].RoleContexts[i].ServiceName = x.ServiceName;
|
|
1357
|
-
x.RoleActions.forEach((y, j) => {
|
|
1358
|
-
this.data[itemIndex].RoleContexts[i].RoleActions[j].Role =
|
|
1359
|
-
mappedRoleSave.Code;
|
|
1360
|
-
this.data[itemIndex].RoleContexts[i].RoleActions[j].Code = y.Code;
|
|
1361
|
-
this.data[itemIndex].RoleContexts[i].RoleActions[j].ServiceName =
|
|
1362
|
-
y.ServiceName;
|
|
1363
|
-
});
|
|
1364
|
-
});
|
|
1365
|
-
// this.data[itemIndex].RoleContexts = mappedRoleSave.RoleContexts;
|
|
1366
|
-
|
|
1367
|
-
this.data = this.data.map((x) => x);
|
|
1368
|
-
// if (cardDataRef) {
|
|
1369
|
-
// console.log({
|
|
1370
|
-
// XDataIsHere: JSON.parse(JSON.stringify(cardDataRef)),
|
|
1371
|
-
// });
|
|
1372
|
-
// cardDataRef[itemIndex] = {
|
|
1373
|
-
// selected: cardDataRef[itemIndex].selected,
|
|
1374
|
-
// isChildrenExpanded: cardDataRef[itemIndex].isChildrenExpanded,
|
|
1375
|
-
// title: mappedRoleSave.Name,
|
|
1376
|
-
// data: mappedRoleSave,
|
|
1377
|
-
// body: [],
|
|
1378
|
-
// children: mappedRoleSave.RoleContexts.map((c) => {
|
|
1379
|
-
// return {
|
|
1380
|
-
// selected: false,
|
|
1381
|
-
// title: this.getFormattedName(c.Name),
|
|
1382
|
-
// data: c,
|
|
1383
|
-
// body: [],
|
|
1384
|
-
// children: c.RoleActions.map((a) => {
|
|
1385
|
-
// return {
|
|
1386
|
-
// selected: false,
|
|
1387
|
-
// title: this.getFormattedName(a.Name),
|
|
1388
|
-
// data: a,
|
|
1389
|
-
// body: [],
|
|
1390
|
-
// children: [],
|
|
1391
|
-
// };
|
|
1392
|
-
// }),
|
|
1393
|
-
// };
|
|
1394
|
-
// }),
|
|
1395
|
-
// };
|
|
1396
|
-
// }
|
|
1397
|
-
}
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1400
|
-
}
|
|
1401
|
-
|
|
1402
|
-
saveDataAll() {
|
|
1403
|
-
const roles: Role[] = this.data.map((x) => {
|
|
1404
|
-
return {
|
|
1405
|
-
...x,
|
|
1406
|
-
RoleContexts: x.RoleContexts.filter((y) => y.Selected).map((z) => {
|
|
1407
|
-
return {
|
|
1408
|
-
...z,
|
|
1409
|
-
RoleActions: z.RoleActions.filter(
|
|
1410
|
-
(a) => a.Selected
|
|
1411
|
-
) as RoleAction[],
|
|
1412
|
-
};
|
|
1413
|
-
}) as RoleContext[],
|
|
1414
|
-
};
|
|
1415
|
-
});
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1418
|
-
updateTable() {
|
|
1419
|
-
this.data = this.data.map((x) => x);
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
|
-
onViewChange(isGridView: boolean): void {}
|
|
1423
|
-
onStateChange(event: { key: string; value: boolean }): void {
|
|
1424
|
-
switch (event.key) {
|
|
1425
|
-
case 'create':
|
|
1426
|
-
var newMappedRole: MappedRole = {
|
|
1427
|
-
RoleContexts: this.sourceData.map((config) => {
|
|
1428
|
-
var context: MappedRoleContext = {
|
|
1429
|
-
ChildrenType: ChildrenType.Action,
|
|
1430
|
-
Selected: false,
|
|
1431
|
-
RoleActions: config.Actions.map((action) => {
|
|
1432
|
-
var act: MappedRoleAction = {
|
|
1433
|
-
Selected: false,
|
|
1434
|
-
Name: action,
|
|
1435
|
-
Role: '',
|
|
1436
|
-
Context: '',
|
|
1437
|
-
id: '',
|
|
1438
|
-
Id: '',
|
|
1439
|
-
CreatedAt: new Date(),
|
|
1440
|
-
UpdatedAt: new Date(),
|
|
1441
|
-
DataState: ObjectState.New,
|
|
1442
|
-
TenantId: '',
|
|
1443
|
-
Code: '',
|
|
1444
|
-
ServiceName: '',
|
|
1445
|
-
APIKey: this.envSvc.environment.APIKey,
|
|
1446
|
-
ApplicationRoleAction: this.getApplicationActionCode(action),
|
|
1447
|
-
};
|
|
1448
|
-
return act;
|
|
1449
|
-
}),
|
|
1450
|
-
Name: config.Name,
|
|
1451
|
-
Role: '',
|
|
1452
|
-
id: '',
|
|
1453
|
-
Id: '',
|
|
1454
|
-
CreatedAt: new Date(),
|
|
1455
|
-
UpdatedAt: new Date(),
|
|
1456
|
-
DataState: ObjectState.New,
|
|
1457
|
-
TenantId: '',
|
|
1458
|
-
Code: '',
|
|
1459
|
-
ServiceName: '',
|
|
1460
|
-
APIKey: this.envSvc.environment.APIKey,
|
|
1461
|
-
ApplicationRoleContext: this.getApplicationContextCode(
|
|
1462
|
-
config.Name
|
|
1463
|
-
),
|
|
1464
|
-
};
|
|
1465
|
-
|
|
1466
|
-
return context;
|
|
1467
|
-
}),
|
|
1468
|
-
ChildrenType: ChildrenType.Permission,
|
|
1469
|
-
Name: '',
|
|
1470
|
-
id: (this.cardData.length + 1).toString(),
|
|
1471
|
-
Id: (this.cardData.length + 1).toString(),
|
|
1472
|
-
CreatedAt: new Date(),
|
|
1473
|
-
UpdatedAt: new Date(),
|
|
1474
|
-
DataState: ObjectState.New,
|
|
1475
|
-
TenantId: '',
|
|
1476
|
-
Code: '',
|
|
1477
|
-
ServiceName: '',
|
|
1478
|
-
Application: this.application ? this.application : undefined,
|
|
1479
|
-
APIKey: this.envSvc.environment.APIKey,
|
|
1480
|
-
};
|
|
1481
|
-
const cardData: CardData = {
|
|
1482
|
-
selected: false,
|
|
1483
|
-
title: newMappedRole.Name,
|
|
1484
|
-
data: newMappedRole,
|
|
1485
|
-
body: [],
|
|
1486
|
-
children: newMappedRole.RoleContexts.map((c) => {
|
|
1487
|
-
return {
|
|
1488
|
-
selected: false,
|
|
1489
|
-
title: this.getFormattedName(c.Name),
|
|
1490
|
-
data: c,
|
|
1491
|
-
body: [],
|
|
1492
|
-
children: c.RoleActions.map((a) => {
|
|
1493
|
-
return {
|
|
1494
|
-
selected: false,
|
|
1495
|
-
title: this.getFormattedName(a.Name),
|
|
1496
|
-
data: a,
|
|
1497
|
-
body: [],
|
|
1498
|
-
children: [],
|
|
1499
|
-
};
|
|
1500
|
-
}),
|
|
1501
|
-
};
|
|
1502
|
-
}),
|
|
1503
|
-
};
|
|
1504
|
-
this.data = this.data.concat([newMappedRole]);
|
|
1505
|
-
this.cardData.push(cardData);
|
|
1506
|
-
this.roleCardClicked(cardData);
|
|
1507
|
-
this.dataView.isTableView = false;
|
|
1508
|
-
break;
|
|
1509
|
-
default:
|
|
1510
|
-
break;
|
|
1511
|
-
}
|
|
1512
|
-
}
|
|
1513
|
-
|
|
1514
|
-
showTableView: boolean = false;
|
|
1515
|
-
onSelectionChange(selectedRows: Role[]) {}
|
|
1516
|
-
retryMessage() {}
|
|
1517
|
-
onColumnsUpdated(updatedColumns: IDataFilter[]) {
|
|
1518
|
-
const updatedColumnDef: ColumnDefinition<MappedRole>[] = [];
|
|
1519
|
-
updatedColumns.forEach((col) => {
|
|
1520
|
-
const matchingCol = this.roleControlSvc.roleColumns.find(
|
|
1521
|
-
(column) => column.header === col.name || column.id === col.name
|
|
1522
|
-
);
|
|
1523
|
-
if (matchingCol) {
|
|
1524
|
-
updatedColumnDef.push(matchingCol);
|
|
1525
|
-
}
|
|
1526
|
-
});
|
|
1527
|
-
|
|
1528
|
-
this.visibleColumnDef = [...updatedColumnDef];
|
|
1529
|
-
}
|
|
1530
|
-
|
|
1531
|
-
async updateFiltersAndSorts(isSearch: boolean = false) {
|
|
1532
|
-
if (!isSearch) {
|
|
1533
|
-
this.dataView.onClearSearch();
|
|
1534
|
-
this.currentSearchTerm = '';
|
|
1535
|
-
this.cdr.detectChanges();
|
|
1536
|
-
const clickEvent = new MouseEvent('click', {
|
|
1537
|
-
bubbles: true,
|
|
1538
|
-
cancelable: true,
|
|
1539
|
-
view: window,
|
|
1540
|
-
});
|
|
1541
|
-
document.dispatchEvent(clickEvent);
|
|
1542
|
-
}
|
|
1543
|
-
var payload: SearchPropertyValue[] = this.currentFilters.map((x) => {
|
|
1544
|
-
return {
|
|
1545
|
-
PropertyName: x.name,
|
|
1546
|
-
EntityValue: x.value,
|
|
1547
|
-
Operator: SearchOperator.And,
|
|
1548
|
-
Sign:
|
|
1549
|
-
x.condition && Object.keys(DateFilterTypes).includes(x.condition)
|
|
1550
|
-
? (DateFilterTypes[
|
|
1551
|
-
x.condition as keyof typeof DateFilterTypes
|
|
1552
|
-
] as unknown as SearchPropertySign)
|
|
1553
|
-
: SearchPropertySign.EQ,
|
|
1554
|
-
Type: SearchPropertyValueType.Date,
|
|
1555
|
-
};
|
|
1556
|
-
});
|
|
1557
|
-
payload.push({
|
|
1558
|
-
PropertyName: 'APIKey',
|
|
1559
|
-
EntityValue: this.envSvc.environment.APIKey,
|
|
1560
|
-
Operator: SearchOperator.And,
|
|
1561
|
-
Sign: SearchPropertySign.EQ,
|
|
1562
|
-
});
|
|
1563
|
-
for (let sort of this.currentSorts) {
|
|
1564
|
-
payload.push({
|
|
1565
|
-
PropertyName: sort.name,
|
|
1566
|
-
EntityValue: '',
|
|
1567
|
-
Operator: SearchOperator.And,
|
|
1568
|
-
Sign: SearchPropertySign.EQ,
|
|
1569
|
-
Sort:
|
|
1570
|
-
sort.value.toLowerCase() == SortDirection.Asc.toLowerCase()
|
|
1571
|
-
? SortDirection.Asc
|
|
1572
|
-
: sort.value.toLowerCase() == SortDirection.Desc.toLowerCase()
|
|
1573
|
-
? SortDirection.Desc
|
|
1574
|
-
: SortDirection.None,
|
|
1575
|
-
});
|
|
1576
|
-
}
|
|
1577
|
-
const searchTermExists = this.currentSearchTerm.trim().length > 0;
|
|
1578
|
-
this.utilService.sendBI(true);
|
|
1579
|
-
const res = searchTermExists
|
|
1580
|
-
? await this.server.get(
|
|
1581
|
-
`Role/GetRolesWithParam/${this.currentSearchTerm.trim()}/0/${
|
|
1582
|
-
this.pageSize
|
|
1583
|
-
}`
|
|
1584
|
-
)
|
|
1585
|
-
: await this.server.post(`Role/SearchRoles/0/${this.pageSize}`, payload);
|
|
1586
|
-
this.utilService.sendBI(false);
|
|
1587
|
-
if (res instanceof ErrorResponse) {
|
|
1588
|
-
this.currentFilters = [];
|
|
1589
|
-
this.currentSorts = [];
|
|
1590
|
-
return undefined;
|
|
1591
|
-
} else {
|
|
1592
|
-
this.cardDataView.clearData();
|
|
1593
|
-
this.currentData = null;
|
|
1594
|
-
this.pageState = res as PagedResult<Role>;
|
|
1595
|
-
var result = (res as PagedResult<Role>).Result;
|
|
1596
|
-
this.setUpMappedData(result);
|
|
1597
|
-
this.setUpCardData();
|
|
1598
|
-
}
|
|
1599
|
-
}
|
|
1600
|
-
async loadMoreFiltersAndSorts(): Promise<PagedResult<Role> | undefined> {
|
|
1601
|
-
if (!this.pageState) {
|
|
1602
|
-
return;
|
|
1603
|
-
}
|
|
1604
|
-
var payload: SearchPropertyValue[] = this.currentFilters.map((x) => {
|
|
1605
|
-
return {
|
|
1606
|
-
PropertyName: x.name,
|
|
1607
|
-
EntityValue: x.value,
|
|
1608
|
-
Operator: SearchOperator.And,
|
|
1609
|
-
Sign:
|
|
1610
|
-
x.condition && Object.keys(DateFilterTypes).includes(x.condition)
|
|
1611
|
-
? (DateFilterTypes[
|
|
1612
|
-
x.condition as keyof typeof DateFilterTypes
|
|
1613
|
-
] as unknown as SearchPropertySign)
|
|
1614
|
-
: SearchPropertySign.EQ,
|
|
1615
|
-
Type: SearchPropertyValueType.Date,
|
|
1616
|
-
};
|
|
1617
|
-
});
|
|
1618
|
-
payload.push({
|
|
1619
|
-
PropertyName: 'APIKey',
|
|
1620
|
-
EntityValue: this.envSvc.environment.APIKey,
|
|
1621
|
-
Operator: SearchOperator.And,
|
|
1622
|
-
Sign: SearchPropertySign.EQ,
|
|
1623
|
-
});
|
|
1624
|
-
for (let sort of this.currentSorts) {
|
|
1625
|
-
payload.push({
|
|
1626
|
-
PropertyName: sort.name,
|
|
1627
|
-
EntityValue: '',
|
|
1628
|
-
Operator: SearchOperator.And,
|
|
1629
|
-
Sign: SearchPropertySign.EQ,
|
|
1630
|
-
Sort:
|
|
1631
|
-
sort.value.toLowerCase() == SortDirection.Asc.toLowerCase()
|
|
1632
|
-
? SortDirection.Asc
|
|
1633
|
-
: sort.value.toLowerCase() == SortDirection.Desc.toLowerCase()
|
|
1634
|
-
? SortDirection.Desc
|
|
1635
|
-
: SortDirection.None,
|
|
1636
|
-
});
|
|
1637
|
-
}
|
|
1638
|
-
const searchTermExists = this.currentSearchTerm.trim().length > 0;
|
|
1639
|
-
this.utilService.sendBI(true);
|
|
1640
|
-
const res = searchTermExists
|
|
1641
|
-
? await this.server.get(
|
|
1642
|
-
`Role/GetRolesWithParam/${this.currentSearchTerm.trim()}/${
|
|
1643
|
-
this.pageState.Skip
|
|
1644
|
-
}/${this.pageSize}`
|
|
1645
|
-
)
|
|
1646
|
-
: await this.server.post(
|
|
1647
|
-
`Role/SearchRoles/${this.pageState.Skip}/${this.pageSize}`,
|
|
1648
|
-
payload
|
|
1649
|
-
);
|
|
1650
|
-
this.utilService.sendBI(false);
|
|
1651
|
-
if (res instanceof ErrorResponse) {
|
|
1652
|
-
return undefined;
|
|
1653
|
-
} else {
|
|
1654
|
-
var result = res as PagedResult<Role>;
|
|
1655
|
-
return result;
|
|
1656
|
-
}
|
|
1657
|
-
}
|
|
1658
|
-
onFilterUpdated(updatedFilters: IDataFilter[] | string) {
|
|
1659
|
-
// Ensure updatedFilters is an array
|
|
1660
|
-
if (Array.isArray(updatedFilters)) {
|
|
1661
|
-
this.currentFilters = updatedFilters;
|
|
1662
|
-
this.updateFiltersAndSorts();
|
|
1663
|
-
}
|
|
1664
|
-
}
|
|
1665
|
-
onSortUpdated(updatedSorts: IDataFilter[]) {
|
|
1666
|
-
this.currentSorts = updatedSorts;
|
|
1667
|
-
console.log({ CurrSorts: this.currentSorts });
|
|
1668
|
-
this.updateFiltersAndSorts();
|
|
1669
|
-
}
|
|
1670
|
-
|
|
1671
|
-
handleSearch(event: { key: string; value: string }) {
|
|
1672
|
-
this.searchTerm$.next(event.value);
|
|
1673
|
-
}
|
|
1674
|
-
|
|
1675
|
-
handleExport(exportedData: Partial<any>[]) {
|
|
1676
|
-
// console.log('Exported data:', exportedData);
|
|
1677
|
-
this.downloadCSV(exportedData);
|
|
1678
|
-
}
|
|
1679
|
-
private downloadCSV(data: Partial<any>[]) {
|
|
1680
|
-
const headers = Object.keys(data[0]);
|
|
1681
|
-
const csvContent = [
|
|
1682
|
-
headers.join(','),
|
|
1683
|
-
...data.map((row) => headers.map((header) => row[header]).join(',')),
|
|
1684
|
-
].join('\n');
|
|
1685
|
-
|
|
1686
|
-
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
|
|
1687
|
-
const link = document.createElement('a');
|
|
1688
|
-
if (link.download !== undefined) {
|
|
1689
|
-
const url = URL.createObjectURL(blob);
|
|
1690
|
-
link.setAttribute('href', url);
|
|
1691
|
-
link.setAttribute('download', 'export.csv');
|
|
1692
|
-
link.style.visibility = 'hidden';
|
|
1693
|
-
document.body.appendChild(link);
|
|
1694
|
-
link.click();
|
|
1695
|
-
document.body.removeChild(link);
|
|
1696
|
-
}
|
|
1697
|
-
}
|
|
1698
|
-
|
|
1699
|
-
getMockRoles(): Role[] {
|
|
1700
|
-
return new Array(10).fill(1).map((id, i) => ({
|
|
1701
|
-
Id: id + i,
|
|
1702
|
-
id: (id + i).toString(),
|
|
1703
|
-
Name: this.mockNames[i] || '',
|
|
1704
|
-
RoleContexts: this.randomContexts(),
|
|
1705
|
-
CreatedAt: new Date(),
|
|
1706
|
-
UpdatedAt: new Date(),
|
|
1707
|
-
DataState: ObjectState.New,
|
|
1708
|
-
TenantId: `Tenant${id + i}`,
|
|
1709
|
-
Code: '',
|
|
1710
|
-
ServiceName: '',
|
|
1711
|
-
APIKey: '',
|
|
1712
|
-
}));
|
|
1713
|
-
}
|
|
1714
|
-
|
|
1715
|
-
mockNames: string[] = [
|
|
1716
|
-
'Admin',
|
|
1717
|
-
'Super Admin',
|
|
1718
|
-
'Manager',
|
|
1719
|
-
'Intern',
|
|
1720
|
-
'Production Manager',
|
|
1721
|
-
'CEO',
|
|
1722
|
-
'CTO',
|
|
1723
|
-
'COO',
|
|
1724
|
-
'Developer',
|
|
1725
|
-
'Engineer',
|
|
1726
|
-
];
|
|
1727
|
-
|
|
1728
|
-
randomName(): string {
|
|
1729
|
-
const randomIndex = Math.floor(Math.random() * this.mockNames.length);
|
|
1730
|
-
return this.mockNames[randomIndex];
|
|
1731
|
-
}
|
|
1732
|
-
|
|
1733
|
-
randomContexts(): RoleContext[] {
|
|
1734
|
-
const randomNumber = Math.floor(
|
|
1735
|
-
Math.random() * Object.keys(UIs).length + 1
|
|
1736
|
-
);
|
|
1737
|
-
var returnArray: RoleContext[] = [];
|
|
1738
|
-
const usedList: number[] = [];
|
|
1739
|
-
for (let i = 0; i < randomNumber; i++) {
|
|
1740
|
-
let randomIndex;
|
|
1741
|
-
do {
|
|
1742
|
-
randomIndex = Math.floor(Math.random() * Object.keys(UIs).length);
|
|
1743
|
-
} while (usedList.includes(randomIndex));
|
|
1744
|
-
|
|
1745
|
-
returnArray.push({
|
|
1746
|
-
Id: 'context' + i,
|
|
1747
|
-
id: ('context' + i).toString(),
|
|
1748
|
-
Name: Object.keys(UIs)[randomIndex],
|
|
1749
|
-
Role: '',
|
|
1750
|
-
RoleActions: this.randomActions(),
|
|
1751
|
-
CreatedAt: new Date(),
|
|
1752
|
-
UpdatedAt: new Date(),
|
|
1753
|
-
DataState: ObjectState.New,
|
|
1754
|
-
TenantId: `Tenant${'context' + i}`,
|
|
1755
|
-
Code: '',
|
|
1756
|
-
ServiceName: '',
|
|
1757
|
-
APIKey: '',
|
|
1758
|
-
ApplicationRoleContext: '',
|
|
1759
|
-
});
|
|
1760
|
-
usedList.push(randomIndex);
|
|
1761
|
-
}
|
|
1762
|
-
return returnArray;
|
|
1763
|
-
}
|
|
1764
|
-
|
|
1765
|
-
randomActions(): RoleAction[] {
|
|
1766
|
-
const randomNumber = Math.floor(
|
|
1767
|
-
Math.random() * Object.keys(UIActions).length + 1
|
|
1768
|
-
);
|
|
1769
|
-
var returnArray: RoleAction[] = [];
|
|
1770
|
-
const usedList: number[] = [];
|
|
1771
|
-
for (let i = 0; i < randomNumber; i++) {
|
|
1772
|
-
let randomIndex;
|
|
1773
|
-
do {
|
|
1774
|
-
randomIndex = Math.floor(Math.random() * Object.keys(UIActions).length);
|
|
1775
|
-
} while (usedList.includes(randomIndex));
|
|
1776
|
-
|
|
1777
|
-
returnArray.push({
|
|
1778
|
-
Id: 'action' + i,
|
|
1779
|
-
id: ('action' + i).toString(),
|
|
1780
|
-
Name: Object.keys(UIActions)[randomIndex],
|
|
1781
|
-
Role: '',
|
|
1782
|
-
Context: '',
|
|
1783
|
-
CreatedAt: new Date(),
|
|
1784
|
-
UpdatedAt: new Date(),
|
|
1785
|
-
DataState: ObjectState.New,
|
|
1786
|
-
TenantId: `Tenant${'action' + i}`,
|
|
1787
|
-
Code: '',
|
|
1788
|
-
ServiceName: '',
|
|
1789
|
-
APIKey: '',
|
|
1790
|
-
ApplicationRoleAction: '',
|
|
1791
|
-
});
|
|
1792
|
-
usedList.push(randomIndex);
|
|
1793
|
-
}
|
|
1794
|
-
return returnArray;
|
|
1795
|
-
}
|
|
1796
|
-
|
|
1797
|
-
closePopUp() {
|
|
1798
|
-
this.openDropdownId = null;
|
|
1799
|
-
this.popUps.forEach((popUp) => {
|
|
1800
|
-
if (popUp.dropdownOpen) {
|
|
1801
|
-
popUp.toggleDropdown();
|
|
1802
|
-
}
|
|
1803
|
-
});
|
|
1804
|
-
}
|
|
1805
|
-
|
|
1806
|
-
updateItem(value: any, key: string): any {
|
|
1807
|
-
return {
|
|
1808
|
-
[key]: value,
|
|
1809
|
-
};
|
|
1810
|
-
}
|
|
1811
|
-
|
|
1812
|
-
editValue(value: MappedRole) {
|
|
1813
|
-
const card = this.cardData.find((x) => x.data.Id == value.Id);
|
|
1814
|
-
if (card && this.cardDataView) {
|
|
1815
|
-
this.dataView.toggleView();
|
|
1816
|
-
card.selected = true;
|
|
1817
|
-
this.currentData = this.cardDataView.onItemClick(card);
|
|
1818
|
-
this.closePopUp();
|
|
1819
|
-
// if (this.currentData) {
|
|
1820
|
-
// this.form.controls['Name'].setValue(this.currentData.data?.Name);
|
|
1821
|
-
// }
|
|
1822
|
-
}
|
|
1823
|
-
}
|
|
1824
|
-
|
|
1825
|
-
tableCache = new Map<string, MappedRole>();
|
|
1826
|
-
|
|
1827
|
-
cacheItem(item: MappedRole) {
|
|
1828
|
-
const cacheKey = item.Id;
|
|
1829
|
-
this.tableCache.set(cacheKey, JSON.parse(JSON.stringify(item)));
|
|
1830
|
-
}
|
|
1831
|
-
|
|
1832
|
-
restoreCache(item: Role) {
|
|
1833
|
-
const cacheKey = item.Id;
|
|
1834
|
-
const itemCache = this.tableCache.get(cacheKey);
|
|
1835
|
-
if (itemCache) {
|
|
1836
|
-
item.Name = itemCache.Name;
|
|
1837
|
-
}
|
|
1838
|
-
this.tableCache.delete(cacheKey);
|
|
1839
|
-
}
|
|
1840
|
-
|
|
1841
|
-
onSearchFocus() {
|
|
1842
|
-
this.isInputFocused = true;
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1845
|
-
onSearchBlur() {
|
|
1846
|
-
this.isInputFocused = false;
|
|
1847
|
-
}
|
|
1848
|
-
|
|
1849
|
-
onInputFocus() {
|
|
1850
|
-
this.isInputFocused = true;
|
|
1851
|
-
}
|
|
1852
|
-
|
|
1853
|
-
onInputBlur() {
|
|
1854
|
-
this.isInputFocused = false;
|
|
1855
|
-
}
|
|
1856
|
-
|
|
1857
|
-
// onSearch(event: any) {
|
|
1858
|
-
// const searchTerm = event.target.value;
|
|
1859
|
-
// // if (this.firstSearch == false) {
|
|
1860
|
-
// // this.optionsCopy = cloneDeep(this._options);
|
|
1861
|
-
// // this.firstSearch = true;
|
|
1862
|
-
// // }
|
|
1863
|
-
// if (searchTerm.trim().length == 0) {
|
|
1864
|
-
// this.cardData = JSON.parse(JSON.stringify(this.dataCopy));
|
|
1865
|
-
// //this.firstSearch = false;
|
|
1866
|
-
// return;
|
|
1867
|
-
// }
|
|
1868
|
-
// this.cardData = this.dataCopy.filter(
|
|
1869
|
-
// (x) => typeof x.data.Name == 'string' && new RegExp(searchTerm, 'i').test(x.data.Name)
|
|
1870
|
-
// );
|
|
1871
|
-
|
|
1872
|
-
// }
|
|
1873
|
-
|
|
1874
|
-
get filteredData(): CardData[] {
|
|
1875
|
-
if (this.searchContext.trim().length == 0) {
|
|
1876
|
-
return this.cardData;
|
|
1877
|
-
}
|
|
1878
|
-
return this.cardData.filter(
|
|
1879
|
-
(x) =>
|
|
1880
|
-
typeof x.data.Name == 'string' &&
|
|
1881
|
-
new RegExp(this.searchContext, 'i').test(x.data.Name)
|
|
1882
|
-
);
|
|
1883
|
-
}
|
|
1884
|
-
}
|