diff options
Diffstat (limited to 'public/src/app/main')
-rw-r--r-- | public/src/app/main/main.component.html | 22 | ||||
-rw-r--r-- | public/src/app/main/main.component.scss | 8 | ||||
-rw-r--r-- | public/src/app/main/main.component.ts | 44 |
3 files changed, 47 insertions, 27 deletions
diff --git a/public/src/app/main/main.component.html b/public/src/app/main/main.component.html index d54b27b..4c71a37 100644 --- a/public/src/app/main/main.component.html +++ b/public/src/app/main/main.component.html @@ -1,4 +1,4 @@ -<div class="container"> +<div class="main-container"> <div style="padding: .25em; display: flex; justify-content: space-between; @@ -6,16 +6,18 @@ <div> <a (click)="goBack()" data-tests-id="btn-back-home" style="display: flex; cursor: pointer;text-decoration: none; color: #009fdb;"> <mat-icon fontSet="fontawesome" fontIcon="fa-angle-left" style="height: 17px; width: 12px; font-size: 17px;"></mat-icon> - <span style="display: flex; align-items: center;">Back to Monitoring</span> + <span style="display: flex; align-items: center; font-size: 12px;"> + Back to Monitoring + </span> </a> <div style="margin:10px 0;" data-tests-id="new-monitorying-titie"> - <span style="font-size: 2em;" *ngIf='store.generalflow === "new"'> + <span style="font-size: 22px;" *ngIf='store.generalflow === "new"'> New </span> - <span style="font-size: 2em;" *ngIf='store.generalflow === "import"'> + <span style="font-size: 22px;" *ngIf='store.generalflow === "import"'> Import </span> - <span style="font-size: 2em;"> + <span style="font-size: 22px;"> Monitoring Configuration </span> </div> @@ -24,7 +26,9 @@ <div> <div *ngIf='store.generalflow === "new" || store.generalflow === "edit"'> <button *ngIf="!this.store.isEditMode" mat-raised-button color="primary" [disabled]="this.generalComponent.generalForm.invalid" - data-tests-id="createMonitoring" (click)="createMC(this.generalComponent.generalForm.value)">Create</button> + style="width: 95px;height: 36px;" data-tests-id="createMonitoring" (click)="createMC(this.generalComponent.generalForm.value)"> + Create + </button> <div *ngIf="this.store.isEditMode" style="display: flex;"> <button mat-icon-button (click)="saveCDUMP()" [disabled]="!store.cdumpIsDirty"> @@ -35,12 +39,12 @@ justify-content: center; align-items: center;" [innerHTML]="'save' | feather:22"></span> </button> - <button mat-raised-button color="primary" (click)="saveAndCreateBlueprint()">Submit</button> + <button mat-raised-button color="primary" style="width: 95px; height: 36px; border-radius: 2px;" (click)="saveAndCreateBlueprint()">Submit</button> </div> </div> <div *ngIf='store.generalflow === "import"'> <button mat-raised-button color="primary" (click)="importMC(this.generalComponent.newVfcmt)" [disabled]="this.generalComponent.generalForm.invalid" - data-tests-id="importMonitoring">Import</button> + data-tests-id="importMonitoring" style="width: 95px;height: 36px;">Import</button> </div> </div> </div> @@ -53,7 +57,7 @@ <app-general (updateCdumpEv)="updateCdump($event)"></app-general> </div> </p-tabPanel> - <p-tabPanel *ngFor="let item of nodes" [header]="item.name"> + <p-tabPanel *ngFor="let item of nodes;" [header]="item.name"> <app-rule-frame [tabName]="item.name"></app-rule-frame> </p-tabPanel> </p-tabView> diff --git a/public/src/app/main/main.component.scss b/public/src/app/main/main.component.scss index 402a56a..47f1bd9 100644 --- a/public/src/app/main/main.component.scss +++ b/public/src/app/main/main.component.scss @@ -1,7 +1,6 @@ -.container { +.main-container { display: flex; - flex-direction: column; - // height: 100%; + flex-direction: column; // height: 100%; margin: 1em; } @@ -16,11 +15,12 @@ .ui-tabview .ui-tabview-nav li { margin: 0; + border-radius: 0; } .ui-tabview .ui-tabview-nav li.ui-tabview-selected { color: #009fdb; - border-top: 4px solid #009fdb; + border-top: 2px solid #009fdb; border-bottom: none; } 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<RuleFrameComponent>; + // @ViewChildren(RuleFrameComponent) ruleFrameRef: + // QueryList<RuleFrameComponent>; 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); } } |