summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/views/services/services-list/create-model
diff options
context:
space:
mode:
Diffstat (limited to 'usecaseui-portal/src/app/views/services/services-list/create-model')
-rw-r--r--usecaseui-portal/src/app/views/services/services-list/create-model/create-model.component.html2
-rw-r--r--usecaseui-portal/src/app/views/services/services-list/create-model/create-model.component.ts35
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: {