diff options
Diffstat (limited to 'usecaseui-portal/src/app/views')
6 files changed, 75 insertions, 52 deletions
diff --git a/usecaseui-portal/src/app/views/management/customer/customer.component.ts b/usecaseui-portal/src/app/views/management/customer/customer.component.ts index 78d4f145..6858987f 100644 --- a/usecaseui-portal/src/app/views/management/customer/customer.component.ts +++ b/usecaseui-portal/src/app/views/management/customer/customer.component.ts @@ -13,9 +13,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Component, OnInit, ViewChild } from '@angular/core' -import { ManagemencsService } from '../../../core/services/managemencs.service' -import { Observable } from 'rxjs' +import {Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core'; +import { ManagemencsService } from '../../../core/services/managemencs.service'; +import { Observable } from 'rxjs'; +import {NzMessageService} from "ng-zorro-antd"; @Component({ selector: 'app-customer', @@ -29,8 +30,12 @@ export class CustomerComponent implements OnInit { public chose = '' resizeMark - constructor (private managemencs: ManagemencsService) {} - + constructor( + private managemencs: ManagemencsService, + private message: NzMessageService, + ) { + } + @Output() closeCustomer = new EventEmitter(); ngOnInit () { this.getAllCustomers() this.resizeMark = Observable.fromEvent(window, 'resize').subscribe( @@ -47,7 +52,7 @@ export class CustomerComponent implements OnInit { ngOnDestroy () { this.resizeMark.unsubscribe() } - + isCustomerEmpty = false; AllCustomersdata = [] AllServiceTypes = [] customerber = [] @@ -61,16 +66,24 @@ export class CustomerComponent implements OnInit { deleteCustomerModelVisible = false deleteServiceTypeModelVisible = false getAllCustomers () { - this.managemencs.getAllCustomers().subscribe(data => { - this.AllCustomersdata = data.map(item => { - return { name: item['subscriber-name'], id: item['global-customer-id'] } - }) - this.selectCustomer = this.AllCustomersdata[0] - this.serviceInit['customer'] = this.AllCustomersdata[0].name - this.getCustomersPie() - this.getServiceTypes(this.selectCustomer) - this.getCustomersColumn(this.selectCustomer) - }) + this.managemencs.getAllCustomers().subscribe((data) => { + if(data.length!==0){ + this.AllCustomersdata = data.map((item) => { + return { name: item["subscriber-name"], id: item["global-customer-id"] } + }); + this.selectCustomer = this.AllCustomersdata[0]; + this.serviceInit["customer"] = this.AllCustomersdata[0].name; + this.getCustomersPie(); + this.getServiceTypes(this.selectCustomer); + this.getCustomersColumn(this.selectCustomer); + }else { + this.message.info('Customer has not been created in ONAP.' + + 'Please create customer and its service type!'); + setTimeout(()=>{ + this.closeCustomer.emit(this.isCustomerEmpty = true); + },1000) + } + }) } // Get all servicetype diff --git a/usecaseui-portal/src/app/views/management/management.component.html b/usecaseui-portal/src/app/views/management/management.component.html index 4e0ac36f..3b42d20f 100644 --- a/usecaseui-portal/src/app/views/management/management.component.html +++ b/usecaseui-portal/src/app/views/management/management.component.html @@ -33,6 +33,6 @@ </div> </div> <div *ngIf="!nocuster"> - <app-customer></app-customer> + <app-customer (closeCustomer)="closeCustomer($event)"></app-customer> </div> </div>
\ No newline at end of file diff --git a/usecaseui-portal/src/app/views/management/management.component.ts b/usecaseui-portal/src/app/views/management/management.component.ts index 727de636..75ce4de7 100644 --- a/usecaseui-portal/src/app/views/management/management.component.ts +++ b/usecaseui-portal/src/app/views/management/management.component.ts @@ -13,9 +13,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Component, OnInit, HostBinding } from '@angular/core' -import { showHideAnimate, slideToRight } from '../../shared/utils/animates' -import { ManagemencsService } from '../../core/services/managemencs.service' +import { Component, OnInit, HostBinding } from '@angular/core'; +import { showHideAnimate, slideToRight } from '../../shared/utils/animates'; +import { ManagemencsService } from '../../core/services/managemencs.service'; +import {NzMessageService} from "ng-zorro-antd"; @Component({ selector: 'app-management', @@ -26,10 +27,13 @@ import { ManagemencsService } from '../../core/services/managemencs.service' export class ManagementComponent implements OnInit { @HostBinding('@routerAnimate') routerAnimateState //Routing animation - nocuster: boolean - firstCustomer: string + nocuster: boolean = true; + firstCustomer: string = ""; - constructor (private managemencs: ManagemencsService) {} + constructor( + private managemencs: ManagemencsService, + private message: NzMessageService, + ) { } ngOnInit () { this.getAllCustomers() @@ -38,7 +42,7 @@ export class ManagementComponent implements OnInit { // Get all customers getAllCustomers () { this.managemencs.getAllCustomers().subscribe(data => { - this.nocuster = data.length > 0 ? false : true + this.nocuster = data.length !== 0 ? false : true; }) } createNewCustomer (customer) { @@ -51,13 +55,17 @@ export class ManagementComponent implements OnInit { this.managemencs.createCustomer(customer, createParams).subscribe(data => { if (data['status'] == 'SUCCESS') { this.nocuster = false - } else { - this.nocuster = true - console.log(data, 'Interface returned error') + } else { + this.nocuster = true; + this.clearCustomerInput(); + this.message.error(data["errorMessage"]); } }) } clearCustomerInput () { this.firstCustomer = '' } + closeCustomer(isClose){ + this.nocuster = isClose; + } } diff --git a/usecaseui-portal/src/app/views/services/services-list/ccvpn-creation/ccvpn-creation.component.ts b/usecaseui-portal/src/app/views/services/services-list/ccvpn-creation/ccvpn-creation.component.ts index abbe6d6a..7ac17b65 100644 --- a/usecaseui-portal/src/app/views/services/services-list/ccvpn-creation/ccvpn-creation.component.ts +++ b/usecaseui-portal/src/app/views/services/services-list/ccvpn-creation/ccvpn-creation.component.ts @@ -521,8 +521,8 @@ export class CcvpnCreationComponent implements OnInit { siteImage = []; tpImage = []; imgmap = { - '1': '../../../assets/images/domain1.png', - '2': '../../../assets/images/site.png' + '1': 'assets/images/domain1.png', + '2': 'assets/images/site.png' }; drawImage(sitelist) { diff --git a/usecaseui-portal/src/app/views/services/services-list/e2e-detail/e2e-detail.component.ts b/usecaseui-portal/src/app/views/services/services-list/e2e-detail/e2e-detail.component.ts index ca49a6b9..ddfac403 100644 --- a/usecaseui-portal/src/app/views/services/services-list/e2e-detail/e2e-detail.component.ts +++ b/usecaseui-portal/src/app/views/services/services-list/e2e-detail/e2e-detail.component.ts @@ -68,9 +68,9 @@ export class E2eDetailComponent implements OnInit { }; imgmap = { - '1': '../../../../assets/images/create-e2e.png', - '2': '../../../../assets/images/create-ns.png', - '3': '../../../../assets/images/create-vnf.png', + '1': 'assets/images/create-e2e.png', + '2': 'assets/images/create-ns.png', + '3': 'assets/images/create-vnf.png', }; getKeys(item) { @@ -83,7 +83,6 @@ export class E2eDetailComponent implements OnInit { if (this.detailParams.serviceDomain == 'E2E Service') { this.input_parameters = JSON.stringify(this.detailParams['input-parameters']); this.input_parameters = JSON.parse(this.input_parameters); - this.service = { name: this.input_parameters.service.name, description: this.input_parameters.service.description, @@ -121,6 +120,7 @@ export class E2eDetailComponent implements OnInit { } } else if (this.detailParams.serviceDomain == 'Network Service') { + console.log(this.detailParams,"---this.detailParams--ns"); this.ns_service = { name: this.detailParams.name || this.detailParams['service-instance-name'], description: this.detailParams.description || null diff --git a/usecaseui-portal/src/app/views/services/services-list/services-list.component.ts b/usecaseui-portal/src/app/views/services/services-list/services-list.component.ts index e6aa64fb..8ee1785b 100644 --- a/usecaseui-portal/src/app/views/services/services-list/services-list.component.ts +++ b/usecaseui-portal/src/app/views/services/services-list/services-list.component.ts @@ -367,38 +367,38 @@ export class ServicesListComponent implements OnInit { }) this.tableData.forEach(item => { if (item.serviceDomain === 'E2E Service') { - if (item.operationResult === 2001) { + if (Number(item.operationResult) === 2001) { this.serviceNunber[0]["Success"] += 1; - } else if (item.operationResult === 2002) { + } else if (Number(item.operationResult) === 2002) { this.serviceNunber[0]["failed"] += 1; - } else if (item.operationResult === 2003) { + } else if (Number(item.operationResult) === 2003) { this.serviceNunber[0]["InProgress"] += 1; } } else if (item.serviceDomain === 'Network Service') { - if (item.operationResult === 2001) { + if (Number(item.operationResult) === 2001) { this.serviceNunber[1]["Success"] += 1; - } else if (item.operationResult === 2002) { + } else if (Number(item.operationResult) === 2002) { this.serviceNunber[1]["failed"] += 1; - } else if (item.operationResult === 2003) { + } else if (Number(item.operationResult) === 2003) { this.serviceNunber[1]["InProgress"] += 1; } } else if (item.serviceDomain === 'CCVPN') { - if (item.operationResult === 2001) { + if (Number(item.operationResult) === 2001) { this.serviceNunber[2]["Success"] += 1; - } else if (item.operationResult === 2002) { + } else if (Number(item.operationResult) === 2002) { this.serviceNunber[2]["failed"] += 1; - } else if (item.operationResult === 2003) { + } else if (Number(item.operationResult) === 2003) { this.serviceNunber[2]["InProgress"] += 1; } } else if (item.serviceDomain === 'MDONS') { - if (item.operationResult === "2001") { + if (Number(item.operationResult) === 2001) { this.serviceNunber[3]["Success"] += 1; - } else if (item.operationResult === "2002") { + } else if (Number(item.operationResult) === 2002) { this.serviceNunber[3]["failed"] += 1; - } else if (item.operationResult === "2003") { + } else if (Number(item.operationResult) === 2003) { this.serviceNunber[3]["InProgress"] += 1; } } @@ -513,13 +513,15 @@ export class ServicesListComponent implements OnInit { service["customer"] = this.customerSelected; service["serviceType"] = this.serviceTypeSelected; - service.childServiceInstances.forEach((item) => { - if (item.serviceDomain === "SITE") { - service.siteSer.push(item); - } else if (item.serviceDomain === "SDWAN") { - service.sdwanSer.push(item); - } - }) + if(service.childServiceInstances !== undefined){ + service.childServiceInstances.forEach((item) => { + if (item.serviceDomain === "SITE") { + service.siteSer.push(item); + } else if (item.serviceDomain === "SDWAN") { + service.sdwanSer.push(item); + } + }) + } if (service["serviceDomain"] === 'CCVPN' || service["serviceDomain"] === 'SOTN') { this.detailCCVPNShow = true; if (typeNum === 1) { |