File

src/app/sys-check/sys-check-data.service.ts

Index

Properties
Methods

Methods

setNewCurrentStep
setNewCurrentStep(newStep: string)
Parameters :
Name Type Optional
newStep string No
Returns : void
setSteps
setSteps()
Returns : void

Properties

checkConfig
Type : CheckConfig
Default value : null
Private currentStep
Type : number
Default value : 0
environmentReport
Type : ReportEntry[]
Default value : []
loadConfigComplete
Default value : false
networkCheckStatus
Type : NetworkCheckStatus
Default value : { done: true, message: 'Messung noch nicht gestartet', avgUploadSpeedBytesPerSecond: -1, avgDownloadSpeedBytesPerSecond: -1 }
networkReport
Type : ReportEntry[]
Default value : []
nextStep
Type : string
Default value : ''
prevStep
Type : string
Default value : ''
questionnaireReport
Type : ReportEntry[]
Default value : []
Private stepDefs
Type : StepDef[]
Default value : [ { route: 'w', label: 'Ermitteln von Systemdaten (Betriebssystem, Browser)' }, { route: 'n', label: 'Schätzung der Qualität der Internetverbindung' }, { route: 'u', label: 'Prüfen von typischen Eingabe-Elementen' }, { route: 'q', label: 'Beantworten einiger Fragen' }, { route: 'r', label: 'Senden eines Berichtes (Kennwort erforderlich)' } ]
stepLabels
Type : string[]
Default value : []
Private steps
Type : string[]
Default value : []
timeCheckDone
Default value : false
unitAndPlayerContainer
Type : UnitAndPlayerContainer
Default value : null
import { Injectable } from '@angular/core';
import {
  CheckConfig,
  NetworkCheckStatus,
  ReportEntry,
  StepDef,
  UnitAndPlayerContainer
} from './sys-check.interfaces';

@Injectable({
  providedIn: 'root'
})
export class SysCheckDataService {
  private steps: string[] = [];
  stepLabels: string[] = [];
  private currentStep = 0;
  nextStep = '';
  prevStep = '';
  private stepDefs: StepDef[] = [
    {
      route: 'w',
      label: 'Ermitteln von Systemdaten (Betriebssystem, Browser)'
    },
    {
      route: 'n',
      label: 'Schätzung der Qualität der Internetverbindung'
    },
    {
      route: 'u',
      label: 'Prüfen von typischen Eingabe-Elementen'
    },
    {
      route: 'q',
      label: 'Beantworten einiger Fragen'
    },
    {
      route: 'r',
      label: 'Senden eines Berichtes (Kennwort erforderlich)'
    }
  ];

  checkConfig: CheckConfig = null;
  loadConfigComplete = false;
  unitAndPlayerContainer: UnitAndPlayerContainer = null;
  environmentReport: ReportEntry[] = [];
  networkReport: ReportEntry[] = [];
  questionnaireReport: ReportEntry[] = [];
  networkCheckStatus: NetworkCheckStatus = {
    done: true,
    message: 'Messung noch nicht gestartet',
    avgUploadSpeedBytesPerSecond: -1,
    avgDownloadSpeedBytesPerSecond: -1
  };

  timeCheckDone = false;

  setSteps(): void {
    this.steps = [];
    this.stepLabels = [];
    this.stepDefs.forEach(step => {
      if (this.checkConfig) {
        if ((step.route === 'w') ||
         (step.route === 'n' && !this.checkConfig.skipNetwork) ||
         (step.route === 'u' && this.checkConfig.hasUnit) ||
         (step.route === 'q' && this.checkConfig.questions.length > 0) ||
         (step.route === 'r' && this.checkConfig.canSave)) {
          this.steps.push(step.route);
          this.stepLabels.push(step.label);
        }
      }
    });
  }

  setNewCurrentStep(newStep: string): void {
    for (let stepIndex = 0; stepIndex < this.steps.length; stepIndex++) {
      if (this.steps[stepIndex] === newStep) {
        this.currentStep = stepIndex;
        this.nextStep = stepIndex < this.steps.length - 1 ? this.steps[this.currentStep + 1] : '';
        this.prevStep = stepIndex > 0 ? this.steps[this.currentStep - 1] : '';
        break;
      }
    }
  }
}

result-matching ""

    No results matching ""