diff options
author | 2020-04-10 12:04:39 +0800 | |
---|---|---|
committer | 2020-04-10 13:29:08 +0800 | |
commit | 03d4bf6a3fe3f5259abb915b7e120bf38ca17d0c (patch) | |
tree | e5c1c6441729a66f3ad1f0bec02ea1515d87a8f9 /usecaseui-portal/src/app/views/services/services-list/create-model | |
parent | 829fc14cd97f236d854472e4a872b59c42367cc5 (diff) |
1ifix: Fix service-list page bug
Change-Id: Ie61afcb2a9e07ba58416af5ef3f5ad2f07e37402
Issue-ID: USECASEUI-369
Signed-off-by: cyuamber <xuranyjy@chinamobile.com>
Diffstat (limited to 'usecaseui-portal/src/app/views/services/services-list/create-model')
2 files changed, 24 insertions, 13 deletions
diff --git a/usecaseui-portal/src/app/views/services/services-list/create-model/create-model.component.html b/usecaseui-portal/src/app/views/services/services-list/create-model/create-model.component.html index 93a2bd50..cbc5f3e3 100644 --- a/usecaseui-portal/src/app/views/services/services-list/create-model/create-model.component.html +++ b/usecaseui-portal/src/app/views/services/services-list/create-model/create-model.component.html @@ -7,7 +7,7 @@ <div class="select-list"> <span> {{"i18nTextDefine_Customer" | translate}} : </span> <nz-select [(ngModel)]="currentCustomer.name" nzAllowClear - (ngModelChange)="customerChange()"> + (ngModelChange)="customerChange(currentCustomer)"> <nz-option *ngFor="let item of customerList" [nzValue]="item.name" [nzLabel]="item.name"></nz-option> </nz-select> </div> diff --git a/usecaseui-portal/src/app/views/services/services-list/create-model/create-model.component.ts b/usecaseui-portal/src/app/views/services/services-list/create-model/create-model.component.ts index 72817bc2..cf7404d8 100644 --- a/usecaseui-portal/src/app/views/services/services-list/create-model/create-model.component.ts +++ b/usecaseui-portal/src/app/views/services/services-list/create-model/create-model.component.ts @@ -1,5 +1,6 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; import { ServiceListService } from '../../../../core/services/serviceList.service'; +import { NzMessageService } from 'ng-zorro-antd'; @Component({ selector: 'app-create-model', @@ -29,7 +30,10 @@ export class CreateModelComponent implements OnInit { createData: Object = {}; loadingAnimateShow: boolean = false; - constructor( private http: ServiceListService) {} + constructor( + private http: ServiceListService, + private msg: NzMessageService + ) {} ngOnInit() { this.serviceTypes = this.serviceTypeList; @@ -50,18 +54,20 @@ export class CreateModelComponent implements OnInit { getAlltemplates() { this.http.getAllServiceTemplates(this.templateTypeSelected) .subscribe((data) => { - this.templates = data; - if (this.templateTypeSelected == "Network Service") { - this.templates = data.filter((d) => { - return typeof d.packageInfo.csarName == "string"; - }).map((item) => { - let cName = item.packageInfo.csarName.split("/").reverse()[0]; - return { name: cName, id: item.csarId, packageInfo: item.packageInfo } - }); + if(data.length!==0){ + this.templates = data; + if (this.templateTypeSelected == "Network Service") { + this.templates = data.filter((d) => { + return typeof d.packageInfo.csarName == "string"; + }).map((item) => { + let cName = item.packageInfo.csarName.split("/").reverse()[0]; + return { name: cName, id: item.csarId, packageInfo: item.packageInfo } + }); + } + this.currentTemplate = this.templates[0]; } - this.currentTemplate = this.templates[0]; }, (err) => { - console.log(err); + this.msg.error(err); }) } @@ -83,7 +89,8 @@ export class CreateModelComponent implements OnInit { this.loadingAnimateShow = false; } - customerChange(): void { + customerChange(value): void { + this.currentCustomer = value; this.getServiceType(); } @@ -95,6 +102,10 @@ export class CreateModelComponent implements OnInit { } handleOk(): void { + if(this.templates.length === 0){ + this.msg.warning('Template is required.'); + return + } if (this.templateTypeSelected === "SOTN" || this.templateTypeSelected === "CCVPN" || this.templateTypeSelected === "MDONS") { this.createData = { commonParams: { |