| 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 InstancesAction Component |
| 20 | */ |
| 21 | import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Injector } from '@angular/core'; |
| 22 | import { Router } from '@angular/router'; |
| 23 | import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; |
| 24 | import { TranslateService } from '@ngx-translate/core'; |
| 25 | import { NotifierService } from 'angular-notifier'; |
| 26 | import { ERRORDATA, MODALCLOSERESPONSEDATA } from 'CommonModel'; |
| 27 | import { DeleteComponent } from 'DeleteComponent'; |
| 28 | import { environment } from 'environment'; |
| SANDHYA.JS | 219fe61 | 2024-01-23 15:52:43 +0530 | [diff] [blame] | 29 | import { HealingComponent } from 'HealingComponent'; |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 30 | import { NSDDetails } from 'NSDModel'; |
| 31 | import { NSDInstanceData } from 'NSInstanceModel'; |
| 32 | import { NSPrimitiveComponent } from 'NSPrimitiveComponent'; |
| SANDHYA.JS | 9914458 | 2022-04-27 17:22:35 +0530 | [diff] [blame] | 33 | import { NsUpdateComponent } from 'NsUpdateComponent'; |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 34 | import { RestService } from 'RestService'; |
| Barath Kumar R | 07698ab | 2021-03-30 11:50:42 +0530 | [diff] [blame] | 35 | import { forkJoin, Observable } from 'rxjs'; |
| 36 | import { ScalingComponent } from 'ScalingComponent'; |
| SANDHYA.JS | c84f112 | 2024-06-04 21:50:03 +0530 | [diff] [blame] | 37 | import { SharedService, isNullOrUndefined } from 'SharedService'; |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 38 | import { ShowInfoComponent } from 'ShowInfoComponent'; |
| Isabel Lloret | 523d675 | 2025-04-29 08:06:54 +0000 | [diff] [blame^] | 39 | import { ShowVduConsoleComponent } from 'ShowVduConsoleComponent'; |
| SANDHYA.JS | 3d81a28 | 2022-05-02 08:25:39 +0530 | [diff] [blame] | 40 | import { StartStopRebuildComponent } from 'StartStopRebuildComponent'; |
| SANDHYA.JS | fced3d4 | 2022-04-28 20:28:17 +0530 | [diff] [blame] | 41 | import { VmMigrationComponent } from 'VmMigrationComponent'; |
| Barath Kumar R | 07698ab | 2021-03-30 11:50:42 +0530 | [diff] [blame] | 42 | import { DF, VDU, VNFD } from 'VNFDModel'; |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 43 | /** |
| 44 | * Creating component |
| 45 | * @Component takes NSInstancesActionComponent.html as template url |
| 46 | */ |
| 47 | @Component({ |
| 48 | templateUrl: './NSInstancesActionComponent.html', |
| 49 | styleUrls: ['./NSInstancesActionComponent.scss'], |
| 50 | changeDetection: ChangeDetectionStrategy.OnPush |
| 51 | }) |
| 52 | /** Exporting a class @exports NSInstancesActionComponent */ |
| 53 | export class NSInstancesActionComponent { |
| 54 | /** To get the value from the nspackage via valuePrepareFunction default Property of ng-smarttable @public */ |
| 55 | public value: NSDInstanceData; |
| 56 | |
| 57 | /** Invoke service injectors @public */ |
| 58 | public injector: Injector; |
| 59 | |
| 60 | /** Instance of the modal service @public */ |
| 61 | public restService: RestService; |
| 62 | |
| 63 | /** Config Status Check @public */ |
| 64 | public configStatus: string; |
| 65 | |
| 66 | /** Operational Status Check @public */ |
| 67 | public operationalStatus: string; |
| 68 | |
| SANDHYA.JS | 0a34dfa | 2023-04-25 23:59:41 +0530 | [diff] [blame] | 69 | /** CNF Status Check @public */ |
| 70 | public k8sStatus: boolean = false; |
| 71 | |
| Barath Kumar R | 07698ab | 2021-03-30 11:50:42 +0530 | [diff] [blame] | 72 | /** get Admin Details @public */ |
| 73 | public getAdminDetails: {}; |
| 74 | |
| 75 | /** Scaling is accepted @public */ |
| 76 | public isScalingPresent: boolean = false; |
| 77 | |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 78 | /** Check the loading results for loader status @public */ |
| Barath Kumar R | 07698ab | 2021-03-30 11:50:42 +0530 | [diff] [blame] | 79 | public isLoadingNSInstanceAction: boolean = false; |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 80 | |
| 81 | /** Give the message for the loading @public */ |
| 82 | public message: string = 'PLEASEWAIT'; |
| 83 | |
| Barath Kumar R | 07698ab | 2021-03-30 11:50:42 +0530 | [diff] [blame] | 84 | /** Assign the VNF Details @public */ |
| 85 | public vnfDetails: VNFD[] = []; |
| 86 | |
| Barath Kumar R | f2ae546 | 2021-03-01 12:52:33 +0530 | [diff] [blame] | 87 | /** Contains instance ID @public */ |
| 88 | public instanceID: string; |
| 89 | |
| 90 | /** Contains operational dashboard view @public */ |
| 91 | public isShowOperationalDashboard: boolean = false; |
| 92 | |
| Isabel Lloret | 523d675 | 2025-04-29 08:06:54 +0000 | [diff] [blame^] | 93 | /** Controls to show additional operations buttons */ |
| 94 | public showConsoleAction: boolean = false; |
| 95 | |
| 96 | /** Vim types for wich console operation button must be show */ |
| 97 | private static readonly NS_CONSOLE_OPERATION_VIM_TYPES: string[] = ['vcenter']; |
| 98 | |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 99 | /** Instance of the modal service @private */ |
| 100 | private modalService: NgbModal; |
| 101 | |
| 102 | /** Holds teh instance of AuthService class of type AuthService @private */ |
| 103 | private router: Router; |
| 104 | |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 105 | /** Contains all methods related to shared @private */ |
| 106 | private sharedService: SharedService; |
| 107 | |
| 108 | /** Notifier service to popup notification @private */ |
| 109 | private notifierService: NotifierService; |
| 110 | |
| 111 | /** Contains tranlsate instance @private */ |
| 112 | private translateService: TranslateService; |
| 113 | |
| 114 | /** Detect changes for the User Input */ |
| 115 | private cd: ChangeDetectorRef; |
| 116 | |
| 117 | /** Set timeout @private */ |
| SANDHYA.JS | 0a34dfa | 2023-04-25 23:59:41 +0530 | [diff] [blame] | 118 | // eslint-disable-next-line @typescript-eslint/no-magic-numbers |
| Barath Kumar R | 07698ab | 2021-03-30 11:50:42 +0530 | [diff] [blame] | 119 | private timeOut: number = 100; |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 120 | |
| 121 | constructor(injector: Injector) { |
| 122 | this.injector = injector; |
| 123 | this.modalService = this.injector.get(NgbModal); |
| 124 | this.restService = this.injector.get(RestService); |
| 125 | this.router = this.injector.get(Router); |
| 126 | this.sharedService = this.injector.get(SharedService); |
| 127 | this.notifierService = this.injector.get(NotifierService); |
| 128 | this.translateService = this.injector.get(TranslateService); |
| 129 | this.cd = this.injector.get(ChangeDetectorRef); |
| 130 | } |
| 131 | |
| 132 | /** |
| 133 | * Lifecyle Hooks the trigger before component is instantiate |
| 134 | */ |
| 135 | public ngOnInit(): void { |
| 136 | this.configStatus = this.value.ConfigStatus; |
| 137 | this.operationalStatus = this.value.OperationalStatus; |
| 138 | this.instanceID = this.value.identifier; |
| Barath Kumar R | 07698ab | 2021-03-30 11:50:42 +0530 | [diff] [blame] | 139 | this.getAdminDetails = this.value.adminDetails; |
| SANDHYA.JS | 0a34dfa | 2023-04-25 23:59:41 +0530 | [diff] [blame] | 140 | for (const key of Object.keys(this.getAdminDetails)) { |
| 141 | if (key === 'deployed') { |
| 142 | // eslint-disable-next-line security/detect-object-injection |
| 143 | const adminData: {} = this.getAdminDetails[key]; |
| 144 | for (const k8sData of Object.keys(adminData)) { |
| 145 | if (k8sData === 'K8s') { |
| 146 | // eslint-disable-next-line security/detect-object-injection |
| 147 | if (adminData[k8sData].length !== 0) { |
| 148 | this.k8sStatus = true; |
| 149 | } |
| 150 | } |
| 151 | } |
| 152 | } |
| 153 | } |
| Barath Kumar R | f2ae546 | 2021-03-01 12:52:33 +0530 | [diff] [blame] | 154 | this.isShowOperationalDashboard = !isNullOrUndefined(this.value.vcaStatus) ? |
| 155 | Object.keys(this.value.vcaStatus).length === 0 && typeof this.value.vcaStatus === 'object' : true; |
| Isabel Lloret | 523d675 | 2025-04-29 08:06:54 +0000 | [diff] [blame^] | 156 | // Check if additional operations buttons must be showns |
| 157 | this.checkShowExtraActionsButtons(); |
| 158 | } |
| 159 | |
| 160 | /** Checks if the console option in the actions dropdown must be shown */ |
| 161 | private checkShowExtraActionsButtons() { |
| 162 | if (NSInstancesActionComponent.NS_CONSOLE_OPERATION_VIM_TYPES.includes(this.value.vimType)) { |
| 163 | this.showConsoleAction = true; |
| 164 | } |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 165 | } |
| 166 | |
| 167 | /** Shows information using modalservice @public */ |
| 168 | public infoNs(): void { |
| SANDHYA.JS | 0a34dfa | 2023-04-25 23:59:41 +0530 | [diff] [blame] | 169 | // eslint-disable-next-line security/detect-non-literal-fs-filename |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 170 | this.modalService.open(ShowInfoComponent, { backdrop: 'static' }).componentInstance.params = { |
| 171 | id: this.instanceID, |
| 172 | page: 'ns-instance', |
| 173 | titleName: 'INSTANCEDETAILS' |
| 174 | }; |
| 175 | } |
| 176 | |
| 177 | /** Delete NS Instanace @public */ |
| 178 | public deleteNSInstance(forceAction: boolean): void { |
| SANDHYA.JS | 0a34dfa | 2023-04-25 23:59:41 +0530 | [diff] [blame] | 179 | // eslint-disable-next-line security/detect-non-literal-fs-filename |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 180 | const modalRef: NgbModalRef = this.modalService.open(DeleteComponent, { backdrop: 'static' }); |
| SANDHYA.JS | 8ead52b | 2024-06-10 18:23:41 +0530 | [diff] [blame] | 181 | modalRef.componentInstance.params = { |
| 182 | forceDeleteType: forceAction, |
| 183 | name: this.value.name, |
| 184 | page: 'ns-instance', |
| 185 | id: this.instanceID |
| 186 | }; |
| Barath Kumar R | 1a34b83 | 2021-03-05 11:32:19 +0530 | [diff] [blame] | 187 | modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => { |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 188 | if (result) { |
| 189 | this.sharedService.callData(); |
| 190 | } |
| SANDHYA.JS | 0a34dfa | 2023-04-25 23:59:41 +0530 | [diff] [blame] | 191 | }).catch((): void => { |
| 192 | // Catch Navigation Error |
| SANDHYA.JS | 219fe61 | 2024-01-23 15:52:43 +0530 | [diff] [blame] | 193 | }); |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 194 | } |
| 195 | |
| 196 | /** History of operations for an Instanace @public */ |
| 197 | public historyOfOperations(): void { |
| Barath Kumar R | 1a34b83 | 2021-03-05 11:32:19 +0530 | [diff] [blame] | 198 | this.router.navigate(['/instances/ns/history-operations/', this.instanceID]).catch((): void => { |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 199 | // Catch Navigation Error |
| 200 | }); |
| 201 | } |
| 202 | |
| 203 | /** NS Topology */ |
| 204 | public nsTopology(): void { |
| Barath Kumar R | 1a34b83 | 2021-03-05 11:32:19 +0530 | [diff] [blame] | 205 | this.router.navigate(['/instances/ns/', this.instanceID]).catch((): void => { |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 206 | // Catch Navigation Error |
| 207 | }); |
| 208 | } |
| 209 | |
| 210 | /** Exec NS Primitive @public */ |
| 211 | public execNSPrimitiveModal(): void { |
| SANDHYA.JS | 0a34dfa | 2023-04-25 23:59:41 +0530 | [diff] [blame] | 212 | // eslint-disable-next-line security/detect-non-literal-fs-filename |
| Barath Kumar R | d3ce0c5 | 2020-08-13 11:44:01 +0530 | [diff] [blame] | 213 | this.modalService.open(NSPrimitiveComponent, { backdrop: 'static' }).componentInstance.params = { |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 214 | memberIndex: this.value.memberIndex, |
| Barath Kumar R | 54d693c | 2020-07-13 20:54:13 +0530 | [diff] [blame] | 215 | nsConfig: this.value.nsConfig, |
| SANDHYA.JS | 1584e3e | 2022-10-31 20:11:50 +0530 | [diff] [blame] | 216 | name: this.value.NsdName, |
| SANDHYA.JS | a53db0c | 2025-05-23 11:44:39 +0530 | [diff] [blame] | 217 | id: this.value.constituent, |
| 218 | nsID: this.instanceID |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 219 | }; |
| 220 | } |
| 221 | |
| 222 | /** Redirect to Grafana Metrics @public */ |
| 223 | public metrics(): void { |
| Barath Kumar R | 07698ab | 2021-03-30 11:50:42 +0530 | [diff] [blame] | 224 | this.isLoadingNSInstanceAction = true; |
| Barath Kumar R | 1a34b83 | 2021-03-05 11:32:19 +0530 | [diff] [blame] | 225 | this.restService.getResource(environment.NSDINSTANCES_URL + '/' + this.instanceID).subscribe((nsData: NSDDetails[]): void => { |
| 226 | nsData['vnfd-id'].forEach((vnfdID: string[]): void => { |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 227 | this.restService.getResource(environment.VNFPACKAGES_URL + '/' + vnfdID) |
| Barath Kumar R | 1a34b83 | 2021-03-05 11:32:19 +0530 | [diff] [blame] | 228 | .subscribe((vnfd: VNFD): void => { |
| 229 | vnfd.vdu.forEach((vduData: VDU): void => { |
| 230 | if (vduData['monitoring-parameter'] !== undefined && vduData['monitoring-parameter'].length > 0) { |
| Barath Kumar R | 07698ab | 2021-03-30 11:50:42 +0530 | [diff] [blame] | 231 | this.isLoadingNSInstanceAction = false; |
| Barath Kumar R | 1a34b83 | 2021-03-05 11:32:19 +0530 | [diff] [blame] | 232 | const location: string = environment.GRAFANA_URL + '/' + this.instanceID + '/osm-ns-metrics-metrics'; |
| SANDHYA.JS | 0a34dfa | 2023-04-25 23:59:41 +0530 | [diff] [blame] | 233 | // eslint-disable-next-line security/detect-non-literal-fs-filename |
| Barath Kumar R | 1a34b83 | 2021-03-05 11:32:19 +0530 | [diff] [blame] | 234 | window.open(location); |
| 235 | } else { |
| Barath Kumar R | 07698ab | 2021-03-30 11:50:42 +0530 | [diff] [blame] | 236 | this.isLoadingNSInstanceAction = false; |
| SANDHYA.JS | 9bae460 | 2022-04-05 07:28:32 +0530 | [diff] [blame] | 237 | this.notifierService.notify('error', this.translateService.instant('PAGE.NSMETRIC.METRICERROR')); |
| Barath Kumar R | 1a34b83 | 2021-03-05 11:32:19 +0530 | [diff] [blame] | 238 | } |
| 239 | }); |
| Barath Kumar R | 07698ab | 2021-03-30 11:50:42 +0530 | [diff] [blame] | 240 | this.doChanges(); |
| Barath Kumar R | 1a34b83 | 2021-03-05 11:32:19 +0530 | [diff] [blame] | 241 | }, (error: ERRORDATA): void => { |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 242 | this.restService.handleError(error, 'get'); |
| Barath Kumar R | 07698ab | 2021-03-30 11:50:42 +0530 | [diff] [blame] | 243 | this.isLoadingNSInstanceAction = false; |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 244 | }); |
| 245 | }); |
| Barath Kumar R | 1a34b83 | 2021-03-05 11:32:19 +0530 | [diff] [blame] | 246 | }, (error: ERRORDATA): void => { |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 247 | this.restService.handleError(error, 'get'); |
| Barath Kumar R | 07698ab | 2021-03-30 11:50:42 +0530 | [diff] [blame] | 248 | this.isLoadingNSInstanceAction = false; |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 249 | }); |
| 250 | } |
| Barath Kumar R | 07698ab | 2021-03-30 11:50:42 +0530 | [diff] [blame] | 251 | |
| 252 | /** |
| 253 | * Do the manual scaling |
| 254 | * Here we are going to get a list of VNFD ID used in the instances |
| 255 | * and have this in array with URL created then pass to checkscaling method for forkjoin to get the data @public |
| 256 | */ |
| 257 | public manualScaling(): void { |
| 258 | this.isLoadingNSInstanceAction = true; |
| 259 | const tempURL: Observable<{}>[] = []; |
| 260 | this.value.vnfID.forEach((id: string): void => { |
| 261 | const apiUrl: string = environment.VNFPACKAGESCONTENT_URL + '/' + id; |
| 262 | tempURL.push(this.restService.getResource(apiUrl)); |
| 263 | }); |
| 264 | this.checkScaling(tempURL); |
| 265 | } |
| 266 | |
| 267 | /** |
| 268 | * Used to forkjoin to all the request to send parallely, get the data and check 'scaling-aspect' key is present @public |
| 269 | */ |
| 270 | public checkScaling(URLS: Observable<{}>[]): void { |
| 271 | forkJoin(URLS).subscribe((data: VNFD[]): void => { |
| 272 | this.vnfDetails = data; |
| 273 | if (this.vnfDetails.length > 0) { |
| 274 | this.vnfDetails.forEach((vnfdData: VNFD): void => { |
| 275 | vnfdData.df.forEach((dfData: DF): void => { |
| 276 | if (!isNullOrUndefined(dfData['scaling-aspect']) && dfData['scaling-aspect'].length > 0) { |
| 277 | this.isScalingPresent = true; |
| 278 | } |
| 279 | }); |
| 280 | }); |
| 281 | } |
| 282 | this.isLoadingNSInstanceAction = false; |
| 283 | if (this.isScalingPresent) { |
| 284 | this.openScaling(); |
| 285 | } else { |
| 286 | this.notifierService.notify('error', this.translateService.instant('SCALINGNOTFOUND')); |
| 287 | } |
| 288 | this.doChanges(); |
| 289 | }); |
| 290 | } |
| 291 | |
| 292 | /** Open the scaling pop-up @public */ |
| 293 | public openScaling(): void { |
| SANDHYA.JS | 0a34dfa | 2023-04-25 23:59:41 +0530 | [diff] [blame] | 294 | // eslint-disable-next-line security/detect-non-literal-fs-filename |
| Barath Kumar R | 07698ab | 2021-03-30 11:50:42 +0530 | [diff] [blame] | 295 | const modalRef: NgbModalRef = this.modalService.open(ScalingComponent, { backdrop: 'static' }); |
| 296 | modalRef.componentInstance.params = { |
| 297 | id: this.instanceID, |
| 298 | vnfID: this.value.vnfID, |
| 299 | nsID: this.value['nsd-id'], |
| 300 | nsd: this.value.nsd, |
| 301 | data: this.vnfDetails |
| 302 | }; |
| 303 | modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => { |
| 304 | if (result) { |
| 305 | this.sharedService.callData(); |
| 306 | } |
| SANDHYA.JS | 0a34dfa | 2023-04-25 23:59:41 +0530 | [diff] [blame] | 307 | }).catch((): void => { |
| 308 | // Catch Navigation Error |
| SANDHYA.JS | 219fe61 | 2024-01-23 15:52:43 +0530 | [diff] [blame] | 309 | }); |
| Barath Kumar R | 07698ab | 2021-03-30 11:50:42 +0530 | [diff] [blame] | 310 | } |
| 311 | |
| SANDHYA.JS | fced3d4 | 2022-04-28 20:28:17 +0530 | [diff] [blame] | 312 | /** To open VM Migration in NS Instances */ |
| 313 | public openVmMigration(): void { |
| SANDHYA.JS | 0a34dfa | 2023-04-25 23:59:41 +0530 | [diff] [blame] | 314 | // eslint-disable-next-line security/detect-non-literal-fs-filename |
| SANDHYA.JS | fced3d4 | 2022-04-28 20:28:17 +0530 | [diff] [blame] | 315 | const modalRef: NgbModalRef = this.modalService.open(VmMigrationComponent, { backdrop: 'static' }); |
| 316 | modalRef.componentInstance.params = { |
| 317 | id: this.instanceID |
| 318 | }; |
| 319 | modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => { |
| 320 | if (result) { |
| 321 | this.sharedService.callData(); |
| 322 | } |
| SANDHYA.JS | 0a34dfa | 2023-04-25 23:59:41 +0530 | [diff] [blame] | 323 | }).catch((): void => { |
| 324 | // Catch Navigation Error |
| SANDHYA.JS | 219fe61 | 2024-01-23 15:52:43 +0530 | [diff] [blame] | 325 | }); |
| SANDHYA.JS | fced3d4 | 2022-04-28 20:28:17 +0530 | [diff] [blame] | 326 | } |
| 327 | |
| SANDHYA.JS | 9914458 | 2022-04-27 17:22:35 +0530 | [diff] [blame] | 328 | /** To open the Ns Update pop-up */ |
| 329 | public openNsUpdate(): void { |
| SANDHYA.JS | 0a34dfa | 2023-04-25 23:59:41 +0530 | [diff] [blame] | 330 | // eslint-disable-next-line security/detect-non-literal-fs-filename |
| SANDHYA.JS | 9914458 | 2022-04-27 17:22:35 +0530 | [diff] [blame] | 331 | const modalRef: NgbModalRef = this.modalService.open(NsUpdateComponent, { backdrop: 'static' }); |
| 332 | modalRef.componentInstance.params = { |
| 333 | id: this.instanceID |
| 334 | }; |
| 335 | modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => { |
| 336 | if (result) { |
| 337 | this.sharedService.callData(); |
| 338 | } |
| SANDHYA.JS | 0a34dfa | 2023-04-25 23:59:41 +0530 | [diff] [blame] | 339 | }).catch((): void => { |
| 340 | // Catch Navigation Error |
| SANDHYA.JS | 219fe61 | 2024-01-23 15:52:43 +0530 | [diff] [blame] | 341 | }); |
| SANDHYA.JS | 9914458 | 2022-04-27 17:22:35 +0530 | [diff] [blame] | 342 | } |
| 343 | |
| SANDHYA.JS | 3d81a28 | 2022-05-02 08:25:39 +0530 | [diff] [blame] | 344 | /** To open the Start, Stop & Rebuild pop-up */ |
| 345 | public openStart(actionType: string): void { |
| SANDHYA.JS | 0a34dfa | 2023-04-25 23:59:41 +0530 | [diff] [blame] | 346 | // eslint-disable-next-line security/detect-non-literal-fs-filename |
| SANDHYA.JS | 3d81a28 | 2022-05-02 08:25:39 +0530 | [diff] [blame] | 347 | const modalRef: NgbModalRef = this.modalService.open(StartStopRebuildComponent, { backdrop: 'static' }); |
| 348 | modalRef.componentInstance.params = { |
| 349 | id: this.instanceID |
| 350 | }; |
| 351 | if (actionType === 'start') { |
| 352 | modalRef.componentInstance.instanceTitle = this.translateService.instant('START'); |
| 353 | } else if (actionType === 'stop') { |
| 354 | modalRef.componentInstance.instanceTitle = this.translateService.instant('STOP'); |
| 355 | } else { |
| 356 | modalRef.componentInstance.instanceTitle = this.translateService.instant('REBUILD'); |
| 357 | } |
| 358 | modalRef.componentInstance.instanceType = actionType; |
| 359 | modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => { |
| 360 | if (result) { |
| 361 | this.sharedService.callData(); |
| 362 | } |
| SANDHYA.JS | 0a34dfa | 2023-04-25 23:59:41 +0530 | [diff] [blame] | 363 | }).catch((): void => { |
| 364 | // Catch Navigation Error |
| SANDHYA.JS | 219fe61 | 2024-01-23 15:52:43 +0530 | [diff] [blame] | 365 | }); |
| SANDHYA.JS | 3d81a28 | 2022-05-02 08:25:39 +0530 | [diff] [blame] | 366 | } |
| 367 | |
| Isabel Lloret | 523d675 | 2025-04-29 08:06:54 +0000 | [diff] [blame^] | 368 | /** Open the show remote console pop-up @public */ |
| 369 | public openConsole(): void { |
| 370 | const modalRef: NgbModalRef = this.modalService.open(ShowVduConsoleComponent, { backdrop: 'static' }); |
| 371 | modalRef.componentInstance.params = { |
| 372 | id: this.instanceID |
| 373 | }; |
| 374 | modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => { |
| 375 | if (result) { |
| 376 | this.sharedService.callData(); |
| 377 | } |
| 378 | }).catch((): void => { |
| 379 | // Catch Navigation Error |
| 380 | }); |
| 381 | } |
| 382 | |
| SANDHYA.JS | 219fe61 | 2024-01-23 15:52:43 +0530 | [diff] [blame] | 383 | /** Open the Healing pop-up @public */ |
| 384 | public openHealing(): void { |
| 385 | // eslint-disable-next-line security/detect-non-literal-fs-filename |
| 386 | const modalRef: NgbModalRef = this.modalService.open(HealingComponent, { backdrop: 'static' }); |
| 387 | modalRef.componentInstance.params = { |
| 388 | id: this.instanceID |
| 389 | }; |
| 390 | modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => { |
| 391 | if (result) { |
| 392 | this.sharedService.callData(); |
| 393 | } |
| 394 | }).catch((): void => { |
| 395 | // Catch Navigation Error |
| 396 | }); |
| SANDHYA.JS | 017df36 | 2022-05-02 06:57:11 +0530 | [diff] [blame] | 397 | } |
| 398 | |
| Barath Kumar R | 07698ab | 2021-03-30 11:50:42 +0530 | [diff] [blame] | 399 | /** |
| 400 | * Check any changes in the child component @public |
| 401 | */ |
| 402 | public doChanges(): void { |
| 403 | setTimeout((): void => { |
| 404 | this.cd.detectChanges(); |
| 405 | }, this.timeOut); |
| 406 | } |
| kumaran.m | 3b4814a | 2020-05-01 19:48:54 +0530 | [diff] [blame] | 407 | } |