verben-authentication-ui 1.0.3 → 1.0.5

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