fix component interaction with sub-components

This commit is contained in:
2019-10-19 18:03:18 +02:00
parent 24bf7c98e3
commit 12be86a1d6
9 changed files with 54 additions and 73 deletions

View File

@@ -1,7 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, ViewChild } from '@angular/core';
import { PlotService, PlotType } from '../plot.service';
import { Observable } from 'rxjs/Observable';
import { FormControl, Validators } from '@angular/forms';
import { LimitByComponent } from '../limit-by/limit-by.component';
import { YAxisRangeComponent } from '../y-axis-range/y-axis-range.component';
@Component({
@@ -24,18 +26,19 @@ export class VisualizationPageComponent implements OnInit {
tagFields: Array<any>;
groupBy: Array<any> = [];
limitBy: string = "NO_LIMIT";
limit = 10;
@ViewChild(LimitByComponent, {static: false})
private limitbycomponent : LimitByComponent;
yAxis: string;
yAxisUnit: string;
minYValue: number;
maxYValue: number;
@ViewChild(YAxisRangeComponent, {static: false})
private yAxisRangeComponent : YAxisRangeComponent;
query: string;
enableGallery = true;
enableGallery = false;
splitBy = new FormControl(null, [
Validators.required
]);
@@ -55,14 +58,15 @@ export class VisualizationPageComponent implements OnInit {
this.tagFields = this.plotService.getTagFields();
this.yAxis = "log";
this.yAxisUnit = "MINUTES";
this.minYValue = 0;
this.maxYValue = 120;
this.selectedPlotType.valueChanges.subscribe(function(selectedMainPlotType){
that.combinePlotTypes = that.getCombinablePlotTypes(selectedMainPlotType);
});
}
getCombinablePlotTypes(selectedMainPlotType) : Array<any>{
const mainPlotType = this.availablePlotTypes[selectedMainPlotType];
@@ -78,16 +82,16 @@ export class VisualizationPageComponent implements OnInit {
request['height'] = document.getElementById("results").offsetHeight;
request['width'] = document.getElementById("results").offsetWidth;
request['groupBy'] = this.groupBy.map(o => o.name);
request['limitBy'] = this.limitBy;
request['limit'] = this.limit;
request['limitBy'] = this.limitbycomponent.limitBy;
request['limit'] = this.limitbycomponent.limit;
request['dateRange'] = this.dateRange.value;
request['axisScale'] = this.yAxis;
request['aggregate'] = this.selectedCombinePlotType.value;
request['keyOutside'] = false;
request['generateThumbnail'] = this.enableGallery;
request['yRangeMin'] = this.minYValue;
request['yRangeMax'] = this.maxYValue;
request['yRangeUnit'] = this.yAxisUnit;
request['yRangeMin'] = this.yAxisRangeComponent.minYValue;
request['yRangeMax'] = this.yAxisRangeComponent.maxYValue;
request['yRangeUnit'] = this.yAxisRangeComponent.yAxisUnit;
console.log("plot clicked: "+ JSON.stringify(request));
}