From fb2ca122690fc8846f641f7a87ec79f41f747eb5 Mon Sep 17 00:00:00 2001
From: Martin Mechtel <mechtelm@user.hu-berlin.de>
Date: Sat, 15 Dec 2018 19:56:26 +0100
Subject: [PATCH] syscheck unit continued

---
 src/app/sys-check/backend.service.ts                   |  6 +++---
 src/app/sys-check/run.component.ts                     |  5 +++--
 src/app/sys-check/unit-check/unit-check.component.html |  2 +-
 src/app/sys-check/unit-check/unit-check.component.ts   | 10 ++++------
 4 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/src/app/sys-check/backend.service.ts b/src/app/sys-check/backend.service.ts
index 3867d1f8..10218dbe 100644
--- a/src/app/sys-check/backend.service.ts
+++ b/src/app/sys-check/backend.service.ts
@@ -23,7 +23,7 @@ export class BackendService {
       email: false
     };
 
-    constructor(
+  constructor(
     @Inject('SERVER_URL') private serverUrl: string,
     private http: HttpClient) {
       this.serverUrl = this.serverUrl + 'php_tc/';
@@ -64,14 +64,14 @@ export class BackendService {
   }
 
   // BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
-  public getUnitData (syscheckId: string, unitId: string): Observable<UnitData> {
+  public getUnitData (unitId: string): Observable<UnitData> {
     const httpOptions = {
       headers: new HttpHeaders({
         'Content-Type':  'application/json'
       })
     };
     return this.http
-      .post<UnitData>(this.serverUrl + 'getUnitData.php', {c: syscheckId, u: unitId}, httpOptions)
+      .post<UnitData>(this.serverUrl + 'getSysCheckUnitData.php', {u: unitId}, httpOptions)
         .pipe(
           catchError(problem_data => {
             const myreturn: UnitData = null;
diff --git a/src/app/sys-check/run.component.ts b/src/app/sys-check/run.component.ts
index df4c62a0..c691db21 100644
--- a/src/app/sys-check/run.component.ts
+++ b/src/app/sys-check/run.component.ts
@@ -64,12 +64,13 @@ export class RunComponent implements OnInit {
     if (e.selectedStep === this.stepUnit) {
       if (!this.stepUnit.completed) {
         const cd = this.ds.checkConfig$.getValue();
-        this.compUnit.loadUnit(cd.id, cd.unit);
+        this.compUnit.loadUnit(cd.unit);
         this.stepUnit.completed = true;
       }
     } else if (e.selectedStep === this.stepNetwork) {
       if (!this.stepNetwork.completed) {
-        this.compNetwork.startCheck();
+        // this.compNetwork.startCheck();
+        this.stepNetwork.completed = true;
       }
     }
 
diff --git a/src/app/sys-check/unit-check/unit-check.component.html b/src/app/sys-check/unit-check/unit-check.component.html
index 5174f5cf..49cd5b56 100644
--- a/src/app/sys-check/unit-check/unit-check.component.html
+++ b/src/app/sys-check/unit-check/unit-check.component.html
@@ -1,6 +1,6 @@
 <div class="spinner-container" *ngIf="dataLoading">
   <mat-spinner></mat-spinner>
 </div>
-<div id="iFrameHost" iqbResizeIFrameChild class="preview-body">
+<div #iFrameHost iqbResizeIFrameChild class="preview-body">
 
 </div>
diff --git a/src/app/sys-check/unit-check/unit-check.component.ts b/src/app/sys-check/unit-check/unit-check.component.ts
index ec7b90ae..3bdf7743 100644
--- a/src/app/sys-check/unit-check/unit-check.component.ts
+++ b/src/app/sys-check/unit-check/unit-check.component.ts
@@ -1,7 +1,7 @@
 import { LogindataService } from './../../logindata.service';
 import { BackendService, UnitData } from './../backend.service';
 import { SyscheckDataService } from './../syscheck-data.service';
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, ViewChild } from '@angular/core';
 import { OnDestroy } from '@angular/core/src/metadata/lifecycle_hooks';
 import { Subscription, BehaviorSubject } from 'rxjs';
 
@@ -17,9 +17,9 @@ import { Subscription, BehaviorSubject } from 'rxjs';
   styleUrls: ['./unit-check.component.css']
 })
 export class UnitCheckComponent implements OnInit, OnDestroy {
+  @ViewChild('iFrameHost') iFrameHostElement: HTMLElement;
   unitcheckEnabled = false;
 
-  private iFrameHostElement: HTMLElement;
   private iFrameItemplayer: HTMLIFrameElement;
   private postMessageSubscription: Subscription = null;
   private itemplayerSessionId = '';
@@ -117,16 +117,14 @@ export class UnitCheckComponent implements OnInit, OnDestroy {
   }
 
   ngOnInit() {
-    this.iFrameHostElement = <HTMLElement>document.querySelector('#iFrameHost');
-
     this.iFrameItemplayer = null;
   }
 
   // // // // // // // // // // // // // // // // // // // // // // // //
-  public loadUnit(syscheckId: string, unitId: string) {
+  public loadUnit(unitId: string) {
     this.dataLoading = true;
 
-    this.bs.getUnitData(syscheckId, unitId).subscribe((data: UnitData) => {
+    this.bs.getUnitData(unitId).subscribe((data: UnitData) => {
       // VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
       while (this.iFrameHostElement.hasChildNodes()) {
         this.iFrameHostElement.removeChild(this.iFrameHostElement.lastChild);
-- 
GitLab