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/cdt.application.properties.json | 6 ++--- src/app/test/test.component.ts | 47 +++++++++++++++++---------------- src/environments/environment.ts | 15 +++++++---- 3 files changed, 37 insertions(+), 31 deletions(-) diff --git a/src/app/cdt.application.properties.json b/src/app/cdt.application.properties.json index 899529e..5040526 100644 --- a/src/app/cdt.application.properties.json +++ b/src/app/cdt.application.properties.json @@ -3,6 +3,6 @@ "CONTACT_US_EMAIL": "cdtSupportTeam@yourCompany.com", "CONTACT_US_SUBJECT": "CDT Contact Us" }, - "username": "appc123@appc.onap.org", - "password": "test" -} + "username": "admin", + "password": "admin" +} \ No newline at end of file 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"); diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 4c5df0c..e30faf3 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -29,10 +29,15 @@ export const environment = { production: false, //Environment for PROD - getDesigns: 'http://' + window.location.hostname + ':8282/restconf/operations/design-services:dbservice', - validateTemplate: 'http://' + window.location.hostname + ':8282/restconf/operations/design-services:validator', - testVnf: 'http://' + window.location.hostname + ':8282/restconf/operations/appc-provider-lcm:', - checkTestStatus: 'http://' + window.location.hostname + ':8282/restconf/operations/appc-provider-lcm:action-status' - + /* getDesigns: 'http://' + window.location.hostname + ':8282/restconf/operations/design-services:dbservice', + validateTemplate: 'http://' + window.location.hostname + ':8282/restconf/operations/design-services:validator', + testVnf: 'http://' + window.location.hostname + ':8282/restconf/operations/appc-provider-lcm:', + checkTestStatus: 'http://' + window.location.hostname + ':8282/restconf/operations/appc-provider-lcm:action-status' + */ + // APIs for CORS proxy Service. + getDesigns: 'http://' + window.location.hostname + ':9090/cdtService/getDesigns', + validateTemplate: 'http://' + window.location.hostname + ':9090/cdtService/validateTemplate', + testVnf: 'http://' + window.location.hostname + ':9090/cdtService/testVnf', + checkTestStatus: 'http://' + window.location.hostname + ':9090/cdtService/checkTestStatus' }; \ No newline at end of file -- cgit 1.2.3-korg