Skip to content
Permalink
Browse files

make measurands selectable

  • Loading branch information...
MoWeg committed Mar 15, 2019
1 parent 8f87519 commit f987c9412c0980ece91c6ed0973a9026da5ccd30
@@ -11,6 +11,7 @@ import {HttpClientModule} from "@angular/common/http";
import { ApplicationJobStatusComponent } from './components/application-job-status/application-job-status.component';
import {GraphiteIntegrationComponent} from "./components/application-job-status/graphite-integration/graphite-integration.component";
import {FormsModule, ReactiveFormsModule} from "@angular/forms";
import { PerformanceAspectManagementComponent } from './components/performance-aspect-management/performance-aspect-management.component';

const DashboardRoutes: Routes = [
{path: '', component: ApplicationDashboardComponent},
@@ -33,7 +34,8 @@ const DashboardRoutes: Routes = [
CsiInfoComponent,
PageMetricComponent,
ApplicationJobStatusComponent,
GraphiteIntegrationComponent
GraphiteIntegrationComponent,
PerformanceAspectManagementComponent,
],
exports: [
RouterModule
@@ -1,4 +1,5 @@
<h2>{{metricsForPage?.pageName}}</h2>
<osm-performance-aspect-management [pageId]="metricsForPage?.pageId"></osm-performance-aspect-management>
<div class="page-metrics">
<osm-csi-value-medium [csiValue]="pageCsi$ | async" [csiDate]="pageCsiDate$ | async"
[showLoading]="isLoading" [lastResultDate]="lastDateOfResult"></osm-csi-value-medium>
@@ -10,5 +11,4 @@ <h2>{{metricsForPage?.pageName}}</h2>
<osm-page-metric [value]="transform(convertToMib(metricsForPage?.fullyLoadedIncomingBytes))"
[metric]="metrics.BYTES_FULLY_LOADED"></osm-page-metric>
</div>
<button (click)="getMeasurands()"></button>
</div>
@@ -25,7 +25,7 @@ export class PageComponent {
metrics = Metrics;


constructor(private applicationDashboardService: ApplicationService, private measurandsService: ResultSelectionService) {
constructor(private applicationDashboardService: ApplicationService) {
this.pageCsi$ = applicationDashboardService.pageCsis$.pipe(
map((next: ResponseWithLoadingState<PageCsiDto[]>) => {
this.isLoading = next.isLoading;
@@ -46,11 +46,6 @@ export class PageComponent {
}


getMeasurands(){
this.measurandsService.updatePages([{id: this.metricsForPage.pageId, name: "wtf"}])
this.measurandsService.userTimings$.pipe(take(3)).subscribe(resp => console.log(resp.data))
}

transform(value: number): string {
if (value) {
return CalculationUtil.toRoundedStringWithFixedDecimals(value, 2);
@@ -0,0 +1,5 @@
<i class="fa fa-pencil" (click)="ngxSmartModalService.open('preformanceAspectMgmtModal')"></i>

<ngx-smart-modal id="preformanceAspectMgmtModal" identifier="preformanceAspectMgmtModal" (onAnyCloseEvent)="cancel()">
<osm-measurand-select></osm-measurand-select>
</ngx-smart-modal>
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { PerformanceAspectManagementComponent } from './performance-aspect-management.component';

describe('PerformanceAspectManagementComponent', () => {
let component: PerformanceAspectManagementComponent;
let fixture: ComponentFixture<PerformanceAspectManagementComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PerformanceAspectManagementComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(PerformanceAspectManagementComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,18 @@
import {Component, Input, OnInit} from '@angular/core';
import {ResultSelectionService} from "../../../../services/result-selection.service";

@Component({
selector: 'osm-performance-aspect-management',
templateUrl: './performance-aspect-management.component.html',
styleUrls: ['./performance-aspect-management.component.scss']
})
export class PerformanceAspectManagementComponent implements OnInit {
@Input() pageId: number;

constructor( private measurandsService: ResultSelectionService) { }

ngOnInit() {
this.measurandsService.updatePages([{id: this.pageId, name: "does-not-matter"}])
}

}

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
@@ -0,0 +1,16 @@
<div class="dropdown">
<button class=" dropdown-toggle" type="button"
data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
{{initialValue?.name || "select measurand"}}
<i class="fas fa-caret-down select-application-header-triangle"></i>
</button>
<ul *ngIf="(measurands$ | async)?.data" class="dropdown-menu" aria-labelledby="selectApplicationHeaderId">
<li>
<p>Measurands</p>
<a class="dropdown-item" *ngFor="let measurand of measurands$ | async" (click)="selectMeasurand(measurand)">
{{measurand.name}}
</a>
</li>
</ul>
</div>
@@ -1,20 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { MetricSelectComponent } from './metric-select.component';
import { MeasurandSelectComponent } from './measurand-select.component';

describe('MetricSelectComponent', () => {
let component: MetricSelectComponent;
let fixture: ComponentFixture<MetricSelectComponent>;
describe('MeasurandSelectComponent', () => {
let component: MeasurandSelectComponent;
let fixture: ComponentFixture<MeasurandSelectComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ MetricSelectComponent ]
declarations: [ MeasurandSelectComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(MetricSelectComponent);
fixture = TestBed.createComponent(MeasurandSelectComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
@@ -0,0 +1,34 @@
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {ResultSelectionService} from "../../../../../services/result-selection.service";
import {ReplaySubject} from "rxjs";
import {ResponseWithLoadingState} from "../../../../../models/response-with-loading-state.model";
import {SelectableMeasurand} from "../../../../../models/measurand.model";

@Component({
selector: 'osm-measurand-select',
templateUrl: './measurand-select.component.html',
styleUrls: ['./measurand-select.component.scss']
})
export class MeasurandSelectComponent implements OnInit {
@Input() initialValue: SelectableMeasurand;
@Output() onSelect: EventEmitter<SelectableMeasurand> = new EventEmitter<SelectableMeasurand>();

measurands$: ReplaySubject<ResponseWithLoadingState<SelectableMeasurand[]>>;
userTimings$: ReplaySubject<ResponseWithLoadingState<SelectableMeasurand[]>>;
heroTimings$: ReplaySubject<ResponseWithLoadingState<SelectableMeasurand[]>>;

constructor(private resultSelectionService: ResultSelectionService) {
this.measurands$ = this.resultSelectionService.measurands$;
this.userTimings$ = this.resultSelectionService.userTimings$;
this.heroTimings$ = this.resultSelectionService.heroTimings$;
}

ngOnInit() {
}

selectMeasurand(measurand: SelectableMeasurand){
this.initialValue = measurand;
this.onSelect.emit(measurand);
}

}
@@ -7,7 +7,7 @@ import {CsiValueMediumComponent} from "./components/csi-value/csi-value-medium/c
import {CsiValueSmallComponent} from "./components/csi-value/csi-value-small/csi-value-small.component";
import {EmptyStateComponent} from './components/empty-state/empty-state.component';
import {NgxSmartModalModule} from "ngx-smart-modal";
import { MetricSelectComponent } from './components/metric-select/metric-select.component';
import { MeasurandSelectComponent } from './components/result-selection/measurand-select/measurand-select.component';

@NgModule({
imports: [
@@ -21,7 +21,7 @@ import { MetricSelectComponent } from './components/metric-select/metric-select.
CsiValueMediumComponent,
CsiValueSmallComponent,
EmptyStateComponent,
MetricSelectComponent
MeasurandSelectComponent,
],
exports: [
CommonModule,

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

Oops, something went wrong.

0 comments on commit f987c94

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