From 8b413dccc18d361ac78e0d9f49e1dd761a79a258 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 19 Feb 2020 06:02:26 +0000 Subject: Changes for MDONS usecase Added MDONS creation and Detail show pages and logic Change-Id: If830fc0399af561e712b8deff745c8bd88e8117d Issue-ID: USECASEUI-371 Signed-off-by: root --- .../src/app/core/services/serviceList.service.ts | 28 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'usecaseui-portal/src/app/core/services/serviceList.service.ts') diff --git a/usecaseui-portal/src/app/core/services/serviceList.service.ts b/usecaseui-portal/src/app/core/services/serviceList.service.ts index 1ada669f..945d60c2 100644 --- a/usecaseui-portal/src/app/core/services/serviceList.service.ts +++ b/usecaseui-portal/src/app/core/services/serviceList.service.ts @@ -17,6 +17,7 @@ import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http'; import { Observable } from 'rxjs/Observable'; import { servicesTableData,baseUrl } from '../models/dataInterface'; +import { retry, catchError } from 'rxjs/operators'; @Injectable() export class ServiceListService { @@ -52,11 +53,17 @@ export class ServiceListService { pnfDetail: this.baseUrl + "/uui-sotn/getPnfInfo/", connectivity: this.baseUrl + "/uui-sotn/getConnectivityInfo/", vpnBinding: this.baseUrl + "/uui-sotn/getPinterfaceByVpnId/", + getNIList: this.baseUrl + "/uui-lcm/getAllNI/" }; //The following APIs are optimizable + //get all unni + getAllNI(type) { + return this.http.get(this.url.getNIList+type); + } + // Get all customers getAllCustomers() { return this.http.get(this.url.customers); @@ -89,8 +96,11 @@ export class ServiceListService { } // Create interface createInstance(requestBody, createParams) { - return this.http.post(this.url.createService + createParams, requestBody); + return this.http.post(this.url.createService + createParams, requestBody).pipe( + catchError(this.handleError) + ); } + // NS CreateInstance step one nsCreateInstance(requestBody) { return this.http.post(this.url.ns_createService, requestBody); @@ -136,7 +146,7 @@ export class ServiceListService { inputs: "" }; return this.http.post(this.url.nstemplateParameters, body); - } else if (type == "e2e") { + } else if (type == "e2e" || type == "MDONS") { let params = new HttpParams({ fromObject: {"toscaModelPath":template.toscaModelURL} }); let url = this.url.e2etemplateParameters.replace("*_*", template.uuid); return this.http.get(url,{params}); @@ -209,5 +219,17 @@ export class ServiceListService { return this.http.get(url); } - + + handleError(error) { + let errorMessage = ''; + if (error.error instanceof ErrorEvent) { + // client-side error + errorMessage = `Error: ${error.error.message}`; + } else { + // server-side error + errorMessage = `Error Code: ${error.status}\nMessage: ${error.message}`; + } + console.log("errorMessage : "+errorMessage); + return Observable.throw(error); + } } -- cgit 1.2.3-korg