From 4d1a27081ea332b143da03e048e88cd43208d9ef Mon Sep 17 00:00:00 2001 From: Vishali Sakar <46264876+vishalisakar@users.noreply.github.com> Date: Wed, 16 Feb 2022 12:50:56 +0530 Subject: [PATCH 1/8] fix: block and unblock fixes (#115) (#116) Co-authored-by: Vishali Sakar Co-authored-by: Vishali Sakar --- .../routes/users-view/users-view.component.ts | 76 +++++++++++++------ .../routes/users/services/users.service.ts | 33 ++++++++ src/app/services/loader.service.ts | 15 ++++ 3 files changed, 102 insertions(+), 22 deletions(-) create mode 100644 src/app/services/loader.service.ts diff --git a/project/ws/app/src/lib/routes/home/routes/users-view/users-view.component.ts b/project/ws/app/src/lib/routes/home/routes/users-view/users-view.component.ts index 4e53faa40..e5451777d 100644 --- a/project/ws/app/src/lib/routes/home/routes/users-view/users-view.component.ts +++ b/project/ws/app/src/lib/routes/home/routes/users-view/users-view.component.ts @@ -12,11 +12,13 @@ import { MatSnackBar } from '@angular/material' import { EventService } from '@sunbird-cb/utils' import { NsContent } from '@sunbird-cb/collection' import { TelemetryEvents } from '../../../../head/_services/telemetry.event.model' +import { LoaderService } from '../../../../../../../../../src/app/services/loader.service' @Component({ selector: 'ws-app-users-view', templateUrl: './users-view.component.html', styleUrls: ['./users-view.component.scss'], + providers: [LoaderService], /* tslint:disable */ host: { class: 'flex flex-1 margin-top-l' }, /* tslint:enable */ @@ -61,6 +63,7 @@ export class UsersViewComponent implements OnInit, OnDestroy { private router: Router, private snackBar: MatSnackBar, private events: EventService, + private loaderService: LoaderService, // private telemetrySvc: TelemetryService, // private configSvc: ConfigurationsService, // private discussService: DiscussService, @@ -72,8 +75,9 @@ export class UsersViewComponent implements OnInit, OnDestroy { this.Math = Math this.configSvc = this.route.parent && this.route.parent.snapshot.data.configService this.currentUser = this.configSvc.userProfile && this.configSvc.userProfile.userId - this.usersData = _.get(this.route, 'snapshot.data.usersList.data') || {} - this.filterData() + // console.log(_.get(this.route, 'snapshot.data.usersList.data')) + // this.usersData = _.get(this.route, 'snapshot.data.usersList.data') || {} + // this.filterData() } // decideAPICall() { @@ -84,7 +88,7 @@ export class UsersViewComponent implements OnInit, OnDestroy { } } ngOnInit() { - + this.getAllUsers() } filter(filter: string) { @@ -109,6 +113,7 @@ export class UsersViewComponent implements OnInit, OnDestroy { } get dataForTable() { + switch (this.currentFilter) { case 'active': return this.activeUsersData @@ -126,6 +131,7 @@ export class UsersViewComponent implements OnInit, OnDestroy { this.inactiveUsersData = this.inActiveUsers } get activeUsers() { + this.loaderService.changeLoad.next(true) const activeUsersData: any[] = [] if (this.usersData && this.usersData.content && this.usersData.content.length > 0) { _.filter(this.usersData.content, { isDeleted: false }).forEach((user: any) => { @@ -145,6 +151,7 @@ export class UsersViewComponent implements OnInit, OnDestroy { return activeUsersData } get inActiveUsers() { + this.loaderService.changeLoad.next(true) const inactiveUsersData: any[] = [] if (this.usersData && this.usersData.content && this.usersData.content.length > 0) { _.filter(this.usersData.content, { isDeleted: true }).forEach((user: any) => { @@ -183,16 +190,23 @@ export class UsersViewComponent implements OnInit, OnDestroy { } getAllUsers() { - const filterObj = { - request: { - query: '', - filters: { - rootOrgId: this.configSvc, - }, - }, - } - this.usersService.getAllUsers(filterObj).subscribe(data => { - this.usersData = data + this.loaderService.changeLoad.next(true) + const rootOrgId = _.get(this.route.snapshot.parent, 'data.configService.unMappedUser.rootOrg.rootOrgId') + // const filterObj = { + // request: { + // query: '', + // filters: { + // rootOrgId: this.configSvc, + // }, + // }, + // } + // this.usersService.getAllUsers(filterObj).subscribe(data => { + // console.log(data) + // this.usersData = data + // this.filterData() + // }) + this.usersService.getAllKongUsers(rootOrgId).subscribe(data => { + this.usersData = data.result.response this.filterData() }) } @@ -223,6 +237,8 @@ export class UsersViewComponent implements OnInit, OnDestroy { ) } menuActions($event: { action: string, row: any }) { + this.loaderService.changeLoad.next(true) + const loggedInUserId = _.get(this.route, 'snapshot.parent.data.configService.userProfile.userId') // const user = { userId: _.get($event.row, 'userId') } // _.set(user, 'deptId', _.get(_.first(_.filter(this.usersData.content, { id: user.userId })), 'rootOrgId')) // _.set(user, 'isBlocked', _.get($event.row, 'blocked')) @@ -246,7 +262,7 @@ export class UsersViewComponent implements OnInit, OnDestroy { this.usersService.blockUser(user).subscribe(response => { if (response) { this.getAllUsers() - this.snackBar.open('Updated successfully !') + this.snackBar.open(response.result.response) } }) break @@ -263,10 +279,19 @@ export class UsersViewComponent implements OnInit, OnDestroy { case 'deactive': // _.set(user, 'isDeleted', true) // _.set(user, 'roles', _.map(_.get($event.row, 'role'), i => i)) - this.usersService.deActiveUser(user).subscribe(response => { - if (response) { - this.getAllUsers() - this.snackBar.open('Updated successfully !') + // this.usersService.deActiveUser(user).subscribe(response => { + this.usersService.newBlockUser(loggedInUserId, user.request.userId).subscribe(response => { + if (response.params.status === 'success') { + setTimeout(() => { + this.getAllUsers() + + this.snackBar.open('Deactivated successfully!') + }, 1500) + // this.changeDetectorRefs.detectChanges() + } + else { + this.loaderService.changeLoad.next(false) + this.snackBar.open('Update unsuccess!') } }, // tslint:disable-next-line:align @@ -283,10 +308,17 @@ export class UsersViewComponent implements OnInit, OnDestroy { _.set(user, 'isDeleted', false) } _.set(user, 'roles', _.map(_.get($event.row, 'role'), i => i)) - this.usersService.deActiveUser(user).subscribe(response => { - if (response) { - this.getAllUsers() - this.snackBar.open('Updated successfully !') + // this.usersService.deActiveUser(user).subscribe(response => { + this.usersService.newUnBlockUser(loggedInUserId, user.request.userId).subscribe(response => { + if (response.params.status === 'success') { + setTimeout(() => { + this.getAllUsers() + this.snackBar.open('Activated successfully!') + + }, 1500) + } else { + this.loaderService.changeLoad.next(false) + this.snackBar.open('Update unsuccess!') } }) break diff --git a/project/ws/app/src/lib/routes/users/services/users.service.ts b/project/ws/app/src/lib/routes/users/services/users.service.ts index ba875e3ab..a38423635 100644 --- a/project/ws/app/src/lib/routes/users/services/users.service.ts +++ b/project/ws/app/src/lib/routes/users/services/users.service.ts @@ -21,6 +21,9 @@ const API_END_POINTS = { USER_BDD: '/apis/protected/v8/portal/mdo/deptAction/userrole', ACTIVE_USER: 'apis/proxies/v8/user/v1/unblock', DE_ACTIVE_USER: 'apis/proxies/v8/user/v1/block', + NEW_USER_BLOCK_API: '/apis/proxies/v8/user/v1/block', + NEW_USER_UN_BLOCK_API: '/apis/proxies/v8/user/v1/unblock' + // GET_BULKUPLOAD_DATA: '/apis/protected/v8/admin/userRegistration/bulkUploadData', } @@ -84,4 +87,34 @@ export class UsersService { // getBulkUploadData(): Observable { // return this.http.get(`${API_END_POINTS.GET_BULKUPLOAD_DATA}`) // } + + newBlockUser(loggedInUser: string, userId: string): Observable { + const org = { + request: { + userId, + requestedBy: loggedInUser, + }, + } + return this.http.post(`${API_END_POINTS.NEW_USER_BLOCK_API}`, org) + } + newUnBlockUser(loggedInUser: string, userId: string): Observable { + const org = { + request: { + userId, + requestedBy: loggedInUser, + }, + } + return this.http.post(`${API_END_POINTS.NEW_USER_UN_BLOCK_API}`, org) + } + + getAllKongUsers(depId: string): Observable { + const reqBody = { + request: { + filters: { + rootOrgId: depId, + }, + }, + } + return this.http.post(`${API_END_POINTS.GET_ALL_USERS}`, reqBody) + } } diff --git a/src/app/services/loader.service.ts b/src/app/services/loader.service.ts new file mode 100644 index 000000000..58154cdad --- /dev/null +++ b/src/app/services/loader.service.ts @@ -0,0 +1,15 @@ +import { BehaviorSubject } from 'rxjs' +import { Injectable } from '@angular/core' + +@Injectable() +export class LoaderService { + changeLoad = new BehaviorSubject(false) + + private doubleBack = new BehaviorSubject(false) + currentState = this.doubleBack.asObservable() + + changeLoadState(state: boolean) { + this.doubleBack.next(state) + } + +} From 55f3d1403e9507fc4819ba4f519f3c80fae1377a Mon Sep 17 00:00:00 2001 From: Amit Sengar Date: Thu, 12 May 2022 17:16:15 +0530 Subject: [PATCH 2/8] Dev (#118) * fix: block and unblock fixes (#115) Co-authored-by: Vishali Sakar * login Fix #1 Co-authored-by: Vishali Sakar <46264876+vishalisakar@users.noreply.github.com> Co-authored-by: Vishali Sakar --- .../routes/users-view/users-view.component.ts | 9 ++++---- .../routes/users/services/users.service.ts | 2 +- src/app/component/root/root.component.ts | 23 +++++++++++++++---- src/app/services/app-interceptor.service.ts | 23 +++++++++++++++---- 4 files changed, 43 insertions(+), 14 deletions(-) diff --git a/project/ws/app/src/lib/routes/home/routes/users-view/users-view.component.ts b/project/ws/app/src/lib/routes/home/routes/users-view/users-view.component.ts index e5451777d..7628611dd 100644 --- a/project/ws/app/src/lib/routes/home/routes/users-view/users-view.component.ts +++ b/project/ws/app/src/lib/routes/home/routes/users-view/users-view.component.ts @@ -286,10 +286,11 @@ export class UsersViewComponent implements OnInit, OnDestroy { this.getAllUsers() this.snackBar.open('Deactivated successfully!') - }, 1500) + }, + // tslint:disable-next-line: align + 1500) // this.changeDetectorRefs.detectChanges() - } - else { + } else { this.loaderService.changeLoad.next(false) this.snackBar.open('Update unsuccess!') } @@ -314,7 +315,7 @@ export class UsersViewComponent implements OnInit, OnDestroy { setTimeout(() => { this.getAllUsers() this.snackBar.open('Activated successfully!') - + // tslint:disable-next-line: align }, 1500) } else { this.loaderService.changeLoad.next(false) diff --git a/project/ws/app/src/lib/routes/users/services/users.service.ts b/project/ws/app/src/lib/routes/users/services/users.service.ts index a38423635..669253889 100644 --- a/project/ws/app/src/lib/routes/users/services/users.service.ts +++ b/project/ws/app/src/lib/routes/users/services/users.service.ts @@ -22,7 +22,7 @@ const API_END_POINTS = { ACTIVE_USER: 'apis/proxies/v8/user/v1/unblock', DE_ACTIVE_USER: 'apis/proxies/v8/user/v1/block', NEW_USER_BLOCK_API: '/apis/proxies/v8/user/v1/block', - NEW_USER_UN_BLOCK_API: '/apis/proxies/v8/user/v1/unblock' + NEW_USER_UN_BLOCK_API: '/apis/proxies/v8/user/v1/unblock', // GET_BULKUPLOAD_DATA: '/apis/protected/v8/admin/userRegistration/bulkUploadData', } diff --git a/src/app/component/root/root.component.ts b/src/app/component/root/root.component.ts index 7b1b8032d..252d58621 100644 --- a/src/app/component/root/root.component.ts +++ b/src/app/component/root/root.component.ts @@ -7,6 +7,7 @@ import { ViewChild, ViewContainerRef, ApplicationRef, + HostListener, } from '@angular/core' import { ActivatedRoute, @@ -29,6 +30,7 @@ import { UtilityService, EventService, WsEvents, + AuthKeycloakService, } from '@sunbird-cb/utils' import { delay, first } from 'rxjs/operators' import { MobileAppsService } from '../../services/mobile-apps.service' @@ -81,10 +83,25 @@ export class RootComponent implements OnInit, AfterViewInit { private changeDetector: ChangeDetectorRef, private utilitySvc: UtilityService, private eventSvc: EventService, + public authSvc: AuthKeycloakService, ) { this.mobileAppsSvc.init() } - + private get defaultRedirectUrl(): string { + try { + const baseUrl = document.baseURI + return baseUrl || location.origin + } catch (error) { + return location.origin + } + } + @HostListener('window:unload', ['$event']) + unloadHandler(event: any) { + if (event && event.type === 'unload') { + this.authSvc.logout() + window.location.href = `${this.defaultRedirectUrl}apis/reset` + } + } ngOnInit() { try { this.isInIframe = window.self !== window.top @@ -93,10 +110,6 @@ export class RootComponent implements OnInit, AfterViewInit { } this.btnBackSvc.initialize() - - - - // Application start telemetry // if (this.authSvc.isAuthenticated) { // this.telemetrySvc.start('app', 'view', '') diff --git a/src/app/services/app-interceptor.service.ts b/src/app/services/app-interceptor.service.ts index 5d8d6243d..5b982a477 100644 --- a/src/app/services/app-interceptor.service.ts +++ b/src/app/services/app-interceptor.service.ts @@ -1,8 +1,9 @@ import { Injectable, LOCALE_ID, Inject } from '@angular/core' import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent, HttpErrorResponse } from '@angular/common/http' import { Observable, throwError } from 'rxjs' -import { ConfigurationsService } from '@sunbird-cb/utils' +import { ConfigurationsService, AuthKeycloakService } from '@sunbird-cb/utils' import { catchError } from 'rxjs/operators' +import { MatSnackBar } from '@angular/material' @Injectable({ providedIn: 'root', @@ -10,6 +11,8 @@ import { catchError } from 'rxjs/operators' export class AppInterceptorService implements HttpInterceptor { constructor( private configSvc: ConfigurationsService, + private snackBar: MatSnackBar, + private authSvc: AuthKeycloakService, @Inject(LOCALE_ID) private locale: string, ) { } intercept(req: HttpRequest, next: HttpHandler): Observable> { @@ -41,16 +44,28 @@ export class AppInterceptorService implements HttpInterceptor { return next.handle(modifiedReq).pipe( catchError(error => { if (error instanceof HttpErrorResponse) { + const localUrl = location.origin + const pagePath = location.href || `${localUrl}/app/home/welcome` + const pageName = (location.href || '').replace(localUrl, '') switch (error.status) { + case 0: + if (localUrl.includes('localhost')) { + this.snackBar.open('Please login Again and Apply new TOKEN', undefined, { duration: 100 * 3 }) + } + this.authSvc.logout() + break + case 200: + if (!error.ok && error.url) { + window.location.href = error.url + } + break case 419: // login - const localUrl = location.origin - const pageName = '/app/home/welcome' if (localStorage.getItem('telemetrySessionId')) { localStorage.removeItem('telemetrySessionId') } if (localUrl.includes('localhost')) { // tslint:disable-next-line: prefer-template - window.location.href = error.error.redirectUrl + `?q=${localUrl}${pageName}` + window.location.href = error.error.redirectUrl + `?q=${pagePath}` } else { // tslint:disable-next-line: prefer-template window.location.href = error.error.redirectUrl + `?q=${pageName}` From 8c1d2f9b4135eef9095dedc35e587a5abc3fa80f Mon Sep 17 00:00:00 2001 From: Amit Sengar Date: Thu, 12 May 2022 17:19:45 +0530 Subject: [PATCH 3/8] Cbrelease 3.0.1 (#120) * fix: block and unblock fixes (#115) (#116) (#117) Co-authored-by: Vishali Sakar Co-authored-by: Vishali Sakar Co-authored-by: Vishali Sakar * Dev (#118) * fix: block and unblock fixes (#115) Co-authored-by: Vishali Sakar * login Fix #1 Co-authored-by: Vishali Sakar <46264876+vishalisakar@users.noreply.github.com> Co-authored-by: Vishali Sakar Co-authored-by: Christopher B Fernandes Co-authored-by: Vishali Sakar <46264876+vishalisakar@users.noreply.github.com> Co-authored-by: Vishali Sakar From c4ef4c18436f99e40bbea5c73a75a6cac0e25e52 Mon Sep 17 00:00:00 2001 From: NandiniAV Date: Thu, 16 Jun 2022 10:06:42 +0530 Subject: [PATCH 4/8] Added logs in events page --- .../events/routes/list/list-event.component.ts | 15 ++++++++++++--- src/app/component/root/root.component.ts | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/project/ws/app/src/lib/routes/events/routes/list/list-event.component.ts b/project/ws/app/src/lib/routes/events/routes/list/list-event.component.ts index d480a6264..e625b6fb8 100644 --- a/project/ws/app/src/lib/routes/events/routes/list/list-event.component.ts +++ b/project/ws/app/src/lib/routes/events/routes/list/list-event.component.ts @@ -1,7 +1,7 @@ import { AfterViewInit, Component, OnInit, OnDestroy } from '@angular/core' import { Router, ActivatedRoute } from '@angular/router' import { EventsService } from '../../services/events.service' -import { ConfigurationsService, EventService } from '@sunbird-cb/utils' +import { ConfigurationsService, EventService, LoggerService } from '@sunbird-cb/utils' import * as moment from 'moment' /* tslint:disable */ import _ from 'lodash' @@ -34,16 +34,19 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { private eventSvc: EventsService, private configSvc: ConfigurationsService, private activeRoute: ActivatedRoute, - private events: EventService + private events: EventService, + private logger: LoggerService, ) { this.math = Math if (this.configSvc.userProfile) { this.currentUser = this.configSvc.userProfile && this.configSvc.userProfile.userId this.department = this.configSvc.userProfile && this.configSvc.userProfile.departmentName this.departmentID = this.configSvc.userProfile && this.configSvc.userProfile.rootOrgId + this.logger.log(this.departmentID) } else { if (_.get(this.activeRoute, 'snapshot.data.configService.userProfile.rootOrgId')) { this.departmentID = _.get(this.activeRoute, 'snapshot.data.configService.userProfile.rootOrgId') + this.logger.log(this.departmentID) } if (_.get(this.activeRoute, 'snapshot.data.configService.userProfile.departmentName')) { this.department = _.get(this.activeRoute, 'snapshot.data.configService.userProfile.departmentName') @@ -103,6 +106,7 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { } this.eventSvc.getEventsList(requestObj).subscribe((events: any) => { + this.logger.log(events) this.setEventListData(events) }) } @@ -121,7 +125,7 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { const minutes = obj.duration % 60 const duration = (hours === 0) ? ((minutes === 0) ? '---' : `${minutes} minutes`) : (minutes === 0) ? (hours === 1) ? `${hours} hour` : `${hours} hours` : (hours === 1) ? `${hours} hour ${minutes} minutes` : - `${hours} hours ${minutes} minutes` + `${hours} hours ${minutes} minutes` const creatordata = obj.creatorDetails !== undefined ? obj.creatorDetails : [] const str = creatordata && creatordata.length > 0 ? creatordata.replace(/\\/g, '') : [] const creatorDetails = str && str.length > 0 ? JSON.parse(str) : creatordata @@ -137,6 +141,7 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { } const isPast = this.compareDate(expiryDateFormat); (isPast) ? this.eventData['pastEvents'].push(eventDataObj) : this.eventData['upcomingEvents'].push(eventDataObj) + this.logger.log(eventDataObj) } }) this.filter('upcoming') @@ -159,6 +164,7 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { filter(key: string | 'timestamp' | 'best' | 'saved') { const upcomingEventsData: any[] = [] const pastEventsData: any[] = [] + this.logger.log(this.eventData) if (this.eventData['pastEvents'] && this.eventData['pastEvents'].length > 0) { this.eventData['pastEvents'].forEach((event: any) => { pastEventsData.push(event) @@ -176,12 +182,15 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { switch (key) { case 'upcoming': this.data = upcomingEventsData + this.logger.log(this.data) break case 'past': this.data = pastEventsData + this.logger.log(this.data) break default: this.data = upcomingEventsData + this.logger.log(this.data) break } } diff --git a/src/app/component/root/root.component.ts b/src/app/component/root/root.component.ts index 918df6346..0df9e6170 100644 --- a/src/app/component/root/root.component.ts +++ b/src/app/component/root/root.component.ts @@ -180,6 +180,7 @@ export class RootComponent implements OnInit, AfterViewInit { raiseAppStartTelemetry() { if (!this.appStartRaised) { + this.logger.log(WsEvents.WsEventLogLevel.Info) const event = { eventType: WsEvents.WsEventType.Telemetry, eventLogLevel: WsEvents.WsEventLogLevel.Info, From 54b48fdc2cf24effb695b1bd2bbeb3883b44437e Mon Sep 17 00:00:00 2001 From: NandiniAV Date: Thu, 16 Jun 2022 22:57:44 +0530 Subject: [PATCH 5/8] Updated logs in events page --- angular.json | 50 +++++++++++++------ .../routes/list/list-event.component.ts | 29 +++++++---- src/app/component/root/root.component.ts | 3 +- 3 files changed, 56 insertions(+), 26 deletions(-) diff --git a/angular.json b/angular.json index db728ae2d..a4d2e967d 100644 --- a/angular.json +++ b/angular.json @@ -17,9 +17,15 @@ "main": "src/main.ts", "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.app.json", - "assets": ["src/favicon.ico", "src/favicon.png", "src/mdo-assets"], + "assets": [ + "src/favicon.ico", + "src/favicon.png", + "src/mdo-assets" + ], "stylePreprocessorOptions": { - "includePaths": ["src/styles"] + "includePaths": [ + "src/styles" + ] }, "styles": [ { @@ -95,7 +101,7 @@ ], "optimization": true, "outputHashing": "all", - "sourceMap": false, + "sourceMap": true, "extractCss": true, "namedChunks": false, "aot": true, @@ -121,7 +127,7 @@ ], "optimization": true, "outputHashing": "all", - "sourceMap": false, + "sourceMap": true, "extractCss": true, "namedChunks": false, "aot": true, @@ -147,7 +153,7 @@ ], "optimization": true, "outputHashing": "all", - "sourceMap": false, + "sourceMap": true, "extractCss": true, "namedChunks": false, "aot": true, @@ -173,7 +179,7 @@ ], "optimization": true, "outputHashing": "all", - "sourceMap": false, + "sourceMap": true, "extractCss": true, "namedChunks": false, "aot": true, @@ -199,7 +205,7 @@ ], "optimization": true, "outputHashing": "all", - "sourceMap": false, + "sourceMap": true, "extractCss": true, "namedChunks": false, "aot": true, @@ -246,16 +252,27 @@ "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.spec.json", "karmaConfig": "karma.conf.js", - "assets": ["src/favicon.ico", "src/mdo-assets"], - "styles": ["src/styles.scss"], + "assets": [ + "src/favicon.ico", + "src/mdo-assets" + ], + "styles": [ + "src/styles.scss" + ], "scripts": [] } }, "lint": { "builder": "@angular-devkit/build-angular:tslint", "options": { - "tsConfig": ["tsconfig.app.json", "tsconfig.spec.json", "e2e/tsconfig.json"], - "exclude": ["**/node_modules/**"] + "tsConfig": [ + "tsconfig.app.json", + "tsconfig.spec.json", + "e2e/tsconfig.json" + ], + "exclude": [ + "**/node_modules/**" + ] } }, "e2e": { @@ -296,8 +313,13 @@ "lint": { "builder": "@angular-devkit/build-angular:tslint", "options": { - "tsConfig": ["project/ws/app/tsconfig.lib.json", "project/ws/app/tsconfig.spec.json"], - "exclude": ["**/node_modules/**"] + "tsConfig": [ + "project/ws/app/tsconfig.lib.json", + "project/ws/app/tsconfig.spec.json" + ], + "exclude": [ + "**/node_modules/**" + ] } } } @@ -312,4 +334,4 @@ "cli": { "analytics": false } -} +} \ No newline at end of file diff --git a/project/ws/app/src/lib/routes/events/routes/list/list-event.component.ts b/project/ws/app/src/lib/routes/events/routes/list/list-event.component.ts index e625b6fb8..af60c0cd8 100644 --- a/project/ws/app/src/lib/routes/events/routes/list/list-event.component.ts +++ b/project/ws/app/src/lib/routes/events/routes/list/list-event.component.ts @@ -1,7 +1,7 @@ import { AfterViewInit, Component, OnInit, OnDestroy } from '@angular/core' import { Router, ActivatedRoute } from '@angular/router' import { EventsService } from '../../services/events.service' -import { ConfigurationsService, EventService, LoggerService } from '@sunbird-cb/utils' +import { ConfigurationsService, EventService } from '@sunbird-cb/utils' import * as moment from 'moment' /* tslint:disable */ import _ from 'lodash' @@ -34,19 +34,20 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { private eventSvc: EventsService, private configSvc: ConfigurationsService, private activeRoute: ActivatedRoute, - private events: EventService, - private logger: LoggerService, + private events: EventService ) { this.math = Math if (this.configSvc.userProfile) { this.currentUser = this.configSvc.userProfile && this.configSvc.userProfile.userId this.department = this.configSvc.userProfile && this.configSvc.userProfile.departmentName this.departmentID = this.configSvc.userProfile && this.configSvc.userProfile.rootOrgId - this.logger.log(this.departmentID) + // tslint:disable-next-line:no-console + console.log('departmentID', this.departmentID) } else { if (_.get(this.activeRoute, 'snapshot.data.configService.userProfile.rootOrgId')) { this.departmentID = _.get(this.activeRoute, 'snapshot.data.configService.userProfile.rootOrgId') - this.logger.log(this.departmentID) + // tslint:disable-next-line:no-console + console.log('departmentID', this.departmentID) } if (_.get(this.activeRoute, 'snapshot.data.configService.userProfile.departmentName')) { this.department = _.get(this.activeRoute, 'snapshot.data.configService.userProfile.departmentName') @@ -106,7 +107,8 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { } this.eventSvc.getEventsList(requestObj).subscribe((events: any) => { - this.logger.log(events) + // tslint:disable-next-line:no-console + console.log('events', events) this.setEventListData(events) }) } @@ -141,7 +143,8 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { } const isPast = this.compareDate(expiryDateFormat); (isPast) ? this.eventData['pastEvents'].push(eventDataObj) : this.eventData['upcomingEvents'].push(eventDataObj) - this.logger.log(eventDataObj) + // tslint:disable-next-line:no-console + console.log('eventDataObj', eventDataObj) } }) this.filter('upcoming') @@ -164,7 +167,8 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { filter(key: string | 'timestamp' | 'best' | 'saved') { const upcomingEventsData: any[] = [] const pastEventsData: any[] = [] - this.logger.log(this.eventData) + // tslint:disable-next-line:no-console + console.log('eventData', this.eventData) if (this.eventData['pastEvents'] && this.eventData['pastEvents'].length > 0) { this.eventData['pastEvents'].forEach((event: any) => { pastEventsData.push(event) @@ -182,15 +186,18 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { switch (key) { case 'upcoming': this.data = upcomingEventsData - this.logger.log(this.data) + // tslint:disable-next-line:no-console + console.log('data', this.data) break case 'past': this.data = pastEventsData - this.logger.log(this.data) + // tslint:disable-next-line:no-console + console.log('data', this.data) break default: this.data = upcomingEventsData - this.logger.log(this.data) + // tslint:disable-next-line:no-console + console.log('data', this.data) break } } diff --git a/src/app/component/root/root.component.ts b/src/app/component/root/root.component.ts index 0df9e6170..168290b9c 100644 --- a/src/app/component/root/root.component.ts +++ b/src/app/component/root/root.component.ts @@ -180,7 +180,8 @@ export class RootComponent implements OnInit, AfterViewInit { raiseAppStartTelemetry() { if (!this.appStartRaised) { - this.logger.log(WsEvents.WsEventLogLevel.Info) + // tslint:disable-next-line:no-console + console.log('WsEvents.WsEventLogLevel', WsEvents.WsEventLogLevel) const event = { eventType: WsEvents.WsEventType.Telemetry, eventLogLevel: WsEvents.WsEventLogLevel.Info, From 4ee6b2bd4e0574f702268ddc0fce6d04dd8628e8 Mon Sep 17 00:00:00 2001 From: NandiniAV Date: Tue, 21 Jun 2022 14:55:07 +0530 Subject: [PATCH 6/8] Updated rain package & removed the logs added --- angular.json | 10 +++++----- package.json | 4 ++-- .../events/routes/list/list-event.component.ts | 16 ---------------- src/app/component/root/root.component.ts | 2 -- 4 files changed, 7 insertions(+), 25 deletions(-) diff --git a/angular.json b/angular.json index a4d2e967d..4037c51b9 100644 --- a/angular.json +++ b/angular.json @@ -101,7 +101,7 @@ ], "optimization": true, "outputHashing": "all", - "sourceMap": true, + "sourceMap": false, "extractCss": true, "namedChunks": false, "aot": true, @@ -127,7 +127,7 @@ ], "optimization": true, "outputHashing": "all", - "sourceMap": true, + "sourceMap": false, "extractCss": true, "namedChunks": false, "aot": true, @@ -153,7 +153,7 @@ ], "optimization": true, "outputHashing": "all", - "sourceMap": true, + "sourceMap": false, "extractCss": true, "namedChunks": false, "aot": true, @@ -179,7 +179,7 @@ ], "optimization": true, "outputHashing": "all", - "sourceMap": true, + "sourceMap": false, "extractCss": true, "namedChunks": false, "aot": true, @@ -205,7 +205,7 @@ ], "optimization": true, "outputHashing": "all", - "sourceMap": true, + "sourceMap": false, "extractCss": true, "namedChunks": false, "aot": true, diff --git a/package.json b/package.json index a048c7d9b..2edefed4b 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "@project-sunbird/telemetry-sdk": "0.0.26", "@sunbird-cb/collection": "1.0.13", "@sunbird-cb/design-system": "0.0.1", - "@sunbird-cb/rain-dashboards": "^0.2.2", + "@sunbird-cb/rain-dashboards": "^0.2.3", "@sunbird-cb/resolver": "^1.0.0", "@sunbird-cb/utils": "^1.0.12", "@types/file-saver": "^2.0.1", @@ -136,4 +136,4 @@ "typescript-tslint-plugin": "^0.5.4", "webpack-bundle-analyzer": "^4.4.0" } -} +} \ No newline at end of file diff --git a/project/ws/app/src/lib/routes/events/routes/list/list-event.component.ts b/project/ws/app/src/lib/routes/events/routes/list/list-event.component.ts index af60c0cd8..1c81166d6 100644 --- a/project/ws/app/src/lib/routes/events/routes/list/list-event.component.ts +++ b/project/ws/app/src/lib/routes/events/routes/list/list-event.component.ts @@ -41,13 +41,9 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { this.currentUser = this.configSvc.userProfile && this.configSvc.userProfile.userId this.department = this.configSvc.userProfile && this.configSvc.userProfile.departmentName this.departmentID = this.configSvc.userProfile && this.configSvc.userProfile.rootOrgId - // tslint:disable-next-line:no-console - console.log('departmentID', this.departmentID) } else { if (_.get(this.activeRoute, 'snapshot.data.configService.userProfile.rootOrgId')) { this.departmentID = _.get(this.activeRoute, 'snapshot.data.configService.userProfile.rootOrgId') - // tslint:disable-next-line:no-console - console.log('departmentID', this.departmentID) } if (_.get(this.activeRoute, 'snapshot.data.configService.userProfile.departmentName')) { this.department = _.get(this.activeRoute, 'snapshot.data.configService.userProfile.departmentName') @@ -107,8 +103,6 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { } this.eventSvc.getEventsList(requestObj).subscribe((events: any) => { - // tslint:disable-next-line:no-console - console.log('events', events) this.setEventListData(events) }) } @@ -143,8 +137,6 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { } const isPast = this.compareDate(expiryDateFormat); (isPast) ? this.eventData['pastEvents'].push(eventDataObj) : this.eventData['upcomingEvents'].push(eventDataObj) - // tslint:disable-next-line:no-console - console.log('eventDataObj', eventDataObj) } }) this.filter('upcoming') @@ -167,8 +159,6 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { filter(key: string | 'timestamp' | 'best' | 'saved') { const upcomingEventsData: any[] = [] const pastEventsData: any[] = [] - // tslint:disable-next-line:no-console - console.log('eventData', this.eventData) if (this.eventData['pastEvents'] && this.eventData['pastEvents'].length > 0) { this.eventData['pastEvents'].forEach((event: any) => { pastEventsData.push(event) @@ -186,18 +176,12 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { switch (key) { case 'upcoming': this.data = upcomingEventsData - // tslint:disable-next-line:no-console - console.log('data', this.data) break case 'past': this.data = pastEventsData - // tslint:disable-next-line:no-console - console.log('data', this.data) break default: this.data = upcomingEventsData - // tslint:disable-next-line:no-console - console.log('data', this.data) break } } diff --git a/src/app/component/root/root.component.ts b/src/app/component/root/root.component.ts index 168290b9c..918df6346 100644 --- a/src/app/component/root/root.component.ts +++ b/src/app/component/root/root.component.ts @@ -180,8 +180,6 @@ export class RootComponent implements OnInit, AfterViewInit { raiseAppStartTelemetry() { if (!this.appStartRaised) { - // tslint:disable-next-line:no-console - console.log('WsEvents.WsEventLogLevel', WsEvents.WsEventLogLevel) const event = { eventType: WsEvents.WsEventType.Telemetry, eventLogLevel: WsEvents.WsEventLogLevel.Info, From 5113e709599c6745ae67d6af3d5ed88099d5ca57 Mon Sep 17 00:00:00 2001 From: NandiniAV Date: Tue, 21 Jun 2022 16:14:37 +0530 Subject: [PATCH 7/8] Enabled logs & sourcemap --- angular.json | 10 +++++----- .../events/routes/list/list-event.component.ts | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/angular.json b/angular.json index 4037c51b9..a4d2e967d 100644 --- a/angular.json +++ b/angular.json @@ -101,7 +101,7 @@ ], "optimization": true, "outputHashing": "all", - "sourceMap": false, + "sourceMap": true, "extractCss": true, "namedChunks": false, "aot": true, @@ -127,7 +127,7 @@ ], "optimization": true, "outputHashing": "all", - "sourceMap": false, + "sourceMap": true, "extractCss": true, "namedChunks": false, "aot": true, @@ -153,7 +153,7 @@ ], "optimization": true, "outputHashing": "all", - "sourceMap": false, + "sourceMap": true, "extractCss": true, "namedChunks": false, "aot": true, @@ -179,7 +179,7 @@ ], "optimization": true, "outputHashing": "all", - "sourceMap": false, + "sourceMap": true, "extractCss": true, "namedChunks": false, "aot": true, @@ -205,7 +205,7 @@ ], "optimization": true, "outputHashing": "all", - "sourceMap": false, + "sourceMap": true, "extractCss": true, "namedChunks": false, "aot": true, diff --git a/project/ws/app/src/lib/routes/events/routes/list/list-event.component.ts b/project/ws/app/src/lib/routes/events/routes/list/list-event.component.ts index 1c81166d6..af60c0cd8 100644 --- a/project/ws/app/src/lib/routes/events/routes/list/list-event.component.ts +++ b/project/ws/app/src/lib/routes/events/routes/list/list-event.component.ts @@ -41,9 +41,13 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { this.currentUser = this.configSvc.userProfile && this.configSvc.userProfile.userId this.department = this.configSvc.userProfile && this.configSvc.userProfile.departmentName this.departmentID = this.configSvc.userProfile && this.configSvc.userProfile.rootOrgId + // tslint:disable-next-line:no-console + console.log('departmentID', this.departmentID) } else { if (_.get(this.activeRoute, 'snapshot.data.configService.userProfile.rootOrgId')) { this.departmentID = _.get(this.activeRoute, 'snapshot.data.configService.userProfile.rootOrgId') + // tslint:disable-next-line:no-console + console.log('departmentID', this.departmentID) } if (_.get(this.activeRoute, 'snapshot.data.configService.userProfile.departmentName')) { this.department = _.get(this.activeRoute, 'snapshot.data.configService.userProfile.departmentName') @@ -103,6 +107,8 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { } this.eventSvc.getEventsList(requestObj).subscribe((events: any) => { + // tslint:disable-next-line:no-console + console.log('events', events) this.setEventListData(events) }) } @@ -137,6 +143,8 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { } const isPast = this.compareDate(expiryDateFormat); (isPast) ? this.eventData['pastEvents'].push(eventDataObj) : this.eventData['upcomingEvents'].push(eventDataObj) + // tslint:disable-next-line:no-console + console.log('eventDataObj', eventDataObj) } }) this.filter('upcoming') @@ -159,6 +167,8 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { filter(key: string | 'timestamp' | 'best' | 'saved') { const upcomingEventsData: any[] = [] const pastEventsData: any[] = [] + // tslint:disable-next-line:no-console + console.log('eventData', this.eventData) if (this.eventData['pastEvents'] && this.eventData['pastEvents'].length > 0) { this.eventData['pastEvents'].forEach((event: any) => { pastEventsData.push(event) @@ -176,12 +186,18 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { switch (key) { case 'upcoming': this.data = upcomingEventsData + // tslint:disable-next-line:no-console + console.log('data', this.data) break case 'past': this.data = pastEventsData + // tslint:disable-next-line:no-console + console.log('data', this.data) break default: this.data = upcomingEventsData + // tslint:disable-next-line:no-console + console.log('data', this.data) break } } From 8b5b30876b1c75a79abbbb876c340da4fe7fc649 Mon Sep 17 00:00:00 2001 From: NandiniAV Date: Tue, 21 Jun 2022 18:07:25 +0530 Subject: [PATCH 8/8] Reverted logs & sourcemap updates --- angular.json | 10 +++++----- .../events/routes/list/list-event.component.ts | 16 ---------------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/angular.json b/angular.json index a4d2e967d..4037c51b9 100644 --- a/angular.json +++ b/angular.json @@ -101,7 +101,7 @@ ], "optimization": true, "outputHashing": "all", - "sourceMap": true, + "sourceMap": false, "extractCss": true, "namedChunks": false, "aot": true, @@ -127,7 +127,7 @@ ], "optimization": true, "outputHashing": "all", - "sourceMap": true, + "sourceMap": false, "extractCss": true, "namedChunks": false, "aot": true, @@ -153,7 +153,7 @@ ], "optimization": true, "outputHashing": "all", - "sourceMap": true, + "sourceMap": false, "extractCss": true, "namedChunks": false, "aot": true, @@ -179,7 +179,7 @@ ], "optimization": true, "outputHashing": "all", - "sourceMap": true, + "sourceMap": false, "extractCss": true, "namedChunks": false, "aot": true, @@ -205,7 +205,7 @@ ], "optimization": true, "outputHashing": "all", - "sourceMap": true, + "sourceMap": false, "extractCss": true, "namedChunks": false, "aot": true, diff --git a/project/ws/app/src/lib/routes/events/routes/list/list-event.component.ts b/project/ws/app/src/lib/routes/events/routes/list/list-event.component.ts index af60c0cd8..1c81166d6 100644 --- a/project/ws/app/src/lib/routes/events/routes/list/list-event.component.ts +++ b/project/ws/app/src/lib/routes/events/routes/list/list-event.component.ts @@ -41,13 +41,9 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { this.currentUser = this.configSvc.userProfile && this.configSvc.userProfile.userId this.department = this.configSvc.userProfile && this.configSvc.userProfile.departmentName this.departmentID = this.configSvc.userProfile && this.configSvc.userProfile.rootOrgId - // tslint:disable-next-line:no-console - console.log('departmentID', this.departmentID) } else { if (_.get(this.activeRoute, 'snapshot.data.configService.userProfile.rootOrgId')) { this.departmentID = _.get(this.activeRoute, 'snapshot.data.configService.userProfile.rootOrgId') - // tslint:disable-next-line:no-console - console.log('departmentID', this.departmentID) } if (_.get(this.activeRoute, 'snapshot.data.configService.userProfile.departmentName')) { this.department = _.get(this.activeRoute, 'snapshot.data.configService.userProfile.departmentName') @@ -107,8 +103,6 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { } this.eventSvc.getEventsList(requestObj).subscribe((events: any) => { - // tslint:disable-next-line:no-console - console.log('events', events) this.setEventListData(events) }) } @@ -143,8 +137,6 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { } const isPast = this.compareDate(expiryDateFormat); (isPast) ? this.eventData['pastEvents'].push(eventDataObj) : this.eventData['upcomingEvents'].push(eventDataObj) - // tslint:disable-next-line:no-console - console.log('eventDataObj', eventDataObj) } }) this.filter('upcoming') @@ -167,8 +159,6 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { filter(key: string | 'timestamp' | 'best' | 'saved') { const upcomingEventsData: any[] = [] const pastEventsData: any[] = [] - // tslint:disable-next-line:no-console - console.log('eventData', this.eventData) if (this.eventData['pastEvents'] && this.eventData['pastEvents'].length > 0) { this.eventData['pastEvents'].forEach((event: any) => { pastEventsData.push(event) @@ -186,18 +176,12 @@ export class ListEventComponent implements OnInit, AfterViewInit, OnDestroy { switch (key) { case 'upcoming': this.data = upcomingEventsData - // tslint:disable-next-line:no-console - console.log('data', this.data) break case 'past': this.data = pastEventsData - // tslint:disable-next-line:no-console - console.log('data', this.data) break default: this.data = upcomingEventsData - // tslint:disable-next-line:no-console - console.log('data', this.data) break } }