Skip to content
Permalink
Browse files

edit initializing with selected metric

  • Loading branch information...
Gustavo Antonio Lastra Colorado
Gustavo Antonio Lastra Colorado committed Jul 15, 2019
1 parent 3533929 commit f4baf5e2bae49763a9ef4fdbae93ee9f88360dfc
@@ -34,9 +34,6 @@ export class AspectMetricsComponent implements OnInit {
return aspects.filter((aspect: ExtendedPerformanceAspect) => aspect.performanceAspectType.name == this.actualType.name)
})
);



}

getSelectedAspect(): PerformanceAspect {
@@ -15,7 +15,7 @@ <h1>{{ 'frontend.de.iteratec.osm.performance-aspects' | translate }}: {{(applica
class="aspect-inspect"></osm-aspect-metrics>
</div>
<div class="card">
<osm-metric-finder
<osm-metric-finder [selectedMeasurand] = "selectedMeasurand"
></osm-metric-finder>
<button class="btn btn-primary btn-aspect-config"
[disabled]="" (click)="persistAspect()">{{'frontend.default.button.save' | translate}}</button>
@@ -35,7 +35,10 @@ export class EditAspectMetricsComponent implements OnInit {
performanceAspects$: Observable<ExtendedPerformanceAspect[]>;
aspectType$: Observable<PerformanceAspectType>;
aspectsToShow$: Observable<ExtendedPerformanceAspect[]>;
private selectedAspect: string;
selectedMeasurand$: Observable<any>;
private selectedAspect: ExtendedPerformanceAspect;
private selectedMeasurand: string;
selectedMeasurand$: Observable<any>;

constructor(
private route: ActivatedRoute,
@@ -61,40 +64,36 @@ export class EditAspectMetricsComponent implements OnInit {
this.aspectConfService.initSelectedAspectType(params.get('aspectType'));
this.loadChartData(Number(params.get('applicationId')), Number(params.get('pageId')), Number(params.get('browserId')));

this.aspectsToShow$ = combineLatest(this.aspectConfService.extendedAspects$, this.aspectConfService.selectedAspectType$).subscribe(
([aspects, selectedType]: [ExtendedPerformanceAspect[], PerformanceAspectType]) =>
).pipe(
map((aspects: ExtendedPerformanceAspect[]) => {
return aspects.filter((aspect: ExtendedPerformanceAspect) => aspect.performanceAspectType.name == this.actualType.name)
}));
combineLatest(this.aspectConfService.extendedAspects$, this.aspectConfService.selectedAspectType$).subscribe(
([aspects, selectedType]: [ExtendedPerformanceAspect[], PerformanceAspectType]) => {

console.log(
"aspects: " + JSON.stringify (aspects, null, 4) +
"selectedType: " + JSON.stringify (selectedType, null, 4)
);

this.selectedAspect = aspects.find((aspect) => {
return aspect.browserId === browserId;
});
console.log("selected: ", JSON.stringify (selectedAspect, null, 4));
if (typeof this.selectedAspect != "undefined") {
//aspects.filter((aspect: ExtendedPerformanceAspect) => aspect.performanceAspectType.name == selectedType.name);

this.selectedAspect= this.selectedAspect.measurand.name;
console.log("selectedAspect: " + this.selectedAspect.measurand.name);
}
this.selectedAspect = aspects
.filter((aspect: ExtendedPerformanceAspect) => aspect.performanceAspectType.name == selectedType.name)
.find((aspect: ExtendedPerformanceAspect) => {
return aspect.browserId === browserId;


console.log("this.browserId: " + browserId);
});

console.log("selectedAspect: ", JSON.stringify (this.selectedAspect, null, 4));
if (typeof this.selectedAspect != "undefined") {

this.selectedMeasurand= this.selectedAspect.measurand.name;
console.log("selectedMeasurand: " + this.selectedMeasurand);
}
console.log("this.browserId: " + browserId);
}
);
});
//console.log("selectedAspect: " + this.aspectMetricsCmp.getSelectedAspect());




//this.selectedAspect = this.aspectMetricsCmp.getSelectedAspect();

}

ngAfter

private initMetricFinderDataLoading() {
this.browserId$.pipe(
distinctUntilChanged(),
@@ -14,6 +14,7 @@ import {PerformanceAspect} from "../../models/perfomance-aspect.model";
export class MetricFinderComponent {

// @Input() selectedAspect: PerformanceAspect;
@Input() selectedMeasurand: string;

@ViewChild(LineChartComponent)
lineChartCmp: LineChartComponent;
@@ -25,10 +26,21 @@ export class MetricFinderComponent {
public selectedResults: TestResult[] = [];
public selectedMetric = 'SPEED_INDEX';



constructor(private metricFinderService: MetricFinderService) {
this.testResults$ = metricFinderService.testResults$;
}

ngOnInit(){
console.log("selectedMeasurand in child metric finder: " + this.selectedMeasurand);
}

ngOnChanges(){
console.log("selectedMeasurand in child metric finder: " + this.selectedMeasurand);
this.selectedMetric = this.selectedMeasurand;
}

setSelectedResults(results: TestResult[]) {
this.selectedResults = [...results].sort((a, b) => a.date.getTime() - b.date.getTime());
}

Some generated files are not rendered by default. Learn more.

0 comments on commit f4baf5e

Please sign in to comment.
You can’t perform that action at this time.