blob: 5ddb1975e8f2b533c77e4e318be319e786d1fc2d [file] [log] [blame]
kumaran.m3b4814a2020-05-01 19:48:54 +05301/*
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 Primitive Component
20 */
21import { Component, Injector, Input, OnInit } from '@angular/core';
22import { AbstractControl, FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
23import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
24import { TranslateService } from '@ngx-translate/core';
25import { NotifierService } from 'angular-notifier';
Barath Kumar R063a3f12020-12-29 16:35:09 +053026import { APIURLHEADER, ERRORDATA, PRIMITIVEDATA, PRIMITIVETYPES, URLPARAMS } from 'CommonModel';
kumaran.m3b4814a2020-05-01 19:48:54 +053027import { DataService } from 'DataService';
28import { environment } from 'environment';
Barath Kumar R063a3f12020-12-29 16:35:09 +053029import { KDUPRIMITIVELEVEL, NSData, VDUPRIMITIVELEVEL, VNFPROFILE } from 'NSDModel';
kumaran.m3b4814a2020-05-01 19:48:54 +053030import { NSPrimitiveParams } from 'NSInstanceModel';
31import { RestService } from 'RestService';
SANDHYA.JSc84f1122024-06-04 21:50:03 +053032import { SharedService, isNullOrUndefined } from 'SharedService';
Barath Kumar R063a3f12020-12-29 16:35:09 +053033import { CONFIGPRIMITIVE, DF, VDUCONFIG, VDUPROFILE, VNFCONFIG, VNFD } from 'VNFDModel';
SANDHYA.JS1584e3e2022-10-31 20:11:50 +053034import { VNFInstanceDetails } from 'VNFInstanceModel';
kumaran.m3b4814a2020-05-01 19:48:54 +053035
36/**
37 * Creating component
38 * @Component takes NSPrimitiveComponent.html as template url
39 */
40@Component({
41 templateUrl: './NSPrimitiveComponent.html',
42 styleUrls: ['./NSPrimitiveComponent.scss']
43})
44/** Exporting a class @exports NSPrimitiveComponent */
45export class NSPrimitiveComponent implements OnInit {
46 /** Form valid on submit trigger @public */
47 public submitted: boolean = false;
48
49 /** To inject services @public */
50 public injector: Injector;
51
52 /** Instance for active modal service @public */
53 public activeModal: NgbActiveModal;
54
55 /** FormGroup instance added to the form @ html @public */
56 public primitiveForm: FormGroup;
57
58 /** Primitive params array @public */
59 public primitiveParams: FormArray;
60
61 /** Variable set for twoway binding @public */
62 public nsdId: string;
63
64 /** Check the loading results @public */
65 public isLoadingResults: boolean = false;
66
67 /** Give the message for the loading @public */
68 public message: string = 'PLEASEWAIT';
69
70 /** Contains list of primitive parameter @public */
71 public primitiveParameter: {}[] = [];
72
73 /** Input contains component objects @public */
74 @Input() public params: URLPARAMS;
75
76 /** Contains list of primitive actions @public */
77 public primitiveList: {}[];
78
79 /** Contains objects that is used to hold types of primitive @public */
Barath Kumar R063a3f12020-12-29 16:35:09 +053080 public primitiveTypeList: PRIMITIVETYPES[] = [];
kumaran.m3b4814a2020-05-01 19:48:54 +053081
82 /** Model value used to hold selected primitive type @public */
83 public primitiveType: string;
84
Barath Kumar R6e96d1b2020-07-10 12:10:15 +053085 /** Contains list of VDU primitive lists @public */
Barath Kumar R063a3f12020-12-29 16:35:09 +053086 public vduList: VDUPROFILE[];
Barath Kumar R6e96d1b2020-07-10 12:10:15 +053087
Barath Kumar R5d75d512020-09-02 17:00:07 +053088 /** Contains list of KDU primitive lists @public */
89 public kduList: {}[];
90
SANDHYA.JS1584e3e2022-10-31 20:11:50 +053091 /** Array holds MemberVNFIndex values @public */
92 public memberVnfIndex: {}[] = [];
93
94 /** Array holds VNFR Data filtered with nsr ID @public */
95 public nsIdFilteredData: {}[] = [];
96
97 /** Items for the memberVNFIndex data @public */
98 public memberTypes: {}[];
99
kumaran.m3b4814a2020-05-01 19:48:54 +0530100 /** FormBuilder instance added to the formBuilder @private */
101 private formBuilder: FormBuilder;
102
103 /** Utilizes rest service for any CRUD operations @private */
104 private restService: RestService;
105
106 /** packages data service collections @private */
107 private dataService: DataService;
108
109 /** Contains tranlsate instance @private */
110 private translateService: TranslateService;
111
112 /** Notifier service to popup notification @private */
113 private notifierService: NotifierService;
114
115 /** Contains all methods related to shared @private */
116 private sharedService: SharedService;
117
118 /** Contains objects that is used to convert key/value pair @private */
119 private objectPrimitiveParams: {} = {};
120
121 constructor(injector: Injector) {
122 this.injector = injector;
123 this.restService = this.injector.get(RestService);
124 this.dataService = this.injector.get(DataService);
125 this.translateService = this.injector.get(TranslateService);
126 this.notifierService = this.injector.get(NotifierService);
127 this.sharedService = this.injector.get(SharedService);
128 this.activeModal = this.injector.get(NgbActiveModal);
129 this.formBuilder = this.injector.get(FormBuilder);
Barath Kumar R6e96d1b2020-07-10 12:10:15 +0530130 this.primitiveTypeList = [
131 {
Barath Kumar R54d693c2020-07-13 20:54:13 +0530132 title: this.translateService.instant('NSPRIMITIVE'),
133 value: 'NS_Primitive'
134 },
135 {
Barath Kumar R6e96d1b2020-07-10 12:10:15 +0530136 title: this.translateService.instant('VNFPRIMITIVE'),
137 value: 'VNF_Primitive'
138 },
139 {
140 title: this.translateService.instant('VDUPRIMITIVE'),
141 value: 'VDU_Primitive'
Barath Kumar R5d75d512020-09-02 17:00:07 +0530142 },
143 {
144 title: this.translateService.instant('KDUPRIMITIVE'),
145 value: 'KDU_Primitive'
Barath Kumar R6e96d1b2020-07-10 12:10:15 +0530146 }
147 ];
kumaran.m3b4814a2020-05-01 19:48:54 +0530148 }
149
Barath Kumar R063a3f12020-12-29 16:35:09 +0530150 /** convenience getter for easy access to form fields */
151 get f(): FormGroup['controls'] { return this.primitiveForm.controls; }
152
kumaran.m3b4814a2020-05-01 19:48:54 +0530153 /**
154 * Lifecyle Hooks the trigger before component is instantiate
155 */
156 public ngOnInit(): void {
157 /** Setting up initial value for NSD */
SANDHYA.JSa53db0c2025-05-23 11:44:39 +0530158 this.nsdId = this.params.nsID;
SANDHYA.JS1584e3e2022-10-31 20:11:50 +0530159 this.getMemberVnfIndex();
kumaran.m3b4814a2020-05-01 19:48:54 +0530160 this.initializeForm();
161 }
162
kumaran.m3b4814a2020-05-01 19:48:54 +0530163 /** initialize Forms @public */
164 public initializeForm(): void {
165 this.primitiveForm = this.formBuilder.group({
166 primitive: [null, [Validators.required]],
Barath Kumar R063a3f12020-12-29 16:35:09 +0530167 member_vnf_index: [null, [Validators.required]],
Barath Kumar R6e96d1b2020-07-10 12:10:15 +0530168 vdu_id: [null, [Validators.required]],
Barath Kumar R5d75d512020-09-02 17:00:07 +0530169 kdu_name: [null, [Validators.required]],
kumaran.m3b4814a2020-05-01 19:48:54 +0530170 primitive_params: this.formBuilder.array([this.primitiveParamsBuilder()])
171 });
172 }
173
174 /** Generate primitive params @public */
175 public primitiveParamsBuilder(): FormGroup {
176 return this.formBuilder.group({
177 primitive_params_name: [null, [Validators.required]],
178 primitive_params_value: ['', [Validators.required]]
179 });
180 }
181
182 /** Handle FormArray Controls @public */
183 public getControls(): AbstractControl[] {
184 return (this.getFormControl('primitive_params') as FormArray).controls;
185 }
186
187 /** Push all primitive params on user's action @public */
188 public createPrimitiveParams(): void {
189 this.primitiveParams = this.getFormControl('primitive_params') as FormArray;
190 this.primitiveParams.push(this.primitiveParamsBuilder());
191 }
192
193 /** Remove primitive params on user's action @public */
194 public removePrimitiveParams(index: number): void {
195 this.primitiveParams.removeAt(index);
196 }
197
Barath Kumar R5d75d512020-09-02 17:00:07 +0530198 /** Execute Primitive @public */
199 public execPrimitive(): void {
kumaran.m3b4814a2020-05-01 19:48:54 +0530200 this.submitted = true;
201 this.objectPrimitiveParams = {};
202 this.sharedService.cleanForm(this.primitiveForm);
203 if (this.primitiveForm.invalid) { return; } // Proceed, onces form is valid
Barath Kumar R063a3f12020-12-29 16:35:09 +0530204 this.primitiveForm.value.primitive_params.forEach((params: NSPrimitiveParams): void => {
kumaran.m3b4814a2020-05-01 19:48:54 +0530205 if (params.primitive_params_name !== null && params.primitive_params_value !== '') {
206 this.objectPrimitiveParams[params.primitive_params_name] = params.primitive_params_value;
207 }
208 });
209 //Prepare primitive params
210 const primitiveParamsPayLoads: {} = {
211 primitive: this.primitiveForm.value.primitive,
212 primitive_params: this.objectPrimitiveParams
213 };
214 if (this.primitiveType === 'VNF_Primitive') {
SANDHYA.JS0a34dfa2023-04-25 23:59:41 +0530215 // eslint-disable-next-line @typescript-eslint/dot-notation
Barath Kumar R063a3f12020-12-29 16:35:09 +0530216 primitiveParamsPayLoads['member_vnf_index'] = this.primitiveForm.value.member_vnf_index;
kumaran.m3b4814a2020-05-01 19:48:54 +0530217 }
Barath Kumar R6e96d1b2020-07-10 12:10:15 +0530218 if (this.primitiveType === 'VDU_Primitive') {
SANDHYA.JS0a34dfa2023-04-25 23:59:41 +0530219 // eslint-disable-next-line @typescript-eslint/dot-notation
Barath Kumar R063a3f12020-12-29 16:35:09 +0530220 primitiveParamsPayLoads['member_vnf_index'] = this.primitiveForm.value.member_vnf_index;
SANDHYA.JS0a34dfa2023-04-25 23:59:41 +0530221 // eslint-disable-next-line @typescript-eslint/dot-notation
Barath Kumar R6e96d1b2020-07-10 12:10:15 +0530222 primitiveParamsPayLoads['vdu_id'] = this.primitiveForm.value.vdu_id;
223 }
Barath Kumar R5d75d512020-09-02 17:00:07 +0530224 if (this.primitiveType === 'KDU_Primitive') {
SANDHYA.JS0a34dfa2023-04-25 23:59:41 +0530225 // eslint-disable-next-line @typescript-eslint/dot-notation
Barath Kumar R063a3f12020-12-29 16:35:09 +0530226 primitiveParamsPayLoads['member_vnf_index'] = this.primitiveForm.value.member_vnf_index;
SANDHYA.JS0a34dfa2023-04-25 23:59:41 +0530227 // eslint-disable-next-line @typescript-eslint/dot-notation
Barath Kumar R5d75d512020-09-02 17:00:07 +0530228 primitiveParamsPayLoads['kdu_name'] = this.primitiveForm.value.kdu_name;
229 }
kumaran.m3b4814a2020-05-01 19:48:54 +0530230 const apiURLHeader: APIURLHEADER = {
231 url: environment.NSDINSTANCES_URL + '/' + this.nsdId + '/action'
232 };
233 this.isLoadingResults = true;
Barath Kumar R063a3f12020-12-29 16:35:09 +0530234 this.restService.postResource(apiURLHeader, primitiveParamsPayLoads).subscribe((result: {}): void => {
kumaran.m3b4814a2020-05-01 19:48:54 +0530235 this.activeModal.dismiss();
236 this.notifierService.notify('success', this.translateService.instant('PAGE.NSPRIMITIVE.EXECUTEDSUCCESSFULLY'));
237 this.isLoadingResults = false;
Barath Kumar R063a3f12020-12-29 16:35:09 +0530238 }, (error: ERRORDATA): void => {
kumaran.m3b4814a2020-05-01 19:48:54 +0530239 this.isLoadingResults = false;
240 this.restService.handleError(error, 'post');
241 });
242 }
SANDHYA.JS1584e3e2022-10-31 20:11:50 +0530243 /** Getting MemberVnfIndex using VNFDescriptor API @public */
244 public getMemberVnfIndex(): void {
245 const vnfInstanceData: {}[] = [];
246 this.restService.getResource(environment.VNFINSTANCES_URL).subscribe((vnfInstancesData: VNFInstanceDetails[]): void => {
247 vnfInstancesData.forEach((vnfData: VNFInstanceDetails): void => {
248 const vnfDataObj: {} =
249 {
250 'vnf-ref': vnfData['vnfd-ref'],
251 'vnf-id': vnfData._id,
252 'member-index': vnfData['member-vnf-index-ref']
253 };
254 vnfInstanceData.push(vnfDataObj);
255 });
256 for (const id of this.params.id) {
257 this.nsIdFilteredData = vnfInstanceData.filter((vnfdData: {}[]): boolean => vnfdData['vnf-id'] === id);
258 this.nsIdFilteredData.forEach((resVNF: {}[]): void => {
259 const assignMemberIndex: {} = {
260 id: resVNF['member-index'],
261 'vnf-ref': resVNF['vnf-ref']
262 };
263 this.memberVnfIndex.push(assignMemberIndex);
264 });
265 }
266 this.memberTypes = this.memberVnfIndex;
267 this.isLoadingResults = false;
268 }, (error: ERRORDATA): void => {
269 this.restService.handleError(error, 'get');
270 this.isLoadingResults = false;
271 });
272 }
kumaran.m3b4814a2020-05-01 19:48:54 +0530273 /** Primitive type change event @public */
Barath Kumar R063a3f12020-12-29 16:35:09 +0530274 public primitiveTypeChange(data: PRIMITIVETYPES): void {
kumaran.m3b4814a2020-05-01 19:48:54 +0530275 this.primitiveList = [];
276 this.primitiveParameter = [];
277 this.initializeForm();
278 if (data.value === 'NS_Primitive') {
Barath Kumar R54d693c2020-07-13 20:54:13 +0530279 this.getNSInfo(this.params.name);
Barath Kumar R063a3f12020-12-29 16:35:09 +0530280 this.setUpdateValueandValidation('member_vnf_index');
Barath Kumar R5d75d512020-09-02 17:00:07 +0530281 }
282 if (data.value === 'VNF_Primitive' || data.value === 'KDU_Primitive' || data.value === 'NS_Primitive') {
283 this.setUpdateValueandValidation('vdu_id');
284 }
285 if (data.value === 'VDU_Primitive' || data.value === 'VNF_Primitive' || data.value === 'NS_Primitive') {
286 this.setUpdateValueandValidation('kdu_name');
kumaran.m3b4814a2020-05-01 19:48:54 +0530287 }
288 }
289 /** Member index change event */
Barath Kumar R063a3f12020-12-29 16:35:09 +0530290 public indexChange(data: VNFPROFILE, getType?: string): void {
Barath Kumar R6e96d1b2020-07-10 12:10:15 +0530291 this.getFormControl('vdu_id').setValue(null);
Barath Kumar R5d75d512020-09-02 17:00:07 +0530292 this.getFormControl('kdu_name').setValue(null);
SANDHYA.JS1584e3e2022-10-31 20:11:50 +0530293 if (data['vnf-ref'] !== null) {
294 this.getVnfdInfo(data['vnf-ref'], getType);
kumaran.m3b4814a2020-05-01 19:48:54 +0530295 } else {
296 this.primitiveList = [];
297 this.getFormControl('primitive').setValue(null);
298 this.primitiveParameter = [];
299 }
300 }
Barath Kumar R5d75d512020-09-02 17:00:07 +0530301 /** Get VDU/KDU primitive List for the selected event @public */
302 public getPrimitiveList(data: {}, selectedType: string): void {
303 this.primitiveList = data[selectedType + '-configuration']['config-primitive'];
Barath Kumar R6e96d1b2020-07-10 12:10:15 +0530304 }
kumaran.m3b4814a2020-05-01 19:48:54 +0530305 /** Primivtive change event */
Barath Kumar R063a3f12020-12-29 16:35:09 +0530306 public primitiveChange(data: PRIMITIVEDATA): void {
kumaran.m3b4814a2020-05-01 19:48:54 +0530307 this.primitiveParameter = [];
308 const formArr: FormArray = this.getFormControl('primitive_params') as FormArray;
309 formArr.controls = [];
310 this.createPrimitiveParams();
311 if (data) {
312 this.updatePrimitive(data);
313 }
314 }
Barath Kumar R6e96d1b2020-07-10 12:10:15 +0530315 /** Generate vdu section @public */
Barath Kumar R1a34b832021-03-05 11:32:19 +0530316 public generateVDUData(vduConfig: VDUCONFIG): VDUPROFILE {
Barath Kumar R6e96d1b2020-07-10 12:10:15 +0530317 return {
Barath Kumar R1a34b832021-03-05 11:32:19 +0530318 id: vduConfig.id,
319 name: vduConfig.id,
320 'vdu-configuration': vduConfig
Barath Kumar R6e96d1b2020-07-10 12:10:15 +0530321 };
322 }
Barath Kumar R5d75d512020-09-02 17:00:07 +0530323 /** Generate kdu section @public */
Barath Kumar R1a34b832021-03-05 11:32:19 +0530324 public generateKDUData(kduData: KDUPRIMITIVELEVEL, kduConfig: VDUCONFIG): KDUPRIMITIVELEVEL {
Barath Kumar R5d75d512020-09-02 17:00:07 +0530325 return {
326 name: kduData.name,
327 'juju-bundle': kduData['juju-bundle'],
Barath Kumar R1a34b832021-03-05 11:32:19 +0530328 'kdu-configuration': kduConfig
Barath Kumar R5d75d512020-09-02 17:00:07 +0530329 };
330 }
331 /** Used to set the validation and value and update the validation and value @public */
332 public setUpdateValueandValidation(formName: string): void {
333 this.getFormControl(formName).setValidators([]);
334 this.getFormControl(formName).updateValueAndValidity();
335 }
kumaran.m3b4814a2020-05-01 19:48:54 +0530336 /** Update primitive value based on parameter */
Barath Kumar R063a3f12020-12-29 16:35:09 +0530337 private updatePrimitive(primitive: PRIMITIVEDATA): void {
kumaran.m3b4814a2020-05-01 19:48:54 +0530338 if (primitive.parameter) {
339 this.primitiveParameter = primitive.parameter;
340 } else {
341 this.primitiveParameter = [];
342 const formArr: AbstractControl[] = this.getControls();
Barath Kumar R063a3f12020-12-29 16:35:09 +0530343 formArr.forEach((formGp: FormGroup): void => {
kumaran.m3b4814a2020-05-01 19:48:54 +0530344 formGp.controls.primitive_params_name.setValidators([]);
345 formGp.controls.primitive_params_name.updateValueAndValidity();
346 formGp.controls.primitive_params_value.setValidators([]);
347 formGp.controls.primitive_params_value.updateValueAndValidity();
348 });
349 }
350 }
351 /** Get primivitive actions from vnfd data */
Barath Kumar R6e96d1b2020-07-10 12:10:15 +0530352 private getVnfdInfo(vnfdRef: string, getType?: string): void {
kumaran.m3b4814a2020-05-01 19:48:54 +0530353 this.primitiveList = [];
354 this.primitiveParameter = [];
355 this.getFormControl('primitive').setValue(null);
Barath Kumar R86504d22021-02-19 18:34:44 +0530356 const apiUrl: string = environment.VNFPACKAGES_URL + '?id=' + vnfdRef;
kumaran.m3b4814a2020-05-01 19:48:54 +0530357 this.isLoadingResults = true;
Barath Kumar R1a34b832021-03-05 11:32:19 +0530358 this.restService.getResource(apiUrl).subscribe((vnfdInfo: VNFD[]): void => {
SANDHYA.JS1584e3e2022-10-31 20:11:50 +0530359 const vnfInstances: VNFD = vnfdInfo[0];
360 if (!isNullOrUndefined(vnfInstances.df)) {
361 this.getFormControl('vdu_id').setValidators([]);
362 this.getFormControl('kdu_name').setValidators([]);
363 vnfInstances.df.forEach((df: DF): void => {
364 if (df['lcm-operations-configuration'] !== undefined) {
365 if (df['lcm-operations-configuration']['operate-vnf-op-config'] !== undefined) {
366 const day12Operation: VDUCONFIG[] = df['lcm-operations-configuration']['operate-vnf-op-config']['day1-2'];
367 if (day12Operation !== undefined) {
368 const vnfprimitiveList: VNFCONFIG = day12Operation
369 .filter((itemData: VNFCONFIG): boolean => itemData.id === vnfInstances.id)[0];
370 if (vnfprimitiveList !== undefined) {
371 this.primitiveList = vnfprimitiveList['config-primitive'];
372 }
373 /** VDU Primitive */
374 if (getType === 'VDU_Primitive') {
375 this.kduList = [];
376 this.vduList = [];
377 this.primitiveList = [];
SANDHYA.JSa53db0c2025-05-23 11:44:39 +0530378 df['vdu-profile']?.forEach((vduProfile: VDUPROFILE): void => {
379 day12Operation?.forEach((element: VDUCONFIG): void => {
SANDHYA.JS1584e3e2022-10-31 20:11:50 +0530380 if (element.id === vduProfile.id) {
381 const vduDataObj: VDUPROFILE = this.generateVDUData(element);
382 this.vduList.push(vduDataObj);
383 }
384 });
385 });
386 }
387 /** KDU Primitive */
388 if (getType === 'KDU_Primitive') {
389 this.kduList = [];
390 this.vduList = [];
391 this.primitiveList = [];
392 if (!isNullOrUndefined(vnfInstances.kdu)) {
SANDHYA.JSa53db0c2025-05-23 11:44:39 +0530393 vnfInstances.kdu?.forEach((kduData: KDUPRIMITIVELEVEL): void => {
394 day12Operation?.forEach((element: VDUCONFIG): void => {
SANDHYA.JS1584e3e2022-10-31 20:11:50 +0530395 if (element.id === kduData.name) {
396 const kduDataObj: KDUPRIMITIVELEVEL = this.generateKDUData(kduData, element);
397 this.kduList.push(kduDataObj);
Barath Kumar R1a34b832021-03-05 11:32:19 +0530398 }
399 });
400 });
401 }
Barath Kumar R1a34b832021-03-05 11:32:19 +0530402 }
403 }
Barath Kumar R063a3f12020-12-29 16:35:09 +0530404 }
SANDHYA.JS1584e3e2022-10-31 20:11:50 +0530405 }
406 });
407 }
408 this.isLoadingResults = false;
409 }, (error: ERRORDATA): void => {
410 this.isLoadingResults = false;
411 this.restService.handleError(error, 'get');
412 });
kumaran.m3b4814a2020-05-01 19:48:54 +0530413 }
Barath Kumar R54d693c2020-07-13 20:54:13 +0530414 /** Get primivitive actions from NSD data */
415 private getNSInfo(nsdRef: string): void {
416 this.primitiveList = [];
417 this.primitiveParameter = [];
418 this.getFormControl('primitive').setValue(null);
Barath Kumar R86504d22021-02-19 18:34:44 +0530419 const apiUrl: string = environment.NSDESCRIPTORS_URL + '?id=' + nsdRef;
Barath Kumar R54d693c2020-07-13 20:54:13 +0530420 this.isLoadingResults = true;
421 this.restService.getResource(apiUrl)
Barath Kumar R063a3f12020-12-29 16:35:09 +0530422 .subscribe((nsdInfo: {}): void => {
Barath Kumar Rd3ce0c52020-08-13 11:44:01 +0530423 if (!isNullOrUndefined(nsdInfo[0]['ns-configuration'])) {
424 this.primitiveList = !isNullOrUndefined(nsdInfo[0]['ns-configuration']['config-primitive']) ?
Barath Kumar R5d75d512020-09-02 17:00:07 +0530425 nsdInfo[0]['ns-configuration']['config-primitive'] : [];
Barath Kumar Rd3ce0c52020-08-13 11:44:01 +0530426 } else {
427 this.primitiveList = [];
428 }
Barath Kumar R54d693c2020-07-13 20:54:13 +0530429 this.isLoadingResults = false;
Barath Kumar R063a3f12020-12-29 16:35:09 +0530430 }, (error: ERRORDATA): void => {
Barath Kumar R54d693c2020-07-13 20:54:13 +0530431 this.isLoadingResults = false;
432 this.restService.handleError(error, 'get');
433 });
434 }
kumaran.m3b4814a2020-05-01 19:48:54 +0530435 /** Used to get the AbstractControl of controlName passed @private */
436 private getFormControl(controlName: string): AbstractControl {
SANDHYA.JS0a34dfa2023-04-25 23:59:41 +0530437 // eslint-disable-next-line security/detect-object-injection
kumaran.m3b4814a2020-05-01 19:48:54 +0530438 return this.primitiveForm.controls[controlName];
439 }
440}