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

syschecker started

parent 94ef7e76
No related branches found
No related tags found
No related merge requests found
Showing
with 211 additions and 8 deletions
div.intro-main {
margin: 40px;
max-width: 600px;
}
...@@ -2,8 +2,7 @@ import { Component, Inject, OnInit } from '@angular/core'; ...@@ -2,8 +2,7 @@ import { Component, Inject, OnInit } from '@angular/core';
import { LogindataService } from '../logindata.service'; import { LogindataService } from '../logindata.service';
@Component({ @Component({
templateUrl: './about.component.html', templateUrl: './about.component.html'
styleUrls: ['./about.component.css']
}) })
export class AboutComponent implements OnInit { export class AboutComponent implements OnInit {
......
import { StartComponent as CheckStartComponent } from './sys-check/start.component';
import { TestControllerComponent } from './test-controller'; import { TestControllerComponent } from './test-controller';
import { AboutComponent } from './about/about.component'; import { AboutComponent } from './about/about.component';
import { StartComponent } from './start/start.component'; import { StartComponent } from './start/start.component';
...@@ -9,6 +10,7 @@ const routes: Routes = [ ...@@ -9,6 +10,7 @@ const routes: Routes = [
{path: '', component: StartComponent, pathMatch: 'full'}, {path: '', component: StartComponent, pathMatch: 'full'},
{path: 'start', component: StartComponent}, {path: 'start', component: StartComponent},
{path: 'about', component: AboutComponent}, {path: 'about', component: AboutComponent},
{path: 'check', component: CheckStartComponent},
{path: 't', component: TestControllerComponent} {path: 't', component: TestControllerComponent}
]; ];
......
...@@ -37,7 +37,7 @@ export class AppComponent implements OnInit { ...@@ -37,7 +37,7 @@ export class AppComponent implements OnInit {
window.addEventListener('message', (event: MessageEvent) => { window.addEventListener('message', (event: MessageEvent) => {
const msgData = event.data; const msgData = event.data;
const msgType = msgData['type']; const msgType = msgData['type'];
if ((msgType !== undefined) || (msgType !== null)) { if ((msgType !== undefined) && (msgType !== null)) {
if (msgType.substr(0, 7) === 'OpenCBA') { if (msgType.substr(0, 7) === 'OpenCBA') {
this.lds.postMessage$.next(event); this.lds.postMessage$.next(event);
} }
......
import { SysCheckModule } from './sys-check/sys-check.module';
import { AboutComponent } from './about/about.component'; import { AboutComponent } from './about/about.component';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { HttpClientModule } from '@angular/common/http'; import { HttpClientModule } from '@angular/common/http';
...@@ -19,6 +20,7 @@ import { LocationStrategy, HashLocationStrategy } from '@angular/common'; ...@@ -19,6 +20,7 @@ import { LocationStrategy, HashLocationStrategy } from '@angular/common';
import { FlexLayoutModule } from '@angular/flex-layout'; import { FlexLayoutModule } from '@angular/flex-layout';
import { ErrormsgComponent } from './errormsg/errormsg.component'; import { ErrormsgComponent } from './errormsg/errormsg.component';
@NgModule({ @NgModule({
declarations: [ declarations: [
AppComponent, AppComponent,
...@@ -45,7 +47,8 @@ import { ErrormsgComponent } from './errormsg/errormsg.component'; ...@@ -45,7 +47,8 @@ import { ErrormsgComponent } from './errormsg/errormsg.component';
HttpClientModule, HttpClientModule,
TestControllerModule, TestControllerModule,
AppRoutingModule, AppRoutingModule,
IqbCommonModule IqbCommonModule,
SysCheckModule
], ],
providers: [ providers: [
BackendService, BackendService,
......
...@@ -125,6 +125,7 @@ ...@@ -125,6 +125,7 @@
</mat-card-content> </mat-card-content>
<mat-card-actions> <mat-card-actions>
<button mat-raised-button color="foreground" [routerLink]="['/about']">Impressum/Datenschutz</button> <button mat-raised-button color="foreground" [routerLink]="['/about']">Impressum/Datenschutz</button>
<button mat-raised-button color="foreground" [routerLink]="['/check']">System-Check</button>
</mat-card-actions> </mat-card-actions>
</mat-card> </mat-card>
</div> </div>
......
import { TestBed, inject } from '@angular/core/testing';
import { BackendService } from './backend.service';
describe('BackendService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [BackendService]
});
});
it('should be created', inject([BackendService], (service: BackendService) => {
expect(service).toBeTruthy();
}));
});
import { CheckConfig } from './backend.service';
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';
@Injectable({
providedIn: 'root'
})
export class BackendService {
constructor(
@Inject('SERVER_URL') private serverUrl: string,
private http: HttpClient) {
this.serverUrl = this.serverUrl + 'php_tc/';
}
// 7777777777777777777777777777777777777777777777777777777777777777777777
getCheckConfigs(): Observable<CheckConfig[]> {
const httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json'
})
};
return this.http
.post<CheckConfig[]>(this.serverUrl + 'getSysCheckConfigs.php', {}, httpOptions)
.pipe(
catchError(problem_data => {
const myreturn: CheckConfig[] = [];
return of(myreturn);
})
);
}
// 7777777777777777777777777777777777777777777777777777777777777777777777
getCheckConfigData(cid: string): Observable<CheckConfigData> {
const httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json'
})
};
return this.http
.post<CheckConfigData>(this.serverUrl + 'getSysCheckConfigData.php', {c: cid}, httpOptions)
.pipe(
catchError(problem_data => {
const myreturn: CheckConfigData = null;
return of(myreturn);
})
);
}
}
export interface CheckConfig {
id: string;
label: string;
description: string;
}
export interface CheckConfigData {
id: string;
label: string;
email: string;
}
<p>
environment-check works!
</p>
<p>
<button (click)="goto()">jojo</button>
</p>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { EnvironmentCheckComponent } from './environment-check.component';
describe('EnvironmentCheckComponent', () => {
let component: EnvironmentCheckComponent;
let fixture: ComponentFixture<EnvironmentCheckComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EnvironmentCheckComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(EnvironmentCheckComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { SyscheckDataService } from '../syscheck-data.service';
@Component({
selector: 'iqb-environment-check',
templateUrl: './environment-check.component.html',
styleUrls: ['./environment-check.component.css']
})
export class EnvironmentCheckComponent implements OnInit {
constructor(
private ds: SyscheckDataService
) { }
ngOnInit() {
}
goto() {
this.ds.questionnaireAvailable$.next(true);
}
}
export { StartComponent } from './start.component';
<p>
network-check works!
</p>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NetworkCheckComponent } from './network-check.component';
describe('NetworkCheckComponent', () => {
let component: NetworkCheckComponent;
let fixture: ComponentFixture<NetworkCheckComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ NetworkCheckComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(NetworkCheckComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'iqb-network-check',
templateUrl: './network-check.component.html',
styleUrls: ['./network-check.component.css']
})
export class NetworkCheckComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
<p>
questionnaire works!
</p>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { QuestionnaireComponent } from './questionnaire.component';
describe('QuestionnaireComponent', () => {
let component: QuestionnaireComponent;
let fixture: ComponentFixture<QuestionnaireComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ QuestionnaireComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(QuestionnaireComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
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