src/app/sys-check/sys-check.component.ts
styleUrls | ./sys-check.component.css |
templateUrl | ./sys-check.component.html |
Properties |
|
Methods |
|
constructor(bs: BackendService, ds: SysCheckDataService, route: ActivatedRoute, mds: MainDataService, cts: CustomtextService)
|
||||||||||||||||||
Defined in src/app/sys-check/sys-check.component.ts:15
|
||||||||||||||||||
Parameters :
|
Private completeConfig |
completeConfig()
|
Defined in src/app/sys-check/sys-check.component.ts:69
|
Returns :
void
|
ngOnInit |
ngOnInit()
|
Defined in src/app/sys-check/sys-check.component.ts:25
|
Returns :
void
|
checkLabel |
Type : string
|
Default value : 'Bitte warten'
|
Defined in src/app/sys-check/sys-check.component.ts:15
|
Public ds |
Type : SysCheckDataService
|
Defined in src/app/sys-check/sys-check.component.ts:18
|
import { ActivatedRoute, ParamMap } from '@angular/router';
import { Component, OnInit } from '@angular/core';
import { CustomtextService } from 'iqb-components';
import { BackendService } from './backend.service';
import { SysCheckDataService } from './sys-check-data.service';
import { MainDataService } from '../maindata.service';
import { UnitAndPlayerContainer } from './sys-check.interfaces';
@Component({
templateUrl: './sys-check.component.html',
styleUrls: ['./sys-check.component.css']
})
export class SysCheckComponent implements OnInit {
checkLabel = 'Bitte warten';
constructor(
private bs: BackendService,
public ds: SysCheckDataService,
private route: ActivatedRoute,
private mds: MainDataService,
private cts: CustomtextService
) {
}
ngOnInit(): void {
setTimeout(() => this.mds.appSubTitle$.next('System-Check'));
this.route.paramMap.subscribe((params: ParamMap) => {
const sysCheckId = params.get('sys-check-name');
const workspaceId = parseInt(params.get('workspace-id'), 10);
setTimeout(() => {
this.mds.setSpinnerOn();
this.bs.getCheckConfigData(workspaceId, sysCheckId).subscribe(checkConfig => {
this.ds.checkConfig = checkConfig;
if (checkConfig) {
this.checkLabel = checkConfig.label;
this.mds.appSubTitle$.next(`System-Check ${this.checkLabel}`);
if (checkConfig.customTexts.length > 0) {
const myCustomTexts: { [key: string]: string } = {};
checkConfig.customTexts.forEach(ct => {
myCustomTexts[ct.key] = ct.value;
});
this.cts.addCustomTexts(myCustomTexts);
}
if (checkConfig.hasUnit) {
this.bs.getUnitAndPlayer(this.ds.checkConfig.workspaceId, this.ds.checkConfig.name)
.subscribe((unitAndPlayer: UnitAndPlayerContainer | boolean) => {
if (unitAndPlayer !== false && (unitAndPlayer as UnitAndPlayerContainer).player.length > 0) {
this.ds.unitAndPlayerContainer = unitAndPlayer as UnitAndPlayerContainer;
} else {
console.error('Konnte Unit-Player nicht laden');
this.ds.checkConfig.hasUnit = false;
// this.ds.unitReport.push({id: 'UNIT-PLAYER-ERROR', type: 'unit/player',
// label: 'loading error', value: 'Error', warning: true});
}
this.completeConfig();
});
} else {
this.completeConfig();
}
} else {
this.checkLabel = `Fehler beim Laden der Konfiguration ${workspaceId}/${sysCheckId}`;
this.completeConfig();
}
});
});
});
}
private completeConfig() {
this.mds.setSpinnerOff();
this.ds.loadConfigComplete = true;
this.ds.setSteps();
this.ds.setNewCurrentStep('w');
}
}
<div id="header" fxLayout="row" fxLayoutAlign="center center">
<p>System-Check: {{checkLabel}}</p>
<button mat-fab [disabled]="!ds.prevStep || !ds.loadConfigComplete || !ds.networkCheckStatus.done" color="accent"
[routerLink]="[ds.prevStep]" matTooltip="Zurück" fxFlex="none">
<i class="material-icons">chevron_left</i>
</button>
<button mat-fab [disabled]="!ds.nextStep || !ds.loadConfigComplete || !ds.networkCheckStatus.done || !ds.timeCheckDone" color="accent"
[routerLink]="[ds.nextStep]" matTooltip="Weiter" fxFlex="none">
<i class="material-icons">chevron_right</i>
</button>
</div>
<div class="page-body">
<router-outlet></router-outlet>
</div>
./sys-check.component.css
.sys-check-body {
position: absolute;
width: 100%;
}
mat-card {
margin: 10px;
}
#header {
position: absolute;
width: 100%;
padding-top: 10px;
color: white;
z-index: 444;
}
button {
margin-left: 15px;
}
#header .material-icons {
/* font-size: 2.0rem; */
position: relative;
top: -8px;
font-size: 36px;
padding: 2px;
}