| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 1 | /* |
| 2 | Copyright 2020 TATA ELXSI |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the 'License'); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | |
| 16 | Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in) |
| 17 | */ |
| 18 | /** |
| 19 | * @file NS Instance Component |
| 20 | */ |
| SANDHYA.JS | 8ead52b | 2024-06-10 18:23:41 +0530 | [diff] [blame] | 21 | import { Component, Injector, OnInit, ViewChild } from '@angular/core'; |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 22 | import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; |
| 23 | import { TranslateService } from '@ngx-translate/core'; |
| 24 | import { CONFIGCONSTANT, ERRORDATA, MODALCLOSERESPONSEDATA } from 'CommonModel'; |
| 25 | import { DataService } from 'DataService'; |
| SANDHYA.JS | 8ead52b | 2024-06-10 18:23:41 +0530 | [diff] [blame] | 26 | import { DeleteComponent } from 'DeleteComponent'; |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 27 | import { environment } from 'environment'; |
| 28 | import { InstantiateNsComponent } from 'InstantiateNs'; |
| SANDHYA.JS | 8ead52b | 2024-06-10 18:23:41 +0530 | [diff] [blame] | 29 | import { LocalDataSource, Ng2SmartTableComponent } from 'ng2-smart-table'; |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 30 | import { NSDInstanceData, NSInstanceDetails } from 'NSInstanceModel'; |
| 31 | import { NSInstancesActionComponent } from 'NSInstancesActionComponent'; |
| 32 | import { RestService } from 'RestService'; |
| Isabel Lloret | 523d675 | 2025-04-29 08:06:54 +0000 | [diff] [blame] | 33 | import { forkJoin, Subscription } from 'rxjs'; |
| SANDHYA.JS | 8ead52b | 2024-06-10 18:23:41 +0530 | [diff] [blame] | 34 | import { isNullOrUndefined } from 'SharedService'; |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 35 | import { SharedService } from 'SharedService'; |
| Isabel Lloret | 523d675 | 2025-04-29 08:06:54 +0000 | [diff] [blame] | 36 | import { VimAccountDetails } from 'VimAccountModel'; |
| 37 | |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 38 | |
| 39 | /** |
| 40 | * Creating component |
| 41 | * @Component takes NSInstancesComponent.html as template url |
| 42 | */ |
| 43 | @Component({ |
| 44 | templateUrl: './NSInstancesComponent.html', |
| 45 | styleUrls: ['./NSInstancesComponent.scss'] |
| 46 | }) |
| 47 | /** Exporting a class @exports NSInstancesComponent */ |
| 48 | export class NSInstancesComponent implements OnInit { |
| SANDHYA.JS | 8ead52b | 2024-06-10 18:23:41 +0530 | [diff] [blame] | 49 | @ViewChild('table') table: Ng2SmartTableComponent; |
| 50 | |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 51 | /** Injector to invoke other services @public */ |
| 52 | public injector: Injector; |
| 53 | |
| 54 | /** NS Instance array @public */ |
| 55 | public nsInstanceData: object[] = []; |
| 56 | |
| 57 | /** Datasource instance @public */ |
| 58 | public dataSource: LocalDataSource = new LocalDataSource(); |
| 59 | |
| 60 | /** SelectedRows array @public */ |
| SANDHYA.JS | 8ead52b | 2024-06-10 18:23:41 +0530 | [diff] [blame] | 61 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 62 | public selectedRows: any; |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 63 | |
| 64 | /** Selected list array @public */ |
| SANDHYA.JS | 8ead52b | 2024-06-10 18:23:41 +0530 | [diff] [blame] | 65 | public selectList: [] = []; |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 66 | |
| 67 | /** Instance component are stored in settings @public */ |
| 68 | public settings: {} = {}; |
| 69 | |
| 70 | /** Contains objects for menu settings @public */ |
| 71 | public columnList: {} = {}; |
| 72 | |
| 73 | /** Check the loading results @public */ |
| 74 | public isLoadingResults: boolean = true; |
| 75 | |
| 76 | /** Give the message for the loading @public */ |
| 77 | public message: string = 'PLEASEWAIT'; |
| 78 | |
| 79 | /** Class for empty and present data @public */ |
| 80 | public checkDataClass: string; |
| 81 | |
| 82 | /** operational State init data @public */ |
| 83 | public operationalStateFirstStep: string = CONFIGCONSTANT.operationalStateFirstStep; |
| 84 | |
| 85 | /** operational State running data @public */ |
| 86 | public operationalStateSecondStep: string = CONFIGCONSTANT.operationalStateSecondStep; |
| 87 | |
| 88 | /** operational State failed data @public */ |
| 89 | public operationalStateThirdStep: string = CONFIGCONSTANT.operationalStateThirdStep; |
| 90 | |
| Barath Kumar R | 07698ab | 2021-03-30 11:50:42 +0530 | [diff] [blame] | 91 | /** operational State scaling data @public */ |
| 92 | public operationalStateFourthStep: string = CONFIGCONSTANT.operationalStateFourthStep; |
| 93 | |
| SANDHYA.JS | 219fe61 | 2024-01-23 15:52:43 +0530 | [diff] [blame] | 94 | /** operational State healing data @public */ |
| 95 | public operationalStateFifthStep: string = CONFIGCONSTANT.operationalStateFifthStep; |
| 96 | |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 97 | /** Config State init data @public */ |
| 98 | public configStateFirstStep: string = CONFIGCONSTANT.configStateFirstStep; |
| 99 | |
| 100 | /** Config State init data @public */ |
| 101 | public configStateSecondStep: string = CONFIGCONSTANT.configStateSecondStep; |
| 102 | |
| 103 | /** Config State init data @public */ |
| 104 | public configStateThirdStep: string = CONFIGCONSTANT.configStateThirdStep; |
| 105 | |
| 106 | /** Instance of the modal service @private */ |
| 107 | private modalService: NgbModal; |
| 108 | |
| 109 | /** dataService to pass the data from one component to another @private */ |
| 110 | private dataService: DataService; |
| 111 | |
| 112 | /** Utilizes rest service for any CRUD operations @private */ |
| 113 | private restService: RestService; |
| 114 | |
| 115 | /** Contains all methods related to shared @private */ |
| 116 | private sharedService: SharedService; |
| 117 | |
| 118 | /** Contains tranlsate instance @private */ |
| 119 | private translateService: TranslateService; |
| 120 | |
| 121 | /** Instance of subscriptions @private */ |
| 122 | private generateDataSub: Subscription; |
| 123 | |
| 124 | constructor(injector: Injector) { |
| 125 | this.injector = injector; |
| 126 | this.restService = this.injector.get(RestService); |
| 127 | this.dataService = this.injector.get(DataService); |
| 128 | this.sharedService = this.injector.get(SharedService); |
| 129 | this.translateService = this.injector.get(TranslateService); |
| 130 | this.modalService = this.injector.get(NgbModal); |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * Lifecyle Hooks the trigger before component is instantiate |
| 135 | */ |
| 136 | public ngOnInit(): void { |
| 137 | this.generateTableColumn(); |
| 138 | this.generateTableSettings(); |
| 139 | this.generateData(); |
| Barath Kumar R | 063a3f1 | 2020-12-29 16:35:09 +0530 | [diff] [blame] | 140 | this.generateDataSub = this.sharedService.dataEvent.subscribe((): void => { this.generateData(); }); |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | /** Generate smart table row title and filters @public */ |
| 144 | public generateTableSettings(): void { |
| 145 | this.settings = { |
| SANDHYA.JS | 8ead52b | 2024-06-10 18:23:41 +0530 | [diff] [blame] | 146 | selectMode: 'multi', |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 147 | columns: this.columnList, |
| 148 | actions: { add: false, edit: false, delete: false, position: 'right' }, |
| 149 | attr: this.sharedService.tableClassConfig(), |
| 150 | pager: this.sharedService.paginationPagerConfig(), |
| 151 | noDataMessage: this.translateService.instant('NODATAMSG') |
| 152 | }; |
| 153 | } |
| 154 | |
| 155 | /** Generate smart table row title and filters @public */ |
| 156 | public generateTableColumn(): void { |
| 157 | this.columnList = { |
| SANDHYA.JS | 5f8c802 | 2023-10-13 11:45:25 +0530 | [diff] [blame] | 158 | name: { title: this.translateService.instant('NAME'), width: '15%' }, |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 159 | identifier: { title: this.translateService.instant('IDENTIFIER'), width: '20%' }, |
| 160 | NsdName: { title: this.translateService.instant('NSDNAME'), width: '15%' }, |
| SANDHYA.JS | 5f8c802 | 2023-10-13 11:45:25 +0530 | [diff] [blame] | 161 | 'create-time': { |
| 162 | title: this.translateService.instant('DATE'), width: '15%', sortDirection: 'desc', |
| 163 | compareFunction: this.sharedService.compareFunction |
| 164 | }, |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 165 | OperationalStatus: { |
| 166 | title: this.translateService.instant('OPERATIONALSTATUS'), width: '10%', type: 'html', |
| 167 | filter: { |
| 168 | type: 'list', |
| 169 | config: { |
| 170 | selectText: 'Select', |
| 171 | list: [ |
| 172 | { value: this.operationalStateFirstStep, title: this.operationalStateFirstStep }, |
| 173 | { value: this.operationalStateSecondStep, title: this.operationalStateSecondStep }, |
| Barath Kumar R | 07698ab | 2021-03-30 11:50:42 +0530 | [diff] [blame] | 174 | { value: this.operationalStateThirdStep, title: this.operationalStateThirdStep }, |
| SANDHYA.JS | 219fe61 | 2024-01-23 15:52:43 +0530 | [diff] [blame] | 175 | { value: this.operationalStateFourthStep, title: this.operationalStateFourthStep }, |
| 176 | { value: this.operationalStateFifthStep, title: this.operationalStateFifthStep } |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 177 | ] |
| 178 | } |
| 179 | }, |
| 180 | valuePrepareFunction: (cell: NSDInstanceData, row: NSDInstanceData): string => { |
| 181 | if (row.OperationalStatus === this.operationalStateFirstStep) { |
| 182 | return `<span class="icon-label" title="${row.OperationalStatus}"> |
| SANDHYA.JS | 8ead52b | 2024-06-10 18:23:41 +0530 | [diff] [blame] | 183 | <i class="fas fa-clock text-warning"></i> |
| 184 | </span>`; |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 185 | } else if (row.OperationalStatus === this.operationalStateSecondStep) { |
| 186 | return `<span class="icon-label" title="${row.OperationalStatus}"> |
| SANDHYA.JS | 8ead52b | 2024-06-10 18:23:41 +0530 | [diff] [blame] | 187 | <i class="fas fa-check-circle text-success"></i> |
| 188 | </span>`; |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 189 | } else if (row.OperationalStatus === this.operationalStateThirdStep) { |
| 190 | return `<span class="icon-label" title="${row.OperationalStatus}"> |
| SANDHYA.JS | 8ead52b | 2024-06-10 18:23:41 +0530 | [diff] [blame] | 191 | <i class="fas fa-times-circle text-danger"></i> |
| 192 | </span>`; |
| Barath Kumar R | 07698ab | 2021-03-30 11:50:42 +0530 | [diff] [blame] | 193 | } else if (row.OperationalStatus === this.operationalStateFourthStep) { |
| 194 | return `<span class="icon-label" title="${row.OperationalStatus}"> |
| SANDHYA.JS | 8ead52b | 2024-06-10 18:23:41 +0530 | [diff] [blame] | 195 | <i class="fas fa-compress-alt text-success"></i> |
| 196 | </span>`; |
| SANDHYA.JS | 219fe61 | 2024-01-23 15:52:43 +0530 | [diff] [blame] | 197 | } |
| 198 | else if (row.OperationalStatus === this.operationalStateFifthStep) { |
| 199 | return `<span class="icon-label" title="${row.OperationalStatus}"> |
| SANDHYA.JS | 8ead52b | 2024-06-10 18:23:41 +0530 | [diff] [blame] | 200 | <i class="fas fa-briefcase-medical text-success"></i> |
| 201 | </span>`; |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 202 | } else { |
| 203 | return `<span>${row.OperationalStatus}</span>`; |
| 204 | } |
| 205 | } |
| 206 | }, |
| 207 | ConfigStatus: { |
| 208 | title: this.translateService.instant('CONFIGSTATUS'), width: '10%', type: 'html', |
| 209 | filter: { |
| 210 | type: 'list', |
| 211 | config: { |
| 212 | selectText: 'Select', |
| 213 | list: [ |
| 214 | { value: this.configStateFirstStep, title: this.configStateFirstStep }, |
| 215 | { value: this.configStateSecondStep, title: this.configStateSecondStep }, |
| 216 | { value: this.configStateThirdStep, title: this.configStateThirdStep } |
| 217 | ] |
| 218 | } |
| 219 | }, |
| 220 | valuePrepareFunction: (cell: NSDInstanceData, row: NSDInstanceData): string => { |
| 221 | if (row.ConfigStatus === this.configStateFirstStep) { |
| 222 | return `<span class="icon-label" title="${row.ConfigStatus}"> |
| SANDHYA.JS | 8ead52b | 2024-06-10 18:23:41 +0530 | [diff] [blame] | 223 | <i class="fas fa-clock text-warning"></i> |
| 224 | </span>`; |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 225 | } else if (row.ConfigStatus === this.configStateSecondStep) { |
| 226 | return `<span class="icon-label" title="${row.ConfigStatus}"> |
| SANDHYA.JS | 8ead52b | 2024-06-10 18:23:41 +0530 | [diff] [blame] | 227 | <i class="fas fa-check-circle text-success"></i> |
| 228 | </span>`; |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 229 | } else if (row.ConfigStatus === this.configStateThirdStep) { |
| 230 | return `<span class="icon-label" title="${row.ConfigStatus}"> |
| SANDHYA.JS | 8ead52b | 2024-06-10 18:23:41 +0530 | [diff] [blame] | 231 | <i class="fas fa-times-circle text-danger"></i> |
| 232 | </span>`; |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 233 | } else { |
| 234 | return `<span>${row.ConfigStatus}</span>`; |
| 235 | } |
| 236 | } |
| 237 | }, |
| 238 | DetailedStatus: { title: this.translateService.instant('DETAILEDSTATUS'), width: '15%' }, |
| 239 | Actions: { |
| 240 | name: 'Action', width: '15%', filter: false, sort: false, type: 'custom', |
| 241 | title: this.translateService.instant('ACTIONS'), |
| 242 | valuePrepareFunction: (cell: NSDInstanceData, row: NSDInstanceData): NSDInstanceData => row, |
| 243 | renderComponent: NSInstancesActionComponent |
| 244 | } |
| 245 | }; |
| 246 | } |
| 247 | |
| 248 | /** generateData initiate the ns-instance list @public */ |
| 249 | public generateData(): void { |
| 250 | this.isLoadingResults = true; |
| Isabel Lloret | 523d675 | 2025-04-29 08:06:54 +0000 | [diff] [blame] | 251 | forkJoin([ |
| 252 | this.restService.getResource(environment.VIMACCOUNTS_URL), |
| 253 | this.restService.getResource(environment.NSDINSTANCES_URL) |
| 254 | ]).subscribe({ |
| 255 | next: ([vimAccounts, nsdInstancesData]: [VimAccountDetails[], NSInstanceDetails[]]) => { |
| 256 | // Transforms vimAccounts to a map (will be used to enrich ns instance data) |
| 257 | const vimsMap = this.transformVimListToMap(vimAccounts); |
| 258 | |
| 259 | // Transform nsInstances to the format needed in the web |
| 260 | this.nsInstanceData = []; |
| 261 | nsdInstancesData.forEach((nsdInstanceData: NSInstanceDetails): void => { |
| 262 | const nsDataObj: NSDInstanceData = { |
| 263 | name: nsdInstanceData.name, |
| 264 | identifier: nsdInstanceData.id, |
| 265 | NsdName: nsdInstanceData['nsd-name-ref'], |
| 266 | OperationalStatus: nsdInstanceData['operational-status'], |
| 267 | ConfigStatus: nsdInstanceData['config-status'], |
| 268 | DetailedStatus: nsdInstanceData['detailed-status'], |
| 269 | memberIndex: nsdInstanceData.nsd.df, |
| 270 | nsConfig: nsdInstanceData.nsd['ns-configuration'], |
| 271 | adminDetails: nsdInstanceData._admin, |
| 272 | vnfID: nsdInstanceData['vnfd-id'], |
| 273 | nsd: nsdInstanceData.nsd, |
| 274 | 'nsd-id': nsdInstanceData['nsd-id'], |
| 275 | vcaStatus: nsdInstanceData.vcaStatus, |
| 276 | constituent: nsdInstanceData['constituent-vnfr-ref'], |
| 277 | 'create-time': this.sharedService.convertEpochTime(Number(nsdInstanceData['create-time'])), |
| 278 | vimType: vimsMap.get(nsdInstanceData['datacenter'])?.vim_type |
| 279 | }; |
| 280 | this.nsInstanceData.push(nsDataObj); |
| 281 | }); |
| 282 | if (this.nsInstanceData.length > 0) { |
| 283 | this.checkDataClass = 'dataTables_present'; |
| 284 | } else { |
| 285 | this.checkDataClass = 'dataTables_empty'; |
| 286 | } |
| 287 | this.dataSource.load(this.nsInstanceData).then((data: {}): void => { |
| 288 | this.isLoadingResults = false; |
| 289 | }).catch((): void => { |
| 290 | // Catch Navigation Error |
| 291 | }); |
| 292 | }, |
| 293 | error: (error: ERRORDATA): void => { |
| 294 | this.restService.handleError(error, 'get'); |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 295 | this.isLoadingResults = false; |
| Isabel Lloret | 523d675 | 2025-04-29 08:06:54 +0000 | [diff] [blame] | 296 | } |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 297 | }); |
| 298 | } |
| 299 | |
| Isabel Lloret | 523d675 | 2025-04-29 08:06:54 +0000 | [diff] [blame] | 300 | /** transforms vim list to map to be able to recover vim data fast by name */ |
| 301 | private transformVimListToMap(vimList: VimAccountDetails[]): Map<string, VimAccountDetails> { |
| 302 | const vimMap = new Map<string, VimAccountDetails>(); |
| 303 | vimList.forEach((vim) => { |
| 304 | vimMap.set(vim._id, vim); |
| 305 | }); |
| 306 | return vimMap; |
| 307 | } |
| 308 | |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 309 | /** smart table listing manipulation @public */ |
| 310 | public onChange(perPageValue: number): void { |
| 311 | this.dataSource.setPaging(1, perPageValue, true); |
| 312 | } |
| 313 | |
| 314 | /** smart table listing manipulation @public */ |
| 315 | public onUserRowSelect(event: MessageEvent): void { |
| SANDHYA.JS | 8ead52b | 2024-06-10 18:23:41 +0530 | [diff] [blame] | 316 | if (!isNullOrUndefined(event)) { |
| 317 | this.selectedRows = event; |
| 318 | if (this.selectedRows.selected.length !== 0) { |
| 319 | this.selectList = this.selectedRows.selected; |
| 320 | } else { |
| 321 | if (!isNullOrUndefined(event.data)) { |
| 322 | Object.assign(event.data, { page: 'ns-instance' }); |
| 323 | this.dataService.changeMessage(event.data); |
| 324 | } |
| 325 | this.selectList.length = 0; |
| 326 | } |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | /** delete NS using modalservice @public */ |
| 331 | public deleteNS(): void { |
| 332 | // eslint-disable-next-line security/detect-non-literal-fs-filename |
| 333 | const modalRef: NgbModalRef = this.modalService.open(DeleteComponent, { backdrop: 'static' }); |
| 334 | modalRef.componentInstance.params = { |
| 335 | identifierList: this.selectList, |
| 336 | page: 'instantiateNS' |
| 337 | }; |
| 338 | modalRef.result.then((result: MODALCLOSERESPONSEDATA) => { |
| 339 | if (result) { |
| 340 | this.sharedService.callData(); |
| 341 | this.table.isAllSelected = false; |
| 342 | this.selectList.length = 0; |
| 343 | } |
| 344 | }).catch((): void => { |
| 345 | // Catch Navigation Error |
| 346 | }); |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 347 | } |
| 348 | |
| 349 | /** Instantiate NS using modalservice @public */ |
| 350 | public instantiateNS(): void { |
| SANDHYA.JS | 0a34dfa | 2023-04-25 23:59:41 +0530 | [diff] [blame] | 351 | // eslint-disable-next-line security/detect-non-literal-fs-filename |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 352 | const modalRef: NgbModalRef = this.modalService.open(InstantiateNsComponent, { backdrop: 'static' }); |
| SANDHYA.JS | 8ead52b | 2024-06-10 18:23:41 +0530 | [diff] [blame] | 353 | modalRef.componentInstance.params = { |
| 354 | titleName: 'instantiateNS' |
| 355 | }; |
| Barath Kumar R | 063a3f1 | 2020-12-29 16:35:09 +0530 | [diff] [blame] | 356 | modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => { |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 357 | if (result) { |
| 358 | this.generateData(); |
| 359 | } |
| SANDHYA.JS | 0a34dfa | 2023-04-25 23:59:41 +0530 | [diff] [blame] | 360 | }).catch((): void => { |
| 361 | // Catch Navigation Error |
| 362 | }); |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 363 | } |
| 364 | |
| 365 | /** |
| 366 | * Lifecyle hook which get trigger on component destruction |
| 367 | */ |
| 368 | public ngOnDestroy(): void { |
| 369 | this.generateDataSub.unsubscribe(); |
| 370 | } |
| 371 | } |