Skip to content
Snippets Groups Projects
Commit 04e04029 authored by Martin Mechtel's avatar Martin Mechtel
Browse files

report nearly completed

parent 24908db0
No related branches found
No related tags found
No related merge requests found
import { SyscheckDataService } from './sys-check/syscheck-data.service';
import { TestControllerService } from './test-controller';
import { LogindataService } from './logindata.service';
import { merge } from 'rxjs';
......@@ -19,11 +20,13 @@ export class AppComponent implements OnInit {
constructor (
private lds: LogindataService,
private tcs: TestControllerService,
private ccs: SyscheckDataService,
private router: Router) { }
ngOnInit() {
merge(
this.ccs.pageTitle$,
this.lds.pageTitle$,
this.tcs.pageTitle$).subscribe(t => {
this.title = t;
......
......@@ -3,7 +3,6 @@ import { Injectable, Inject } from '@angular/core';
import { HttpClient, HttpParams, HttpHeaders, HttpEvent, HttpErrorResponse } from '@angular/common/http';
import { Observable, of } from 'rxjs';
import { catchError } from 'rxjs/operators';
import { NetworkRequestTestResult } from './syscheck-data.service';
@Injectable({
providedIn: 'root'
......@@ -229,3 +228,9 @@ export interface UnitData {
def: string;
player: string;
}
export interface NetworkRequestTestResult {
'type': 'downloadTest' | 'uploadTest';
'size': number;
'duration': number;
}
......@@ -40,6 +40,10 @@ export class EnvironmentCheckComponent implements OnInit {
) { }
ngOnInit() {
this.startCheck();
}
startCheck() {
this.deviceInfo = window.navigator.userAgent;
// tslint:disable-next-line:max-line-length
this.regex = /(MSIE|Trident|(?!Gecko.+)Firefox|(?!AppleWebKit.+Chrome.+)Safari(?!.+Edge)|(?!AppleWebKit.+)Chrome(?!.+Edge)|(?!AppleWebKit.+Chrome.+Safari.+)Edge|AppleWebKit(?!.+Chrome|.+Safari)|Gecko(?!.+Firefox))(?: |\/)([\d\.apre]+)/;
......@@ -64,12 +68,16 @@ export class EnvironmentCheckComponent implements OnInit {
this.discoveredEnvRating = this.calculateEnvironmentRating(this.discoveredEnvData);
// dummy: transform to label-value-pairs!
const myReport: ReportEntry[] = [];
myReport.push({'label': 'lalala', 'value': 'sososo'});
myReport.push({'label': 'Betriebssystem', 'value': this.discoveredEnvData.osName});
myReport.push({'label': 'Bewertung', 'value': this.discoveredEnvRating.OSRating});
myReport.push({'label': 'Browser', 'value': this.discoveredEnvData.browserName + ' Version ' + this.discoveredEnvData.browserVersion});
myReport.push({'label': 'Bewertung', 'value': this.discoveredEnvRating.BrowserRating});
myReport.push({'label': 'Bildschirm', 'value':
this.discoveredEnvData.resolution.width.toString() + ' x ' + this.discoveredEnvData.resolution.height.toString()});
myReport.push({'label': 'Bewertung', 'value': this.discoveredEnvRating.ResolutionRating});
this.ds.environmentData$.next(myReport);
}
getOSVersion() {
......@@ -105,10 +113,6 @@ export class EnvironmentCheckComponent implements OnInit {
return this.osName;
}
goto() {
this.ds.questionnaireAvailable$.next(true);
}
// // // //
public calculateEnvironmentRating(ed: EnvironmentData): EnvironmentRating {
const ratings: EnvironmentRating = {
......
import { SyscheckDataService, NetworkRequestTestResult, ReportEntry } from './../syscheck-data.service';
import { SyscheckDataService, ReportEntry } from './../syscheck-data.service';
import { Component, OnInit } from '@angular/core';
import { BackendService, RequestBenchmarkerFunction, RequestBenchmarkerFunctionCallback} from '../backend.service';
import { BackendService, NetworkRequestTestResult, RequestBenchmarkerFunction,
RequestBenchmarkerFunctionCallback} from '../backend.service';
@Component({
selector: 'iqb-network-check',
......@@ -151,7 +152,10 @@ export class NetworkCheckComponent implements OnInit {
// send data for reporting
const myReport: ReportEntry[] = [];
myReport.push({'label': 'lalala', 'value': 'sososo'});
myReport.push({'label': 'download', 'value': this.averageSpeed.downloadTest.toLocaleString()});
myReport.push({'label': 'upload', 'value': this.averageSpeed.uploadTest.toLocaleString()});
myReport.push({'label': 'ping', 'value': this.averageSpeed.pingTest.toLocaleString()});
myReport.push({'label': 'Bewertung', 'value': this.networkRating});
this.ds.networkData$.next(myReport);
});
......
......@@ -11,4 +11,6 @@
display: block;
left: 15px;
right: 15px;
overflow-y: auto;
overflow-x: scroll;
}
......@@ -6,6 +6,6 @@
<p *ngFor="let rd of environmentData">{{ rd.label }}: {{ rd.value }}</p>
<h2>Netzwerk-Info</h2>
<p *ngFor="let rd of networkData">{{ rd.label }}: {{ rd.value }}</p>
<h2>Fragen</h2>
<h2 *ngIf="questionnaireData.length > 0">Fragen</h2>
<p *ngFor="let rd of questionnaireData">{{ rd.label }}: {{ rd.value }}</p>
</div>
......@@ -18,8 +18,11 @@ export class ReportComponent implements OnInit {
}
ngOnInit() {
this.ds.environmentData$.subscribe(rd => this.environmentData = rd);
this.ds.networkData$.subscribe(rd => this.networkData = rd);
// this.ds.environmentData$.subscribe(rd => ); too early!
this.ds.networkData$.subscribe(rd => {
this.networkData = rd;
this.environmentData = this.ds.environmentData$.getValue();
});
this.ds.questionnaireData$.subscribe(rd => this.questionnaireData = rd);
this.ds.reportEnabled$.subscribe(is => this.reportEnabled = is);
......
......@@ -4,9 +4,9 @@
<div class="page-body">
<div class="sheetofpaper">
<mat-horizontal-stepper labelPosition="bottom" #stepper (selectionChange)="stepperSelectionChanged($event)">
<mat-step>
<mat-step #stepEnv>
<ng-template matStepLabel>Computer</ng-template>
<iqb-environment-check></iqb-environment-check>
<iqb-environment-check #compEnv></iqb-environment-check>
<div class="navi_buttons">
<button mat-mini-fab matStepperNext>
<i class="material-icons">chevron_right</i>
......@@ -56,6 +56,7 @@
<button mat-mini-fab matStepperPrevious>
<i class="material-icons">chevron_left</i>
</button>
<button mat-raised-button>Als E-Mail verschicken</button>
</div>
</mat-step>
</mat-horizontal-stepper>
......
......@@ -6,6 +6,7 @@ import { Component, OnInit, ViewChild } from '@angular/core';
import { CheckConfigData, BackendService } from './backend.service';
import { MatStepper, MatStep } from '../../../node_modules/@angular/material';
import { UnitCheckComponent } from './unit-check/unit-check.component';
import { EnvironmentCheckComponent } from './environment-check/environment-check.component';
@Component({
......@@ -15,15 +16,19 @@ import { UnitCheckComponent } from './unit-check/unit-check.component';
})
export class RunComponent implements OnInit {
@ViewChild('stepper') stepper: MatStepper;
@ViewChild('stepEnv') stepEnv: MatStep;
@ViewChild('compEnv') compEnv: EnvironmentCheckComponent;
@ViewChild('stepNetwork') stepNetwork: MatStep;
@ViewChild('stepUnit') stepUnit: MatStep;
@ViewChild('compNetwork') compNetwork: NetworkCheckComponent;
@ViewChild('stepUnit') stepUnit: MatStep;
@ViewChild('compUnit') compUnit: UnitCheckComponent;
paramId: string;
unitcheckAvailable = false;
questionnaireAvailable = false;
emailEnabled = false;
constructor(
private bs: BackendService,
......@@ -49,6 +54,25 @@ export class RunComponent implements OnInit {
} else {
this.bs.getCheckConfigData(this.paramId).subscribe(
scData => {
if (typeof scData.downloadGood === 'undefined') {
scData.downloadGood = this.bs.basicTestConfigData.downloadGood;
}
if (typeof scData.downloadMinimum === 'undefined') {
scData.downloadMinimum = this.bs.basicTestConfigData.downloadMinimum;
}
if (typeof scData.uploadGood === 'undefined') {
scData.uploadGood = this.bs.basicTestConfigData.uploadGood;
}
if (typeof scData.uploadMinimum === 'undefined') {
scData.uploadMinimum = this.bs.basicTestConfigData.uploadMinimum;
}
if (typeof scData.pingGood === 'undefined') {
scData.pingGood = this.bs.basicTestConfigData.pingGood;
}
if (typeof scData.pingMinimum === 'undefined') {
scData.pingMinimum = this.bs.basicTestConfigData.pingMinimum;
}
this.ds.checkConfig$.next(scData);
this.stepper.selectedIndex = 0;
this.stepNetwork.completed = false;
......@@ -59,6 +83,8 @@ export class RunComponent implements OnInit {
}
stepperSelectionChanged(e) {
this.ds.setPageTitle();
if (e.selectedStep === this.stepUnit) {
if (!this.stepUnit.completed) {
const cd = this.ds.checkConfig$.getValue();
......@@ -70,6 +96,8 @@ export class RunComponent implements OnInit {
this.compNetwork.startCheck();
this.stepNetwork.completed = true;
}
} else if (e.selectedStep === this.stepEnv) {
this.compEnv.startCheck();
}
}
......
import { SyscheckDataService } from './syscheck-data.service';
import { Router, ActivatedRoute } from '@angular/router';
import { BackendService, CheckConfig } from './backend.service';
import { Component, OnInit } from '@angular/core';
......@@ -15,6 +16,7 @@ export class StartComponent implements OnInit {
constructor(
private bs: BackendService,
private ds: SyscheckDataService,
private route: ActivatedRoute,
private router: Router) { }
......@@ -24,6 +26,7 @@ export class StartComponent implements OnInit {
this.checkConfigList = myConfigs;
this.checkConfigList.push(this.bs.basicTestConfig);
this.dataLoading = false;
this.ds.setPageTitle();
});
}
......
......@@ -7,6 +7,8 @@ import { e } from '@angular/core/src/render3';
providedIn: 'root'
})
export class SyscheckDataService {
public pageTitle$ = new BehaviorSubject<string>('IQB-Testcenter - System-Check');
public checkConfig$ = new BehaviorSubject<CheckConfigData>(null);
public environmentData$ = new BehaviorSubject<ReportEntry[]>([]);
public networkData$ = new BehaviorSubject<ReportEntry[]>([]);
......@@ -22,8 +24,8 @@ export class SyscheckDataService {
constructor() {
this.checkConfig$.subscribe(cDef => {
this.environmentData$.next([]);
this.networkData$.next([]);
this.questionnaireData$.next([]);
if (cDef === null) {
this.reportWithEmail$.next(false);
this.unitcheckAvailable$.next(false);
......@@ -35,13 +37,10 @@ export class SyscheckDataService {
}
});
}
}
export interface NetworkRequestTestResult {
'type': 'downloadTest' | 'uploadTest';
'size': number;
'duration': number;
setPageTitle() {
this.pageTitle$.next('IQB-Testcenter - System-Check');
}
}
export interface ReportEntry {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment