From 6c7ccba2b14dc4a552999a4d169d107c408fe661 Mon Sep 17 00:00:00 2001 From: "Kumar, Amaresh (ak583p)" Date: Wed, 9 May 2018 22:29:45 +0530 Subject: Added CORS proxy Server endpoint Added CORS proxy endpoint for backend calls to enable connection. Issue-ID: APPC-885 Change-Id: I0bb98feda477cb77312bc707cb52e1296b69245b Signed-off-by: Kumar, Amaresh (ak583p) --- src/app/test/test.component.ts | 47 +++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'src/app/test/test.component.ts') diff --git a/src/app/test/test.component.ts b/src/app/test/test.component.ts index 18d6541..3797c8c 100644 --- a/src/app/test/test.component.ts +++ b/src/app/test/test.component.ts @@ -101,7 +101,7 @@ export class TestComponent implements OnInit { public enableCounterDiv: boolean = false; public enableDownload: boolean = false; private userId = localStorage['userId']; - constructor(private location: Location, private activeRoutes: ActivatedRoute, private notificationService: NotificationService, private nService: NotificationsService, private router: Router, private paramShareService: ParamShareService, private mappingEditorService: MappingEditorService, private httpUtil: HttpUtilService, + constructor (private location: Location, private activeRoutes: ActivatedRoute, private notificationService: NotificationService, private nService: NotificationsService, private router: Router, private paramShareService: ParamShareService, private mappingEditorService: MappingEditorService, private httpUtil: HttpUtilService, private utiltiy: UtilityService, private ngProgress: NgProgress) { } @@ -147,7 +147,7 @@ export class TestComponent implements OnInit { this.enableTestButton = true; this.enablePollButton = true; if (this.subscribe && this.subscribe != undefined) this.subscribe.unsubscribe(); - this.nService.info("Information","Test has been abandoned and polling stopped"); + this.nService.info("Information", "Test has been abandoned and polling stopped"); } @@ -368,7 +368,8 @@ export class TestComponent implements OnInit { this.httpUtil.post( { - url: environment.testVnf + this.getUrlEndPoint(this.action.toLowerCase()), data: this.apiRequest + url: environment.testVnf + "?urlAction=" + this.getUrlEndPoint(this.action.toLowerCase()), + data: this.apiRequest }) .subscribe(resp => { this.apiResponse = JSON.stringify(resp); @@ -376,15 +377,15 @@ export class TestComponent implements OnInit { this.enableTestButton = true; this.ngProgress.done(); }, - error => { - this.nService.error('Error', 'Error in connecting to APPC Server'); - this.enableBrowse = true; - this.enableTestButton = true; - this.enablePollButton = true; - this.enableCounterDiv = false; - if (this.subscribe && this.subscribe != undefined) this.subscribe.unsubscribe(); + error => { + this.nService.error('Error', 'Error in connecting to APPC Server'); + this.enableBrowse = true; + this.enableTestButton = true; + this.enablePollButton = true; + this.enableCounterDiv = false; + if (this.subscribe && this.subscribe != undefined) this.subscribe.unsubscribe(); - }); + }); setTimeout(() => { this.ngProgress.done(); @@ -411,8 +412,8 @@ export class TestComponent implements OnInit { } }, 'action': 'ActionStatus', - 'action-identifiers': { - 'vnf-id' : this.actionIdentifiers['vnf-id'] + 'action-identifiers': { + 'vnf-id': this.actionIdentifiers['vnf-id'] }, 'payload': '{"request-id":' + this.requestId + '}' } @@ -464,16 +465,16 @@ export class TestComponent implements OnInit { } }, - error => { - this.statusResponse = null; - this.showStatusResponseDiv = false; - this.errorResponse = 'Error Connecting to APPC server'; - this.enableCounterDiv = false; - if (this.subscribe && this.subscribe != undefined) { - this.subscribe.unsubscribe(); - this.enablePollButton = true; - } - }); + error => { + this.statusResponse = null; + this.showStatusResponseDiv = false; + this.errorResponse = 'Error Connecting to APPC server'; + this.enableCounterDiv = false; + if (this.subscribe && this.subscribe != undefined) { + this.subscribe.unsubscribe(); + this.enablePollButton = true; + } + }); } else { this.nService.error("Error", "Please enter vnf Id & request Id"); -- cgit 1.2.3-korg