From 548c5a220333c7cd666b861e737bff0b45461f18 Mon Sep 17 00:00:00 2001 From: "Stone, Avi (as206k)" Date: Sun, 3 Jun 2018 13:12:12 +0300 Subject: Update FE project Update FE to latest version so that fe can run on docker Change-Id: I9c5dee756b567dbe64fac6d3d6fd89362813bdcc Issue-ID: SDC-1359 Signed-off-by: Stone, Avi (as206k) --- public/src/app/main/main.component.ts | 44 ++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 14 deletions(-) (limited to 'public/src/app/main/main.component.ts') diff --git a/public/src/app/main/main.component.ts b/public/src/app/main/main.component.ts index fdbb077..a3f2271 100644 --- a/public/src/app/main/main.component.ts +++ b/public/src/app/main/main.component.ts @@ -1,12 +1,11 @@ -import { Component, ViewEncapsulation, ViewChild } from '@angular/core'; -import { ActivatedRoute } from '@angular/router'; import { Location } from '@angular/common'; +import { Component, ViewChild, ViewEncapsulation } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { ToastrService } from 'ngx-toastr'; import { RestApiService } from '../api/rest-api.service'; -import { Store } from '../store/store'; -import { RuleFrameComponent } from '../rule-frame/rule-frame.component'; import { GeneralComponent } from '../general/general.component'; -import { ToastrService } from 'ngx-toastr'; -import { forkJoin } from 'rxjs/observable/forkJoin'; +import { RuleEngineApiService } from '../rule-engine/api/rule-engine-api.service'; +import { Store } from '../store/store'; @Component({ selector: 'app-main', @@ -18,11 +17,13 @@ export class MainComponent { cdump; nodes = []; @ViewChild(GeneralComponent) generalComponent: GeneralComponent; - // @ViewChildren(RuleFrameComponent) ruleFrameRef: QueryList; + // @ViewChildren(RuleFrameComponent) ruleFrameRef: + // QueryList; constructor( private route: ActivatedRoute, private restApi: RestApiService, + private _ruleApi: RuleEngineApiService, private toastr: ToastrService, public store: Store, private location: Location @@ -39,6 +40,8 @@ export class MainComponent { createMC(params) { console.log('newVfcmt: %o', params); this.store.loader = true; + this.store.vfiName = params.serviceAttached; + this.store.flowType = 'default'; this.restApi .createNewVFCMT({ name: params.name, @@ -55,6 +58,7 @@ export class MainComponent { this.store.mcUuid = success.vfcmt.uuid; console.log(this.cleanProperty(success)); this.store.cdump = success.cdump; + this.diagramRelationsFromCdump(success); this.nodes = this.store.cdump.nodes; this.store.setTabsProperties(this.nodes); this.setDataFromMapToRuleEngine(success.cdump); @@ -70,6 +74,17 @@ export class MainComponent { ); } + private diagramRelationsFromCdump(success: any) { + this.generalComponent.list = success.cdump.relations.map(item => { + return { + name1: item.name1, + name2: item.name2, + p1: item.meta.p1, + p2: item.meta.p2 + }; + }); + } + updateCdump(cdump) { this.store.cdump = cdump; this.nodes = this.store.cdump.nodes; @@ -81,6 +96,8 @@ export class MainComponent { console.log('importVfcmt: %o', params); this.generalComponent.importCompleted = true; this.store.loader = true; + this.store.vfiName = params.serviceAttached; + this.store.flowType = params.flowType; this.restApi .importVFCMT({ name: params.name, @@ -96,11 +113,13 @@ export class MainComponent { .subscribe( success => { console.log(success); + this.location.path(); // this.location.go(); this.store.mcUuid = success.vfcmt.uuid; console.log(this.cleanProperty(success)); this.store.cdump = success.cdump; + this.diagramRelationsFromCdump(success); this.nodes = this.store.cdump.nodes; this.store.setTabsProperties(this.nodes); this.setDataFromMapToRuleEngine(success.cdump); @@ -119,12 +138,9 @@ export class MainComponent { setDataFromMapToRuleEngine(cdump) { this.store.tabParmasForRule = cdump.nodes - .filter(x => x.name.includes('map')) + .filter(x => x.name.toLowerCase().includes('map')) .map(y => { - return { - name: y.name, - nid: y.nid - }; + return { name: y.name, nid: y.nid }; }); } @@ -139,7 +155,6 @@ export class MainComponent { } saveCDUMP() { - debugger; this.store.loader = true; this.restApi .saveMonitoringComponent({ @@ -167,7 +182,6 @@ export class MainComponent { } saveAndCreateBlueprint() { - debugger; this.store.loader = true; if (this.store.cdumpIsDirty) { this.restApi @@ -210,6 +224,7 @@ export class MainComponent { .subscribe( success => { this.store.loader = false; + this.toastr.success('', 'Save succeeded'); }, error => { @@ -223,6 +238,7 @@ export class MainComponent { } handleChange(e) { + this._ruleApi.callUpdateTabIndex(e.index - 1); this.store.setTabIndex(e.index - 1); } } -- cgit 1.2.3-korg