-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
241 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,3 +151,7 @@ tbody tr:hover { | |
font-size: 19px; | ||
} | ||
|
||
.performance-issue { | ||
margin-left: 10px; | ||
font-size: 19px; | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<ng-template #content let-modal> | ||
<div class="modal-header"> | ||
<h5 class="modal-title" id="modal-basic-title">Scenario thresholds</h5> | ||
<button type="button" style="outline: none;" style="outline: none;" class="close" aria-label="Close" (click)="modal.dismiss('Cross click')"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
<form [formGroup]="thresholdForm" (ngSubmit)="onSubmit()"> | ||
<div class="modal-body"> | ||
<div class="alert alert-primary" role="alert"> | ||
<i class="fas fa-info-circle"> </i> | ||
Scenario thresholds will raise an alert in a report detail in case the given metrics diverge from the previous | ||
reports average by more than specified threshold percentage. | ||
</div> | ||
<div class="form-group"> | ||
<label for="exampleInputEmail1">90% percentil</label> | ||
<input t type="input" class="form-control" formControlName="percentile" > | ||
</div> | ||
<div class="form-group"> | ||
<label for="exampleInputEmail1">Throughput</label> | ||
<input type="text" class="form-control" formControlName="throughput"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="exampleInputEmail1">Error rate</label> | ||
<input type="text" class="form-control" formControlName="errorRate"> | ||
</div> | ||
<div class="form-check"> | ||
<input type="checkbox" class="form-check-input" id="exampleCheck1" formControlName="enabled"> | ||
<label class="form-check-label" for="exampleCheck1">Enabled</label> | ||
</div> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="submit" class="btn btn-primary">Submit</button> | ||
</div> | ||
</form> | ||
|
||
</ng-template> | ||
|
||
<button class="notification btn btn-sm btn-primary" (click)="open(content)" ngbDropdownItem> Thresholds</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { HttpClientModule } from '@angular/common/http'; | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { ReactiveFormsModule } from '@angular/forms'; | ||
|
||
import { ThresholdComponent } from './threshold.component'; | ||
|
||
describe('ThresholdComponent', () => { | ||
let component: ThresholdComponent; | ||
let fixture: ComponentFixture<ThresholdComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ThresholdComponent], | ||
imports: [ReactiveFormsModule, HttpClientModule], | ||
|
||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ThresholdComponent); | ||
component = fixture.componentInstance; | ||
component.params = {}; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
import { FormControl, FormGroup, Validators } from '@angular/forms'; | ||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; | ||
import { of } from 'rxjs'; | ||
import { catchError } from 'rxjs/internal/operators/catchError'; | ||
import { NotificationMessage } from 'src/app/notification/notification-messages'; | ||
import { ScenarioApiService } from 'src/app/scenario-api.service'; | ||
|
||
@Component({ | ||
selector: 'app-threshold', | ||
templateUrl: './threshold.component.html', | ||
styleUrls: ['./threshold.component.css'] | ||
}) | ||
export class ThresholdComponent implements OnInit { | ||
|
||
thresholdForm: FormGroup; | ||
percentile; | ||
errorRate; | ||
throughput; | ||
enabled; | ||
|
||
@Input() params; | ||
|
||
constructor( | ||
private modalService: NgbModal, | ||
private scenarioApiService: ScenarioApiService, | ||
private notification: NotificationMessage | ||
) {} | ||
|
||
ngOnInit(): void { | ||
this.scenarioApiService.fetchThresholds(this.params.projectName, this.params.scenarioName).subscribe(_ => { | ||
this.createFormControls(_); | ||
this.createForm(); | ||
}); | ||
} | ||
|
||
createFormControls(thresholds) { | ||
this.percentile = new FormControl(thresholds.percentile, [ | ||
Validators.min(0), | ||
Validators.max(100), | ||
Validators.required, | ||
]); | ||
this.throughput = new FormControl(thresholds.throughput, [ | ||
Validators.min(0), | ||
Validators.max(100), | ||
Validators.required, | ||
]); | ||
this.errorRate = new FormControl(thresholds.errorRate, [ | ||
Validators.min(0), | ||
Validators.max(100), | ||
Validators.required | ||
]); | ||
this.enabled = new FormControl(thresholds.enabled, [ | ||
Validators.required, | ||
]); | ||
} | ||
|
||
createForm() { | ||
this.thresholdForm = new FormGroup({ | ||
percentile: this.percentile, | ||
throughput: this.throughput, | ||
errorRate: this.errorRate, | ||
enabled: this.enabled | ||
}); | ||
} | ||
|
||
open(content) { | ||
this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title', size: 'lg' }); | ||
} | ||
|
||
onSubmit() { | ||
if (this.thresholdForm.valid) { | ||
const { projectName, scenarioName } = this.params; | ||
const body = { | ||
errorRate: parseFloat(this.thresholdForm.value.errorRate), | ||
throughput: parseFloat(this.thresholdForm.value.throughput), | ||
percentile: parseFloat(this.thresholdForm.value.percentile), | ||
enabled: this.thresholdForm.value.enabled | ||
}; | ||
|
||
this.scenarioApiService.updateThresholds(projectName, scenarioName, body) | ||
.pipe(catchError(r => of(r))) | ||
.subscribe(_ => { | ||
const message = this.notification.scenarioThresholdUpdate(_); | ||
this.scenarioApiService.setData(message); | ||
}); | ||
this.modalService.dismissAll(); | ||
} | ||
} | ||
|
||
|
||
} | ||
|
||
|