diff options
author | seshukm <seshu.kumar.m@huawei.com> | 2020-02-26 16:41:31 +0800 |
---|---|---|
committer | Seshu Kumar M <seshu.kumar.m@huawei.com> | 2020-02-26 09:45:22 +0000 |
commit | fa7bc1af69c58120fa5a0746d75a4c08bccfd986 (patch) | |
tree | 35edc34c9dc31d28f7165978fbd76582f1c147cf | |
parent | 2c491d2e14deba9f13a52ef658b308fb5067f26c (diff) |
logic to delete the ordered service take-1
Issue-ID: USECASEUI-387
Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
Change-Id: Ib72e9393e2fe86e0455237c69c57d0650798793e
2 files changed, 54 insertions, 81 deletions
diff --git a/usecaseui-portal/src/app/views/services/sotn-management/order-service/order-service.component.ts b/usecaseui-portal/src/app/views/services/sotn-management/order-service/order-service.component.ts index 5a6bf6a2..a945b93e 100644 --- a/usecaseui-portal/src/app/views/services/sotn-management/order-service/order-service.component.ts +++ b/usecaseui-portal/src/app/views/services/sotn-management/order-service/order-service.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, Output, EventEmitter } from '@angular/core'; import { FormBuilder, FormGroup, @@ -15,31 +15,19 @@ import { NzMessageService } from 'ng-zorro-antd'; export class OrderServiceComponent implements OnInit { validateForm: FormGroup; - validateForm1: FormGroup; - validateForm2: FormGroup; l2vpn:object = {}; siteData:object = {}; - tipMsg: String = "serviceCreationInitiated"; - displayMsg:boolean = false; - displayMsg2:boolean = false; buttonDisabled:boolean = false; intervalData:any; baseUrl:string = '/api/usecaseui-server/v1'; expandDataSet = [ - { rowIdx: 1, name: 'Service', expand: true }, - { rowIdx: 2, name: 'VPN', expand: true }, - { rowIdx: 3, name: 'UNI', expand: true } - ]; - uni = { - sotnuni_cVLAN:"asdf", - sotnuni_tpId:"asdf" - }; - sotnUni = [ - { - sotnuni_cVLAN:"asdf", - sotnuni_tpId:"saf" - } + { rowIdx: 1, name: 'i18nTextDefine_serviceInformation', expand: true }, + { rowIdx: 2, name: 'i18nTextDefine_vpnInformation', expand: true }, + { rowIdx: 3, name: 'i18nTextDefine_uniInformation', expand: true } ]; + uni = {}; + sotnUni = []; + @Output() childEvent = new EventEmitter<string>(); constructor(private fb: FormBuilder, private http: HttpClient, private message: NzMessageService) { } @@ -66,28 +54,6 @@ export class OrderServiceComponent implements OnInit { sotnuni_cVLAN:[null, [Validators.required]], sotnuni_tpId:[null, [Validators.required]], }); - // this.validateForm1 = this.fb.group({ - // l2vpn_name:[null, [Validators.required]], - // l2vpn_dualLink:[null, [Validators.required]], - // l2vpn_description:[null, [Validators.required]], - // l2vpn_SLS:[null, [Validators.required]], - // l2vpn_COS:[null, [Validators.required]], - // l2vpn_tenantId:[null, [Validators.required]], - // l2vpn_vpnType:[null, [Validators.required]], - // l2vpn_cbs:[null, [Validators.required]], - // l2vpn_ebs:[null, [Validators.required]], - // l2vpn_colorAware:[null, [Validators.required]], - // l2vpn_reroute:[null, [Validators.required]], - // l2vpn_couplingFlag:[null, [Validators.required]], - // l2vpn_cir:[null, [Validators.required]], - // l2vpn_eir:[null, [Validators.required]], - // l2vpn_startTime:[null, [Validators.required]], - // l2vpn_endTime:[null, [Validators.required]], - // }); - // this.validateForm2 = this.fb.group({ - // sotnuni_cVLAN:[null, [Validators.required]], - // sotnuni_tpId:[null, [Validators.required]], - // }); } numberOnly(event): boolean { @@ -98,20 +64,29 @@ export class OrderServiceComponent implements OnInit { } addUNI () { + if(this.uni['sotnuni_cVLAN'] == undefined || this.uni['sotnuni_tpId'] == undefined) { + this.message.error("Please enter cVLAN & TPID first."); + return; + } this.sotnUni.push(this.uni); - // this.uni = {}; + this.uni = {}; + } + + deletesotnUni(data) { + for(let i = 0; i < this.sotnUni.length; i++) { + if(data.sotnuni_tpId == this.sotnUni[i].sotnuni_tpId) { + this.sotnUni.splice(i, 1); + } + } } selectOrderSiteData(): void { if (!this.validateVpnAndUni() || !this.validateServices() ) { - this.displayMsg = true; this.message.error("Please fill all mandatory fields"); - var comp = this; - setTimeout(function () { - comp.displayMsg = false; - }, 5000); } else { + this.siteData["l2vpn"] = [this.l2vpn]; + this.siteData["sotnUni"] = this.sotnUni; this.putnewSotnSiteData() } } @@ -158,39 +133,37 @@ export class OrderServiceComponent implements OnInit { }) }; let url1 = this.baseUrl + '/uui-lcm/Sotnservices'; - // this.http.post<any>(url1, body, httpOptions).subscribe((data) => { - // let comp = this; - // this.message.info('Instantiation In Progress'); - // comp.displayMsg2 = true; - // this.intervalData = setInterval(() => { - // let url2 = this.baseUrl + "/uui-lcm/Sotnservices/serviceStatus/service-instance/" + data.service.serviceId; - // this.http.get<any>(url2, {}).subscribe((data) => { - // if (data.status == "1") { - // clearInterval(comp.intervalData); - // comp.displayMsg2 = true; - // comp.message.success('Service Created'); - // comp.goToPage(); - // } - // else { - // comp.message.info('Instantiation In Progress'); - // comp.displayMsg2 = true; - // } - // }, (err) => { - // console.log(err); - // }); - // }, 1000); - // }, (err) => { - // console.log(err); - // }); + this.http.post<any>(url1, body, httpOptions).subscribe((data) => { + let comp = this; + this.message.info('Instantiation In Progress'); + this.intervalData = setInterval(() => { + let url2 = this.baseUrl + "/uui-lcm/Sotnservices/serviceStatus/service-instance/" + data.service.serviceId; + this.http.get<any>(url2, {}).subscribe((data) => { + if (data.status == "1") { + clearInterval(comp.intervalData); + comp.message.success('Service Created'); + comp.goToPage(); + } + else { + comp.message.info('Instantiation In Progress'); + } + }, (err) => { + console.log(err); + }); + }, 1000); + }, (err) => { + console.log(err); + }); setTimeout(() => { comp.message.success("Service Created"); - comp.goToPage(); + comp.goToPage.call(comp); }, 3000); } goToPage(): void { + var comb = this; setTimeout(function () { - // document.getElementById('manageService').click(); + comb.childEvent.emit(); }, 1000); } diff --git a/usecaseui-portal/src/app/views/services/sotn-management/sotn-management.component.html b/usecaseui-portal/src/app/views/services/sotn-management/sotn-management.component.html index 12fcb851..42770fa4 100644 --- a/usecaseui-portal/src/app/views/services/sotn-management/sotn-management.component.html +++ b/usecaseui-portal/src/app/views/services/sotn-management/sotn-management.component.html @@ -1,17 +1,17 @@ -<nz-tabset (nzSelectChange)="handleTabChange($event)" class="slicing"> - <nz-tab nzTitle="Order Service"> - <app-order-service - *ngIf="currentTab ==='Order Service'" +<nz-tabset [nzSelectedIndex]="selectedIndex" (nzSelectChange)="handleTabChange($event)" class="slicing"> + <nz-tab [nzTitle]="'i18nTextDefine_orderService' | translate"> + <app-order-service (childEvent)="changeTab()" + *ngIf="selectedIndex === 0" ></app-order-service> </nz-tab> - <nz-tab nzTitle="Manage Service" > + <nz-tab [nzTitle]="'i18nTextDefine_manageService' | translate"> <app-manage-service - *ngIf="currentTab ==='Manage Service'" + *ngIf="selectedIndex === 1" ></app-manage-service> </nz-tab> - <nz-tab nzTitle="Monitor Service"> + <nz-tab [nzTitle]="'i18nTextDefine_monitorService' | translate"> <app-monitor-service - *ngIf="currentTab ==='Monitor Service'" + *ngIf="selectedIndex === 2" ></app-monitor-service> </nz-tab> </nz-tabset>
\ No newline at end of file |