@tuki-io/tuki-widgets 0.0.8 → 0.0.9

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 (229) hide show
  1. package/karma.conf.js +44 -0
  2. package/ng-package.json +7 -0
  3. package/package.json +3 -39
  4. package/src/lib/widgets.component.spec.ts +23 -0
  5. package/src/lib/widgets.component.ts +20 -0
  6. package/src/lib/widgets.module.ts +16 -0
  7. package/src/lib/widgets.service.spec.ts +16 -0
  8. package/src/lib/widgets.service.ts +9 -0
  9. package/{public-api.d.ts → src/public-api.ts} +4 -0
  10. package/src/test.ts +27 -0
  11. package/styles/_variables.scss +90 -0
  12. package/styles/form.scss +231 -0
  13. package/styles/icons.scss +32 -0
  14. package/styles/styles.scss +110 -0
  15. package/styles/tables.scss +30 -0
  16. package/tsconfig.lib.json +36 -0
  17. package/tsconfig.lib.prod.json +10 -0
  18. package/tsconfig.spec.json +17 -0
  19. package/user-manage/ng-package.json +7 -0
  20. package/user-manage/src/app.constants.ts +38 -0
  21. package/user-manage/src/classes/device.ts +225 -0
  22. package/user-manage/src/classes/line.ts +117 -0
  23. package/user-manage/src/classes/notification.ts +39 -0
  24. package/user-manage/src/classes/pagination.ts +18 -0
  25. package/user-manage/src/classes/simplified-user.ts +128 -0
  26. package/user-manage/src/classes/table-data.ts +6 -0
  27. package/user-manage/src/classes/user-interface.ts +225 -0
  28. package/user-manage/src/classes/user-list.ts +40 -0
  29. package/user-manage/src/classes/user.ts +8 -0
  30. package/user-manage/src/common-functions.ts +16 -0
  31. package/user-manage/src/environments/environment.prod.ts +9 -0
  32. package/user-manage/src/environments/environment.ts +10 -0
  33. package/user-manage/src/interseptors/auth.interceptor.ts +36 -0
  34. package/user-manage/src/lazy-loading-select/lazy-loading-select.component.html +50 -0
  35. package/user-manage/src/lazy-loading-select/lazy-loading-select.component.scss +3 -0
  36. package/user-manage/src/lazy-loading-select/lazy-loading-select.component.ts +81 -0
  37. package/user-manage/src/material.module.ts +85 -0
  38. package/user-manage/src/notifications/notification.component.html +33 -0
  39. package/user-manage/src/notifications/notification.component.scss +84 -0
  40. package/user-manage/src/notifications/notification.component.ts +46 -0
  41. package/user-manage/src/removeKynFromIBM.service.ts +25 -0
  42. package/user-manage/src/services/api.service.ts +90 -0
  43. package/user-manage/src/services/notification.service.ts +68 -0
  44. package/user-manage/src/services/removeKynFromIBM.service.ts +25 -0
  45. package/user-manage/src/services/site-settings.service.ts +35 -0
  46. package/user-manage/src/services/user.service.ts +120 -0
  47. package/user-manage/src/services/users-search.service.ts +58 -0
  48. package/user-manage/src/services/utils.service.ts +71 -0
  49. package/user-manage/src/styles/_variables.scss +90 -0
  50. package/user-manage/src/styles/form.scss +231 -0
  51. package/user-manage/src/styles/icons.scss +32 -0
  52. package/user-manage/src/styles/styles.scss +110 -0
  53. package/user-manage/src/styles/tables.scss +30 -0
  54. package/user-manage/src/user-details/notification.service.ts +68 -0
  55. package/user-manage/src/user-info/user-info.component.html +32 -0
  56. package/user-manage/src/user-info/user-info.component.scss +53 -0
  57. package/user-manage/src/user-info/user-info.component.ts +19 -0
  58. package/user-manage/src/user-manage-widget.component.html +291 -0
  59. package/user-manage/src/user-manage-widget.component.scss +461 -0
  60. package/user-manage/src/user-manage-widget.component.ts +165 -0
  61. package/user-manage/src/user-manage.module.ts +53 -0
  62. package/user-manage/src/utils/app-loader/app-loader.component.html +6 -0
  63. package/user-manage/src/utils/app-loader/app-loader.component.scss +11 -0
  64. package/user-manage/src/utils/app-loader/app-loader.ts +13 -0
  65. package/user-manage/src/utils/pagination/pagination.component.html +26 -0
  66. package/user-manage/src/utils/pagination/pagination.component.scss +41 -0
  67. package/user-manage/src/utils/pagination/pagination.component.ts +41 -0
  68. package/users-list/ng-package.json +6 -0
  69. package/users-list/src/app.constants.ts +35 -0
  70. package/users-list/src/classes/device.ts +225 -0
  71. package/users-list/src/classes/line.ts +117 -0
  72. package/users-list/src/classes/notification.ts +38 -0
  73. package/users-list/src/classes/pagination.ts +18 -0
  74. package/users-list/src/classes/simlified-user.ts +74 -0
  75. package/users-list/src/classes/table-data.ts +6 -0
  76. package/users-list/src/classes/user-interface.ts +225 -0
  77. package/users-list/src/classes/user-list.ts +40 -0
  78. package/users-list/src/classes/user.ts +8 -0
  79. package/users-list/src/material.module.ts +84 -0
  80. package/users-list/src/services/api.service.ts +90 -0
  81. package/users-list/src/services/events-communication.service.ts +11 -0
  82. package/users-list/src/services/notification.service.ts +68 -0
  83. package/users-list/src/services/removeKynFromIBM.service.ts +25 -0
  84. package/users-list/src/services/user.service.ts +117 -0
  85. package/users-list/src/services/users-search.service.ts +58 -0
  86. package/users-list/src/users-list.component.css +4 -0
  87. package/users-list/src/users-list.component.css.map +1 -0
  88. package/users-list/src/users-list.component.html +39 -0
  89. package/users-list/src/users-list.component.scss +9 -0
  90. package/users-list/src/users-list.component.ts +87 -0
  91. package/users-list/src/users-list.module.ts +36 -0
  92. package/users-list/src/utils/app-loader/app-loader.component.css +11 -0
  93. package/users-list/src/utils/app-loader/app-loader.component.css.map +1 -0
  94. package/users-list/src/utils/app-loader/app-loader.component.html +6 -0
  95. package/users-list/src/utils/app-loader/app-loader.component.scss +11 -0
  96. package/users-list/src/utils/app-loader/app-loader.ts +13 -0
  97. package/users-list/src/utils/common-functions.ts +16 -0
  98. package/users-list/src/utils/notifications/notification.component.html +33 -0
  99. package/users-list/src/utils/notifications/notification.component.scss +84 -0
  100. package/users-list/src/utils/notifications/notification.component.ts +46 -0
  101. package/users-list/src/utils/pagination/pagination.component.css +45 -0
  102. package/users-list/src/utils/pagination/pagination.component.css.map +1 -0
  103. package/users-list/src/utils/pagination/pagination.component.html +26 -0
  104. package/users-list/src/utils/pagination/pagination.component.scss +41 -0
  105. package/users-list/src/utils/pagination/pagination.component.ts +41 -0
  106. package/users-list/src/utils/utils.service.ts +71 -0
  107. package/esm2020/lib/widgets.component.mjs +0 -22
  108. package/esm2020/lib/widgets.module.mjs +0 -21
  109. package/esm2020/lib/widgets.service.mjs +0 -14
  110. package/esm2020/public-api.mjs +0 -7
  111. package/esm2020/tuki-io-tuki-widgets.mjs +0 -5
  112. package/esm2020/user-manage/public-api.mjs +0 -7
  113. package/esm2020/user-manage/src/app.constants.mjs +0 -38
  114. package/esm2020/user-manage/src/classes/device.mjs +0 -7
  115. package/esm2020/user-manage/src/classes/line.mjs +0 -9
  116. package/esm2020/user-manage/src/classes/notification.mjs +0 -32
  117. package/esm2020/user-manage/src/classes/pagination.mjs +0 -8
  118. package/esm2020/user-manage/src/classes/simplified-user.mjs +0 -82
  119. package/esm2020/user-manage/src/classes/table-data.mjs +0 -2
  120. package/esm2020/user-manage/src/classes/user-list.mjs +0 -10
  121. package/esm2020/user-manage/src/common-functions.mjs +0 -19
  122. package/esm2020/user-manage/src/environments/environment.mjs +0 -11
  123. package/esm2020/user-manage/src/interseptors/auth.interceptor.mjs +0 -37
  124. package/esm2020/user-manage/src/lazy-loading-select/lazy-loading-select.component.mjs +0 -74
  125. package/esm2020/user-manage/src/material.module.mjs +0 -188
  126. package/esm2020/user-manage/src/notifications/notification.component.mjs +0 -35
  127. package/esm2020/user-manage/src/removeKynFromIBM.service.mjs +0 -25
  128. package/esm2020/user-manage/src/services/api.service.mjs +0 -79
  129. package/esm2020/user-manage/src/services/notification.service.mjs +0 -62
  130. package/esm2020/user-manage/src/services/removeKynFromIBM.service.mjs +0 -25
  131. package/esm2020/user-manage/src/services/site-settings.service.mjs +0 -36
  132. package/esm2020/user-manage/src/services/user.service.mjs +0 -108
  133. package/esm2020/user-manage/src/services/users-search.service.mjs +0 -49
  134. package/esm2020/user-manage/src/services/utils.service.mjs +0 -73
  135. package/esm2020/user-manage/src/user-info/user-info.component.mjs +0 -20
  136. package/esm2020/user-manage/src/user-manage-widget.component.mjs +0 -162
  137. package/esm2020/user-manage/src/user-manage.module.mjs +0 -84
  138. package/esm2020/user-manage/src/utils/app-loader/app-loader.mjs +0 -14
  139. package/esm2020/user-manage/src/utils/pagination/pagination.component.mjs +0 -43
  140. package/esm2020/user-manage/tuki-io-tuki-widgets-user-manage.mjs +0 -5
  141. package/esm2020/users-list/public-api.mjs +0 -9
  142. package/esm2020/users-list/src/app.constants.mjs +0 -35
  143. package/esm2020/users-list/src/classes/device.mjs +0 -7
  144. package/esm2020/users-list/src/classes/line.mjs +0 -9
  145. package/esm2020/users-list/src/classes/notification.mjs +0 -31
  146. package/esm2020/users-list/src/classes/pagination.mjs +0 -8
  147. package/esm2020/users-list/src/classes/simlified-user.mjs +0 -50
  148. package/esm2020/users-list/src/classes/table-data.mjs +0 -2
  149. package/esm2020/users-list/src/classes/user-list.mjs +0 -10
  150. package/esm2020/users-list/src/material.module.mjs +0 -188
  151. package/esm2020/users-list/src/services/api.service.mjs +0 -78
  152. package/esm2020/users-list/src/services/events-communication.service.mjs +0 -14
  153. package/esm2020/users-list/src/services/notification.service.mjs +0 -62
  154. package/esm2020/users-list/src/services/removeKynFromIBM.service.mjs +0 -25
  155. package/esm2020/users-list/src/services/user.service.mjs +0 -105
  156. package/esm2020/users-list/src/services/users-search.service.mjs +0 -49
  157. package/esm2020/users-list/src/users-list.component.mjs +0 -78
  158. package/esm2020/users-list/src/users-list.module.mjs +0 -58
  159. package/esm2020/users-list/src/utils/common-functions.mjs +0 -19
  160. package/esm2020/users-list/src/utils/pagination/pagination.component.mjs +0 -43
  161. package/esm2020/users-list/src/utils/utils.service.mjs +0 -73
  162. package/esm2020/users-list/tuki-io-tuki-widgets-users-list.mjs +0 -5
  163. package/fesm2015/tuki-io-tuki-widgets-user-manage.mjs +0 -1235
  164. package/fesm2015/tuki-io-tuki-widgets-user-manage.mjs.map +0 -1
  165. package/fesm2015/tuki-io-tuki-widgets-users-list.mjs +0 -872
  166. package/fesm2015/tuki-io-tuki-widgets-users-list.mjs.map +0 -1
  167. package/fesm2015/tuki-io-tuki-widgets.mjs +0 -63
  168. package/fesm2015/tuki-io-tuki-widgets.mjs.map +0 -1
  169. package/fesm2020/tuki-io-tuki-widgets-user-manage.mjs +0 -1222
  170. package/fesm2020/tuki-io-tuki-widgets-user-manage.mjs.map +0 -1
  171. package/fesm2020/tuki-io-tuki-widgets-users-list.mjs +0 -869
  172. package/fesm2020/tuki-io-tuki-widgets-users-list.mjs.map +0 -1
  173. package/fesm2020/tuki-io-tuki-widgets.mjs +0 -63
  174. package/fesm2020/tuki-io-tuki-widgets.mjs.map +0 -1
  175. package/index.d.ts +0 -5
  176. package/lib/widgets.component.d.ts +0 -8
  177. package/lib/widgets.module.d.ts +0 -7
  178. package/lib/widgets.service.d.ts +0 -6
  179. package/user-manage/index.d.ts +0 -5
  180. package/user-manage/src/app.constants.d.ts +0 -20
  181. package/user-manage/src/classes/device.d.ts +0 -224
  182. package/user-manage/src/classes/line.d.ts +0 -116
  183. package/user-manage/src/classes/notification.d.ts +0 -18
  184. package/user-manage/src/classes/pagination.d.ts +0 -13
  185. package/user-manage/src/classes/simplified-user.d.ts +0 -41
  186. package/user-manage/src/classes/table-data.d.ts +0 -5
  187. package/user-manage/src/classes/user-list.d.ts +0 -32
  188. package/user-manage/src/common-functions.d.ts +0 -1
  189. package/user-manage/src/environments/environment.d.ts +0 -9
  190. package/user-manage/src/interseptors/auth.interceptor.d.ts +0 -9
  191. package/user-manage/src/lazy-loading-select/lazy-loading-select.component.d.ts +0 -35
  192. package/user-manage/src/material.module.d.ts +0 -28
  193. package/user-manage/src/notifications/notification.component.d.ts +0 -19
  194. package/user-manage/src/removeKynFromIBM.service.d.ts +0 -8
  195. package/user-manage/src/services/api.service.d.ts +0 -21
  196. package/user-manage/src/services/notification.service.d.ts +0 -18
  197. package/user-manage/src/services/removeKynFromIBM.service.d.ts +0 -8
  198. package/user-manage/src/services/site-settings.service.d.ts +0 -9
  199. package/user-manage/src/services/user.service.d.ts +0 -26
  200. package/user-manage/src/services/users-search.service.d.ts +0 -25
  201. package/user-manage/src/services/utils.service.d.ts +0 -9
  202. package/user-manage/src/user-info/user-info.component.d.ts +0 -9
  203. package/user-manage/src/user-manage-widget.component.d.ts +0 -32
  204. package/user-manage/src/user-manage.module.d.ts +0 -18
  205. package/user-manage/src/utils/app-loader/app-loader.d.ts +0 -6
  206. package/user-manage/src/utils/pagination/pagination.component.d.ts +0 -18
  207. package/users-list/index.d.ts +0 -5
  208. package/users-list/src/app.constants.d.ts +0 -17
  209. package/users-list/src/classes/device.d.ts +0 -224
  210. package/users-list/src/classes/line.d.ts +0 -116
  211. package/users-list/src/classes/notification.d.ts +0 -18
  212. package/users-list/src/classes/pagination.d.ts +0 -13
  213. package/users-list/src/classes/simlified-user.d.ts +0 -25
  214. package/users-list/src/classes/table-data.d.ts +0 -5
  215. package/users-list/src/classes/user-list.d.ts +0 -32
  216. package/users-list/src/material.module.d.ts +0 -28
  217. package/users-list/src/services/api.service.d.ts +0 -21
  218. package/users-list/src/services/events-communication.service.d.ts +0 -8
  219. package/users-list/src/services/notification.service.d.ts +0 -18
  220. package/users-list/src/services/removeKynFromIBM.service.d.ts +0 -8
  221. package/users-list/src/services/user.service.d.ts +0 -26
  222. package/users-list/src/services/users-search.service.d.ts +0 -25
  223. package/users-list/src/users-list.component.d.ts +0 -35
  224. package/users-list/src/users-list.module.d.ts +0 -12
  225. package/users-list/src/utils/common-functions.d.ts +0 -1
  226. package/users-list/src/utils/pagination/pagination.component.d.ts +0 -18
  227. package/users-list/src/utils/utils.service.d.ts +0 -9
  228. /package/user-manage/{public-api.d.ts → public-api.ts} +0 -0
  229. /package/users-list/{public-api.d.ts → public-api.ts} +0 -0
@@ -0,0 +1,46 @@
1
+ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
2
+ import { Subscription } from 'rxjs';
3
+ import { NotificationService } from '../services/notification.service';
4
+ import { Notification } from '../classes/notification';
5
+
6
+ @Component({
7
+ selector: 'app-notification',
8
+ templateUrl: './notification.component.html',
9
+ styleUrls: ['./notification.component.scss'],
10
+ changeDetection: ChangeDetectionStrategy.OnPush
11
+ })
12
+ export class NotificationsComponent implements OnInit, OnDestroy {
13
+ public list!: Notification[];
14
+ public isReadMore!: boolean;
15
+ private listSubscription!: Subscription;
16
+
17
+ constructor(
18
+ public notificationService: NotificationService,
19
+ private ref: ChangeDetectorRef
20
+ ) {
21
+ }
22
+
23
+ ngOnInit() {
24
+ this.listChangeSubscribe();
25
+ }
26
+
27
+ ngOnDestroy() {
28
+ this.listSubscription.unsubscribe();
29
+ }
30
+
31
+ public readMore(): void {
32
+ this.isReadMore = !this.isReadMore;
33
+ }
34
+
35
+ public removeNotification(notification: Notification): void {
36
+ this.notificationService.remove(notification);
37
+ }
38
+
39
+ private listChangeSubscribe(): void {
40
+ this.listSubscription = this.notificationService.listChange
41
+ .subscribe((list: any) => {
42
+ this.list = list;
43
+ this.ref.detectChanges();
44
+ });
45
+ }
46
+ }
@@ -0,0 +1,25 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { CUCMS_TO_IGNORE, CUCS_TO_IGNORE } from './app.constants';
3
+
4
+ @Injectable()
5
+ export class RemoveKynFromIBMService {
6
+ constructor() {
7
+ }
8
+
9
+
10
+ removeCUCMS(date: any, customerId: number) {
11
+ if (customerId === 8) {
12
+ return date.filter((val: any) => !CUCMS_TO_IGNORE.includes(Math.round(val.cucmId)));
13
+ }
14
+ return date;
15
+ }
16
+
17
+ removeCUCS(date: any, customerId: number) {
18
+ if (customerId === 8) {
19
+ return date.filter((val: any) => !CUCS_TO_IGNORE.includes(Math.round(val.cucId)));
20
+ }
21
+ return date;
22
+ }
23
+
24
+
25
+ }
@@ -0,0 +1,90 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { HttpClient, HttpHeaders } from '@angular/common/http';
3
+ import { TableDataInterface } from '../classes/table-data';
4
+ import { Observable } from 'rxjs';
5
+
6
+
7
+
8
+ @Injectable()
9
+ export class APIService {
10
+ public token: any;
11
+ apiUrl = window.location.protocol + '//' + window.location.hostname + '/dcp';
12
+
13
+ constructor(
14
+ private httpClient: HttpClient
15
+ ) {
16
+ }
17
+
18
+ fetch(url: string, params?: any, cache?: boolean) {
19
+ const headers = this.getHeaders(cache);
20
+ params = params || {};
21
+ return this.httpClient.get(this.apiUrl + url, {params: this.prepareEncodedParams(params), headers});
22
+ }
23
+
24
+ post(url: string, body: any, params = {}): any {
25
+ body = body || null;
26
+ const headers = this.getHeaders();
27
+ return this.httpClient.post(this.apiUrl + url, body, {params: this.prepareEncodedParams(params), headers});
28
+ }
29
+
30
+ // use when response extended data is necessary:
31
+ postExtended(url: string, body = null, params = {}, headers = {}) {
32
+ headers = headers || this.getHeaders();
33
+ return this.httpClient.post(this.apiUrl + url, body, {
34
+ headers,
35
+ observe: 'response',
36
+ params: this.prepareEncodedParams(params)
37
+ });
38
+ }
39
+
40
+ put(url: string, body = null, params = {}) {
41
+ const headers = this.getHeaders();
42
+ return this.httpClient.put(this.apiUrl + url, body, {headers, params: this.prepareEncodedParams(params)});
43
+ }
44
+
45
+ delete(url: string, params = {}) {
46
+ const headers = this.getHeaders();
47
+ return this.httpClient.delete(this.apiUrl + url, {headers, params: this.prepareEncodedParams(params)});
48
+ }
49
+
50
+ fetchPagination(url: string, pageSize: number, pageNumber: number, additionalParams = {}, cache?: boolean): Observable<TableDataInterface> {
51
+ const copyAdditionalParams = JSON.parse(JSON.stringify(additionalParams));
52
+ const params = Object.assign(copyAdditionalParams, {size: pageSize.toString(), page: pageNumber.toString()});
53
+ return this.fetch(url, params, cache) as Observable<TableDataInterface>;
54
+ }
55
+
56
+ private prepareEncodedParams(params: any) {
57
+ const result: any = {};
58
+
59
+ if (!params) {
60
+ return {};
61
+ }
62
+ for (const key of Object.keys(params)) {
63
+ if (params[key]) {
64
+ const stringParam = params[key].toString();
65
+ result[key] = stringParam.includes('+') ? encodeURIComponent(stringParam) : stringParam;
66
+ }
67
+ }
68
+ return result;
69
+ }
70
+
71
+ private getHeaders(cache?: boolean): HttpHeaders {
72
+ let headers = new HttpHeaders();
73
+ if (cache) {
74
+ headers = headers.append('_Cache', 'true ');
75
+ }
76
+ const token = this.token || this.getParameterByName('token');
77
+ headers = headers.append('Authorization', 'Bearer '+ token);
78
+ return headers;
79
+ }
80
+
81
+ private getParameterByName(name: any, url = window.location.href) {
82
+ name = name.replace(/[\[\]]/g, '\\$&');
83
+ var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
84
+ results = regex.exec(url);
85
+ if (!results) return null;
86
+ if (!results[2]) return '';
87
+ return decodeURIComponent(results[2].replace(/\+/g, ' '));
88
+ }
89
+
90
+ }
@@ -0,0 +1,68 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { Notification } from '../classes/notification';
3
+ import { Subject } from 'rxjs';
4
+ const SUCCESS_TIME = 5000;
5
+ const INACTIVE_SESSION_MESSAGE = 'Your session was lost due to inactivity. Please login again';
6
+ const INACTIVE_SESSION = 'SESSION_INACTIVE';
7
+
8
+ @Injectable()
9
+ export class NotificationService {
10
+
11
+ public listChange = new Subject();
12
+
13
+ private max = 0;
14
+ private list: Notification[] = [];
15
+
16
+ constructor(
17
+ ) {
18
+ }
19
+
20
+ error(message: string, ttl?: number): void {
21
+ this.notify('error', message, ttl);
22
+ }
23
+
24
+ success(message: string, ttl?: number): void {
25
+ this.notify('success', message, (!ttl) ? SUCCESS_TIME : ttl);
26
+ }
27
+
28
+ warning(message: string, ttl?: number): void {
29
+ this.notify('warning', message, ttl);
30
+ }
31
+
32
+ info(message: string, ttl?: number): void {
33
+ this.notify('info', message, ttl);
34
+ }
35
+ private notify(type: string, message: string, ttl?: number): void {
36
+ const found = this.list.find((n: Notification) => n.message === message);
37
+ if (found) {
38
+ this.remove(found);
39
+ }
40
+ const notification = new Notification({
41
+ id: ++this.max,
42
+ type, message, ttl
43
+ });
44
+ if (notification.ttl > 0) {
45
+ notification.timerId = setTimeout(() => this.remove(notification, true), notification.ttl);
46
+ }
47
+ this.list.push(notification);
48
+ this.listChange.next(this.list);
49
+ }
50
+
51
+ remove(notification: Notification, auto?: boolean): void {
52
+ if (!auto && notification.timerId) {
53
+ // clear timeout in case of manual remove
54
+ clearInterval(notification.timerId);
55
+ }
56
+ this.list = this.list.filter(n => n.id !== notification.id);
57
+ this.listChange.next(this.list);
58
+ }
59
+
60
+ private removeInactiveSessionError(): void {
61
+ if (!this.list || !this.list.length) {
62
+ return;
63
+ }
64
+ this.list = this.list.filter(n => n.message !== INACTIVE_SESSION_MESSAGE && n.message !== INACTIVE_SESSION);
65
+ this.listChange.next(this.list);
66
+ }
67
+
68
+ }
@@ -0,0 +1,25 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { CUCMS_TO_IGNORE, CUCS_TO_IGNORE } from '../app.constants';
3
+
4
+ @Injectable()
5
+ export class RemoveKynFromIBMService {
6
+ constructor() {
7
+ }
8
+
9
+
10
+ removeCUCMS(date: any, customerId: number) {
11
+ if (customerId === 8) {
12
+ return date.filter((val: any) => !CUCMS_TO_IGNORE.includes(Math.round(val.cucmId)));
13
+ }
14
+ return date;
15
+ }
16
+
17
+ removeCUCS(date: any, customerId: number) {
18
+ if (customerId === 8) {
19
+ return date.filter((val: any) => !CUCS_TO_IGNORE.includes(Math.round(val.cucId)));
20
+ }
21
+ return date;
22
+ }
23
+
24
+
25
+ }
@@ -0,0 +1,35 @@
1
+ import { Injectable, OnInit } from '@angular/core';
2
+ import { APIService } from './api.service';
3
+ import { API } from '../app.constants';
4
+ import { Observable } from 'rxjs';
5
+ import { map } from 'rxjs/operators';
6
+ const urlMap = {
7
+ locations: API.LOCATION,
8
+ userLocales: API.USER_LOCALES,
9
+ userProfiles: API.USER_PROFILES
10
+ }
11
+
12
+ @Injectable()
13
+ export class SiteSettingsService {
14
+
15
+ constructor(
16
+ private apiService: APIService
17
+ ) {
18
+
19
+ }
20
+ public getSelectionOptions(siteId: number, token: string): any {
21
+ if(!siteId) {
22
+ return;
23
+ }
24
+ // @ts-ignore
25
+ const URL = urlMap[token];
26
+ return this.apiService.fetch(URL.replace(':siteId', String(siteId)), null, true)
27
+ // @ts-ignore
28
+ .pipe(map((options: string[]) => {
29
+ // @ts-ignore
30
+ this[token] = options ? options.sort() : [];
31
+ // @ts-ignore
32
+ return this[token];
33
+ }))
34
+ }
35
+ }
@@ -0,0 +1,120 @@
1
+ import {Injectable, OnInit} from '@angular/core';
2
+ import { Observable, of, forkJoin } from 'rxjs';
3
+ import { SimplifiedUser } from '../classes/simplified-user';
4
+ import { API } from '../app.constants';
5
+ import { APIService } from './api.service';
6
+ import { map } from 'rxjs/operators';
7
+ import { UtilsService } from './utils.service';
8
+
9
+ @Injectable()
10
+ export class UserService implements OnInit{
11
+ siteId: number = -1;
12
+ userId: string = '';
13
+ userIdExistPending = false;
14
+ hasExistedUserId = false;
15
+ user!: SimplifiedUser;
16
+ originUser!: SimplifiedUser;
17
+
18
+ constructor(
19
+ private apiService: APIService
20
+ ) {
21
+
22
+ }
23
+
24
+ ngOnInit(): void {
25
+ console.log(this.siteId)
26
+ }
27
+
28
+ public fetchUserToken(siteId: number, userId: string): any {
29
+ if (this.siteId === siteId && this.userId === userId && this.user) {
30
+ return of(this.user);
31
+ }
32
+ this.siteId = siteId;
33
+ this.userId = userId;
34
+ return this.apiService.fetch(API.USER_TOKEN.replace(':siteId', String(this.siteId)).replace(':userId', encodeURIComponent(encodeURIComponent(userId))))
35
+ .pipe(map((result: any) => {
36
+ this.setSimplifiedUser(Object.values(result)[0]);
37
+ }))
38
+ // .pipe(this.handleError(false, true));
39
+ }
40
+
41
+ public updateUserFields(body: any): any {
42
+ if (!this.userId || !this.siteId || !this.user?.token) {
43
+ return;
44
+ }
45
+ return this.apiService.post(API.UPDATE_USER_FIELDS.replace(':siteId', String(this.siteId)).replace(':token', this.user.token), body)
46
+ // .pipe(this.handleError(false, true));
47
+ }
48
+
49
+ public fetchUserById(id: string) {
50
+ this.userIdExistPending = true;
51
+ return this.apiService.fetch(API.USER_BY_ID.replace(':siteId', String(this.siteId)).replace(':userId', encodeURIComponent(encodeURIComponent(id))))
52
+ .pipe(map(result => {
53
+ this.userIdExistPending = false;
54
+ return result;
55
+ }));
56
+ }
57
+
58
+ public persistCacheChanges() {
59
+ const params = {
60
+ excludeDeviceExtraOptions: true
61
+ };
62
+ return this.processUserChangesToCache()
63
+ .pipe(map((result: any) => {
64
+ return this.apiService.post(API.PERSIST_USER_CACHE.replace(':siteId', String(this.siteId)).replace(':token', this.user.token), {}, params)
65
+ .subscribe(() => {
66
+
67
+ })
68
+ // .pipe(map((user) => {
69
+ // // this.setUser(user, false, this.user.token);
70
+ // this.user.hasModifiedCache = false;
71
+ // }))
72
+ // .pipe(this.handleError(true, true));
73
+ }));
74
+ }
75
+
76
+ public processUserChangesToCache(): any {
77
+ const calls = [];
78
+ const body = UtilsService.diff(this.originUser.getSavableData(), this.user.getSavableData(), 'user');
79
+ if (body) {
80
+ calls.push(this.updateUserFields(body));
81
+ }
82
+ if (!calls?.length) {
83
+ return of(this.user);
84
+ }
85
+
86
+ return forkJoin(calls)
87
+ .pipe(map((responses: any) => {
88
+ // ApiUserResponse
89
+ this.handleSaveUserResponse(responses);
90
+ }))
91
+ // .pipe(this.handleError(false, true));
92
+
93
+ }
94
+
95
+ public hasUnsavedChanges() {
96
+ if (this.user && this.originUser) {
97
+ return !this.user.equal(this.originUser);
98
+ }
99
+ return false;
100
+ }
101
+
102
+ public setSimplifiedUser(user: any): void {
103
+ this.user = new SimplifiedUser(user);
104
+ const copiedUser = JSON.parse(JSON.stringify(user));
105
+ this.originUser = new SimplifiedUser(copiedUser);
106
+ }
107
+
108
+ private handleSaveUserResponse(responses: any) {
109
+ if (!responses?.length) {
110
+ return;
111
+ }
112
+ for (let len = responses.length, i = len - 1; i >= 0; i--) {
113
+ if (responses[i] && responses[i].currentUpdatedUser) {
114
+ // this.setUser(responses[i].currentUpdatedUser, false, this.user.token);
115
+ this.user.hasModifiedCache = true;
116
+ return;
117
+ }
118
+ }
119
+ }
120
+ }
@@ -0,0 +1,58 @@
1
+ import { Injectable, OnInit } from '@angular/core';
2
+ import { SimplifiedUser } from '../classes/simplified-user';
3
+ import { APIService } from './api.service';
4
+ import { ListUser, ListUserInterface } from '../classes/user-list';
5
+ import { BehaviorSubject, Observable } from 'rxjs';
6
+ import { API, PAGINATION_DEFAULTS, PAGINATION_SIZE_OPTIONS } from '../app.constants';
7
+ import { TableDataInterface } from '../classes/table-data';
8
+ import { map } from 'rxjs/operators';
9
+ import { RemoveKynFromIBMService } from '../removeKynFromIBM.service';
10
+ import { PaginationDataDto } from '../classes/pagination';
11
+
12
+
13
+
14
+ @Injectable()
15
+ export class UsersSearchService {
16
+ siteId: number = -1;
17
+ userId: string = '';
18
+ customerId!: number;
19
+ userIdExistPending = false;
20
+ hasExistedUserId = false;
21
+ pageSize = PAGINATION_DEFAULTS.SIZE;
22
+ pageIndex = PAGINATION_DEFAULTS.SIZE;
23
+ pageSizeOptions = PAGINATION_SIZE_OPTIONS;
24
+ total!: number;
25
+ searchParams!: any;
26
+ foundUsers$!: any;
27
+
28
+ constructor(
29
+ private apiService: APIService,
30
+ private removeKynFromIBMService: RemoveKynFromIBMService
31
+ ) {
32
+ this.foundUsers$ = new BehaviorSubject(null);
33
+
34
+ }
35
+
36
+ public getPagination(): PaginationDataDto {
37
+ return {
38
+ total: this.total,
39
+ pageSizeOptions: this.pageSizeOptions,
40
+ pageSize: this.pageSize,
41
+ pageIndex: this.pageIndex
42
+ };
43
+ }
44
+
45
+ public quickRegularUsersSearch() {
46
+ this.searchParams = this.searchParams || {customerid: this.customerId};
47
+ return this.apiService.fetchPagination(API.QUICK_USERS_SEARCH, this.pageSize, this.pageIndex, this.searchParams)
48
+ .pipe(map((res: TableDataInterface) => {
49
+ this.total = res.total;
50
+ // this.totals = this.totals || {};
51
+ // this.totals['users'] = res.total;
52
+ const users = res.pageData && res.pageData.length ? res.pageData.map(user => new ListUser(user)) : [];
53
+ // this.foundUsers$.next(this.removeKynFromIBMService.removeCUCMS(users, this.customerId));
54
+ this.foundUsers$.next(users);
55
+ }));
56
+ // .pipe(this.handleError(true));
57
+ }
58
+ }
@@ -0,0 +1,71 @@
1
+ import { Injectable } from '@angular/core';
2
+
3
+ @Injectable()
4
+ export class UtilsService {
5
+
6
+ static sortSortArrayByProperty(array: [], sortBy: string) {
7
+ if (!array) {
8
+ return null;
9
+ }
10
+ return array.sort((a, b) => {
11
+ if (!a[sortBy] && !b[sortBy]) {
12
+ return 0;
13
+ }
14
+ if (a[sortBy] && !b[sortBy]) {
15
+ return 1;
16
+ }
17
+ if (!a[sortBy] && b[sortBy]) {
18
+ return -1;
19
+ }
20
+ const positionA = a[sortBy];
21
+ const positionB = b[sortBy];
22
+ return (positionA < positionB) ? -1 : (positionA > positionB) ? 1 : 0;
23
+ });
24
+ }
25
+
26
+ static diff(origObject: any, updatedObj: any, path: string, keysToIgnore?: string[]) {
27
+ let result: any = [];
28
+ if (Object.is(origObject, updatedObj)) {
29
+ return undefined;
30
+ }
31
+ if (!updatedObj || typeof updatedObj !== 'object') {
32
+ return updatedObj;
33
+ }
34
+ const concat = Array.from(new Set([...Object.keys(origObject || {}), ...Object.keys(updatedObj || {})]));
35
+ const filter = keysToIgnore ? concat.filter(key => !keysToIgnore.includes(key)) : concat;
36
+ filter
37
+ .forEach(key => {
38
+ if (typeof updatedObj[key] === 'object' && typeof origObject[key] === 'object') {
39
+ if (UtilsService.differs(updatedObj[key], origObject[key])) {
40
+ const newPath = `${path}${path ? '.' : ''}${key}`;
41
+ const values = UtilsService.diff(origObject[key], updatedObj[key], newPath, keysToIgnore);
42
+ if (values !== undefined) {
43
+ result = [...result, ...values];
44
+ }
45
+ }
46
+ } else if (updatedObj && !origObject || updatedObj[key] !== origObject[key] && !Object.is(origObject[key], updatedObj[key])) {
47
+ const value = updatedObj ? UtilsService.formatIfEmpty(updatedObj[key]) : null;
48
+ result.push(`${path}${path ? '.' : ''}${key}=${value}`);
49
+ }
50
+ });
51
+ return result;
52
+ }
53
+
54
+ static formatIfEmpty(value: any) {
55
+ if (value) {
56
+ return value;
57
+ }
58
+ switch (typeof value) {
59
+ case 'boolean':
60
+ return value;
61
+ case 'string':
62
+ return '';
63
+ default:
64
+ return null;
65
+ }
66
+ }
67
+
68
+ static differs(obj1: any, obj2: any): boolean {
69
+ return JSON.stringify(obj1) !== JSON.stringify(obj2);
70
+ }
71
+ }
@@ -0,0 +1,90 @@
1
+ //@import url( 'https://fonts.googleapis.com/css?family=Roboto:400,700|Material+Icons');
2
+ //@import url('https://fonts.googleapis.com/css?family=Raleway:400,100,200,300,500,600,800,700,900');
3
+ @import url('https://fonts.googleapis.com/css?family=Poppins:400,100,200,300,500,600,800,700,900');
4
+ //@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400&display=swap');
5
+
6
+ $fa-font-path : '../../node_modules/font-awesome/fonts';
7
+
8
+ //$common-font: Raleway, 'Raleway', sans-serif;
9
+ //$special-font: Raleway, 'Roboto', sans-serif;
10
+ //$content-font: 'Roboto', sans-serif;
11
+ //$buttons-font: Raleway, 'Raleway', sans-serif;
12
+ //$input-font: 'Roboto', sans-serif;
13
+ $menu-font: Poppins, 'Poppins', sans-serif;
14
+ $main-font: Poppins, 'Poppins', sans-serif;
15
+ //$sub-menu-font: Inter, 'Inter', sans-serif;
16
+ $font-size: 14px;
17
+ $txt-color: rgba(0, 0, 0, 0.87);
18
+ $table-title-color: rgba(0,0,0,.54);;
19
+ $txt-grey-color: #454e5e;
20
+ $header-gradient: linear-gradient(90deg,#0d56aa,#0d56ab);
21
+ $poppins-font: Poppins, 'Poppins', sans-serif;
22
+
23
+ $icon-color: #8E9FB7;
24
+ $active-color: #0D56AA;
25
+ $icon-box-color: #0773BC;
26
+ $mark-color: #009FDB;
27
+ $hover-color: #0985A0;
28
+ $error-color: #C73636;
29
+ $main-txt-color: #333;
30
+
31
+ $table-border-color: rgba(0, 0, 0, 0.12);
32
+ $input-border-color: rgba(0, 0, 0, 0.30);
33
+ $bg-color: #F7F9FB;
34
+
35
+ $error-bg-color: #f2dede;
36
+ $error-border-color: #ebccd1;
37
+ $error-txt-color: #bc1e1b;
38
+ $qob-error-color: #E70707;
39
+
40
+ $warning-bg-color: #fcf8e3;
41
+ $warning-border-color: #e5e1cd;
42
+ $warning-txt-color: #8a6d3b;
43
+
44
+ $success-bg-color: #e3f4dc;
45
+ $success-border-color: #b3d692;
46
+ $success-txt-color: #3c763d;
47
+
48
+ $read-only-txt-color: rgba(0, 0, 0, 0.38);
49
+ $my-menu-txt-color: #555555;
50
+
51
+ $page-background-color: #F3F6F6;
52
+ $disabled-button-text-color: #BABCC5;
53
+ $dark-elements-color: #2C355D;
54
+ $dark-disabled-btn-color: #DFE3E7;
55
+ $disabled-color: #DFE3E7;
56
+ $link-color: #0985A0;
57
+ $title-color: #0985A0;
58
+ $active-link-color: #0985A0;
59
+ $text-color: #646464;
60
+ $light-border-color: #DEE5EA;
61
+ $icon-background: #D2E5E5;
62
+
63
+ // QOB style
64
+ $navy: #2399DA;
65
+ $dark-blue: #2C355D;
66
+ $qob-danger-color: #E70707;
67
+ $qob-disabled-color: #D4D4D4;
68
+
69
+ // WEBEX STYLE
70
+
71
+ $webex-body-bg: #f7f7f7;
72
+
73
+
74
+ $webex-icon-bg: #d0d0d0;
75
+ $webex-icon-color: #2a2a2a;
76
+ $webex-text-color: #252525;
77
+
78
+ $webex-tr-hover-bg: #ededed;
79
+ $webex-tr-border: #dedede;
80
+
81
+ $webex-table-th-bg: #f7f7f7;
82
+ $webex-table-th-txt: #636363;
83
+ $webex-table-th-size: 12px;
84
+
85
+ $webex-table-td-bg: #fff;
86
+ $webex-table-td-txt: #636363;
87
+ $webex-table-td-size: 14px;
88
+
89
+ $webex-pagination-txt: #636363;
90
+ $webex-pagination-hover-bg: #ededed;