From 7e82c57b0effe3c642763b90978a45ed5382eb29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Danyi?= Date: Wed, 6 Sep 2017 18:53:31 +0200 Subject: [PATCH] * TspInfo module added --- src/app/app.module.ts | 4 +- .../tsp-info/animgif/animgif.component.css | 0 .../tsp-info/animgif/animgif.component.html | 3 ++ .../animgif/animgif.component.spec.ts | 25 +++++++++ src/app/tsp-info/animgif/animgif.component.ts | 21 ++++++++ .../expedites/expedites.component.css | 0 .../expedites/expedites.component.html | 4 ++ .../expedites/expedites.component.spec.ts | 25 +++++++++ .../tsp-info/expedites/expedites.component.ts | 23 ++++++++ .../tsp-info/info-box/info-box.component.css | 5 ++ .../tsp-info/info-box/info-box.component.html | 3 ++ .../info-box/info-box.component.spec.ts | 25 +++++++++ .../tsp-info/info-box/info-box.component.ts | 18 +++++++ .../info-page/info-page.component.css | 0 .../info-page/info-page.component.html | 17 ++++++ .../info-page/info-page.component.spec.ts | 25 +++++++++ .../tsp-info/info-page/info-page.component.ts | 34 ++++++++++++ .../pra-goals/pra-goals.component.css | 0 .../pra-goals/pra-goals.component.html | 24 +++++++++ .../pra-goals/pra-goals.component.spec.ts | 25 +++++++++ .../tsp-info/pra-goals/pra-goals.component.ts | 43 +++++++++++++++ src/app/tsp-info/shared/anim-gif.model.ts | 4 ++ .../tsp-info/shared/expedite-info.model.ts | 4 ++ src/app/tsp-info/shared/index.ts | 9 ++++ .../tsp-info/shared/lab-temperature.model.ts | 2 + src/app/tsp-info/shared/prio-values.model.ts | 5 ++ .../tsp-info/shared/tr-flow-error.model.ts | 4 ++ src/app/tsp-info/shared/tr-progress.model.ts | 6 +++ src/app/tsp-info/shared/tsp-info.model.ts | 31 +++++++++++ .../tsp-info/shared/tsp-info.service.spec.ts | 15 ++++++ src/app/tsp-info/shared/tsp-info.service.ts | 54 +++++++++++++++++++ .../tr-flow-errors.component.css | 0 .../tr-flow-errors.component.html | 7 +++ .../tr-flow-errors.component.spec.ts | 25 +++++++++ .../tr-flow-errors.component.ts | 27 ++++++++++ .../tr-progress/tr-progress.component.css | 0 .../tr-progress/tr-progress.component.html | 7 +++ .../tr-progress/tr-progress.component.spec.ts | 25 +++++++++ .../tr-progress/tr-progress.component.ts | 24 +++++++++ src/app/tsp-info/tsp-info-routing.module.ts | 21 ++++++++ src/app/tsp-info/tsp-info.module.ts | 32 +++++++++++ 41 files changed, 625 insertions(+), 1 deletion(-) create mode 100644 src/app/tsp-info/animgif/animgif.component.css create mode 100644 src/app/tsp-info/animgif/animgif.component.html create mode 100644 src/app/tsp-info/animgif/animgif.component.spec.ts create mode 100644 src/app/tsp-info/animgif/animgif.component.ts create mode 100644 src/app/tsp-info/expedites/expedites.component.css create mode 100644 src/app/tsp-info/expedites/expedites.component.html create mode 100644 src/app/tsp-info/expedites/expedites.component.spec.ts create mode 100644 src/app/tsp-info/expedites/expedites.component.ts create mode 100644 src/app/tsp-info/info-box/info-box.component.css create mode 100644 src/app/tsp-info/info-box/info-box.component.html create mode 100644 src/app/tsp-info/info-box/info-box.component.spec.ts create mode 100644 src/app/tsp-info/info-box/info-box.component.ts create mode 100644 src/app/tsp-info/info-page/info-page.component.css create mode 100644 src/app/tsp-info/info-page/info-page.component.html create mode 100644 src/app/tsp-info/info-page/info-page.component.spec.ts create mode 100644 src/app/tsp-info/info-page/info-page.component.ts create mode 100644 src/app/tsp-info/pra-goals/pra-goals.component.css create mode 100644 src/app/tsp-info/pra-goals/pra-goals.component.html create mode 100644 src/app/tsp-info/pra-goals/pra-goals.component.spec.ts create mode 100644 src/app/tsp-info/pra-goals/pra-goals.component.ts create mode 100644 src/app/tsp-info/shared/anim-gif.model.ts create mode 100644 src/app/tsp-info/shared/expedite-info.model.ts create mode 100644 src/app/tsp-info/shared/index.ts create mode 100644 src/app/tsp-info/shared/lab-temperature.model.ts create mode 100644 src/app/tsp-info/shared/prio-values.model.ts create mode 100644 src/app/tsp-info/shared/tr-flow-error.model.ts create mode 100644 src/app/tsp-info/shared/tr-progress.model.ts create mode 100644 src/app/tsp-info/shared/tsp-info.model.ts create mode 100644 src/app/tsp-info/shared/tsp-info.service.spec.ts create mode 100644 src/app/tsp-info/shared/tsp-info.service.ts create mode 100644 src/app/tsp-info/tr-flow-errors/tr-flow-errors.component.css create mode 100644 src/app/tsp-info/tr-flow-errors/tr-flow-errors.component.html create mode 100644 src/app/tsp-info/tr-flow-errors/tr-flow-errors.component.spec.ts create mode 100644 src/app/tsp-info/tr-flow-errors/tr-flow-errors.component.ts create mode 100644 src/app/tsp-info/tr-progress/tr-progress.component.css create mode 100644 src/app/tsp-info/tr-progress/tr-progress.component.html create mode 100644 src/app/tsp-info/tr-progress/tr-progress.component.spec.ts create mode 100644 src/app/tsp-info/tr-progress/tr-progress.component.ts create mode 100644 src/app/tsp-info/tsp-info-routing.module.ts create mode 100644 src/app/tsp-info/tsp-info.module.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index e3f8b9e..5e4f571 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -4,6 +4,7 @@ import { NgModule } from '@angular/core'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { KanbanModule } from './kanban/kanban.module'; +import { TspInfoModule } from "./tsp-info/tsp-info.module"; @NgModule({ declarations: [ @@ -12,7 +13,8 @@ import { KanbanModule } from './kanban/kanban.module'; imports: [ BrowserModule, AppRoutingModule, - KanbanModule + KanbanModule, + TspInfoModule ], providers: [], bootstrap: [AppComponent] diff --git a/src/app/tsp-info/animgif/animgif.component.css b/src/app/tsp-info/animgif/animgif.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/tsp-info/animgif/animgif.component.html b/src/app/tsp-info/animgif/animgif.component.html new file mode 100644 index 0000000..384a806 --- /dev/null +++ b/src/app/tsp-info/animgif/animgif.component.html @@ -0,0 +1,3 @@ +

+ animgif works! +

diff --git a/src/app/tsp-info/animgif/animgif.component.spec.ts b/src/app/tsp-info/animgif/animgif.component.spec.ts new file mode 100644 index 0000000..2e64049 --- /dev/null +++ b/src/app/tsp-info/animgif/animgif.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AnimgifComponent } from './animgif.component'; + +describe('AnimgifComponent', () => { + let component: AnimgifComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AnimgifComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AnimgifComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should be created', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/tsp-info/animgif/animgif.component.ts b/src/app/tsp-info/animgif/animgif.component.ts new file mode 100644 index 0000000..264e975 --- /dev/null +++ b/src/app/tsp-info/animgif/animgif.component.ts @@ -0,0 +1,21 @@ +import { Component, OnInit } from '@angular/core'; +import {InfoBoxComponent} from "../info-box/info-box.component"; + +@Component({ + selector: 'app-animgif', + templateUrl: './animgif.component.html', + styleUrls: [ + '../info-box/info-box.component.css', + './animgif.component.css' + ] +}) +export class AnimgifComponent extends InfoBoxComponent implements OnInit { + + constructor() { + super(); + } + + ngOnInit() { + } + +} diff --git a/src/app/tsp-info/expedites/expedites.component.css b/src/app/tsp-info/expedites/expedites.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/tsp-info/expedites/expedites.component.html b/src/app/tsp-info/expedites/expedites.component.html new file mode 100644 index 0000000..dc98698 --- /dev/null +++ b/src/app/tsp-info/expedites/expedites.component.html @@ -0,0 +1,4 @@ +

{{title}}

+

{{data.all}}

+

{{data.unassigned}}

+

unassigned

diff --git a/src/app/tsp-info/expedites/expedites.component.spec.ts b/src/app/tsp-info/expedites/expedites.component.spec.ts new file mode 100644 index 0000000..f6d4c09 --- /dev/null +++ b/src/app/tsp-info/expedites/expedites.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ExpeditesComponent } from './expedites.component'; + +describe('ExpeditesComponent', () => { + let component: ExpeditesComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ExpeditesComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ExpeditesComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should be created', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/tsp-info/expedites/expedites.component.ts b/src/app/tsp-info/expedites/expedites.component.ts new file mode 100644 index 0000000..b4ad29a --- /dev/null +++ b/src/app/tsp-info/expedites/expedites.component.ts @@ -0,0 +1,23 @@ +import {Component, Input, OnInit} from '@angular/core'; +import {InfoBoxComponent} from "../info-box/info-box.component"; +import {ExpediteInfo} from "../shared/expedite-info.model"; + +@Component({ + selector: 'app-expedites', + templateUrl: './expedites.component.html', + styleUrls: [ + '../info-box/info-box.component.css', + './expedites.component.css' + ] +}) +export class ExpeditesComponent extends InfoBoxComponent implements OnInit { + + @Input() data: ExpediteInfo; + + constructor() { + super(); + } + + ngOnInit() {} + +} diff --git a/src/app/tsp-info/info-box/info-box.component.css b/src/app/tsp-info/info-box/info-box.component.css new file mode 100644 index 0000000..39daac2 --- /dev/null +++ b/src/app/tsp-info/info-box/info-box.component.css @@ -0,0 +1,5 @@ +:host { + display: inline-block; + padding: 1.25em; + background-color: #0E566C; +} diff --git a/src/app/tsp-info/info-box/info-box.component.html b/src/app/tsp-info/info-box/info-box.component.html new file mode 100644 index 0000000..b3fa334 --- /dev/null +++ b/src/app/tsp-info/info-box/info-box.component.html @@ -0,0 +1,3 @@ +

+ info-box works! +

diff --git a/src/app/tsp-info/info-box/info-box.component.spec.ts b/src/app/tsp-info/info-box/info-box.component.spec.ts new file mode 100644 index 0000000..527ba2d --- /dev/null +++ b/src/app/tsp-info/info-box/info-box.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { InfoBoxComponent } from './info-box.component'; + +describe('InfoBoxComponent', () => { + let component: InfoBoxComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ InfoBoxComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(InfoBoxComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should be created', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/tsp-info/info-box/info-box.component.ts b/src/app/tsp-info/info-box/info-box.component.ts new file mode 100644 index 0000000..f317132 --- /dev/null +++ b/src/app/tsp-info/info-box/info-box.component.ts @@ -0,0 +1,18 @@ +import {Component, Input, OnInit} from '@angular/core'; + +@Component({ + selector: 'app-info-box', + templateUrl: './info-box.component.html', + styleUrls: ['./info-box.component.css'] +}) +export class InfoBoxComponent implements OnInit { + + @Input() title = ''; + @Input() data: any; + + constructor() { } + + ngOnInit() { + } + +} diff --git a/src/app/tsp-info/info-page/info-page.component.css b/src/app/tsp-info/info-page/info-page.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/tsp-info/info-page/info-page.component.html b/src/app/tsp-info/info-page/info-page.component.html new file mode 100644 index 0000000..f56b2eb --- /dev/null +++ b/src/app/tsp-info/info-page/info-page.component.html @@ -0,0 +1,17 @@ +

+ + + + + +

diff --git a/src/app/tsp-info/info-page/info-page.component.spec.ts b/src/app/tsp-info/info-page/info-page.component.spec.ts new file mode 100644 index 0000000..52ce52c --- /dev/null +++ b/src/app/tsp-info/info-page/info-page.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { InfoPageComponent } from './info-page.component'; + +describe('InfoPageComponent', () => { + let component: InfoPageComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ InfoPageComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(InfoPageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should be created', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/tsp-info/info-page/info-page.component.ts b/src/app/tsp-info/info-page/info-page.component.ts new file mode 100644 index 0000000..7159838 --- /dev/null +++ b/src/app/tsp-info/info-page/info-page.component.ts @@ -0,0 +1,34 @@ +import {Component, OnInit} from '@angular/core'; +import {ActivatedRoute} from "@angular/router"; +import {Title} from "@angular/platform-browser"; + +import { + TspInfo, + TspInfoService, +} from "../shared"; + +@Component({ + selector: 'app-info-page', + templateUrl: './info-page.component.html', + styleUrls: ['./info-page.component.css'] +}) +export class InfoPageComponent implements OnInit { + + constructor(private titleService: Title, + private route: ActivatedRoute, + private tspInfoService: TspInfoService) { + } + + ngOnInit() { + this.titleService.setTitle('TaurusXFT : TSP INFO'); + this.route.data.subscribe((data: { tspInfo: TspInfo }) => this.tspInfo = data.tspInfo); + } + + get tspInfo(): TspInfo { + return this.tspInfoService.tspInfo; + } + + set tspInfo(tspInfo: TspInfo) { + this.tspInfoService.tspInfo = tspInfo; + } +} diff --git a/src/app/tsp-info/pra-goals/pra-goals.component.css b/src/app/tsp-info/pra-goals/pra-goals.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/tsp-info/pra-goals/pra-goals.component.html b/src/app/tsp-info/pra-goals/pra-goals.component.html new file mode 100644 index 0000000..43f5f2b --- /dev/null +++ b/src/app/tsp-info/pra-goals/pra-goals.component.html @@ -0,0 +1,24 @@ +

{{title}}

+

+ CORE + SIG + TADE +

+

+ {{data.core.A}} + {{data.sig.A}} + {{data.tade.A}} +

+

{{sumA}}

+

+ {{data.core.B}} + {{data.sig.B}} + {{data.tade.B}} +

+

{{sumB}}

+

+ {{data.core.C}} + {{data.sig.C}} + {{data.tade.C}} +

+

{{sumC}}

diff --git a/src/app/tsp-info/pra-goals/pra-goals.component.spec.ts b/src/app/tsp-info/pra-goals/pra-goals.component.spec.ts new file mode 100644 index 0000000..5e47721 --- /dev/null +++ b/src/app/tsp-info/pra-goals/pra-goals.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PraGoalsComponent } from './pra-goals.component'; + +describe('PraGoalsComponent', () => { + let component: PraGoalsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ PraGoalsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PraGoalsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should be created', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/tsp-info/pra-goals/pra-goals.component.ts b/src/app/tsp-info/pra-goals/pra-goals.component.ts new file mode 100644 index 0000000..681678c --- /dev/null +++ b/src/app/tsp-info/pra-goals/pra-goals.component.ts @@ -0,0 +1,43 @@ +import {Component, Input, OnInit} from '@angular/core'; +import {InfoBoxComponent} from "../info-box/info-box.component"; +import {PrioValues} from "../shared/prio-values.model"; + +@Component({ + selector: 'app-pra-goals', + templateUrl: './pra-goals.component.html', + styleUrls: [ + '../info-box/info-box.component.css', + './pra-goals.component.css' + ] +}) +export class PraGoalsComponent extends InfoBoxComponent implements OnInit { + + @Input() data: { + core: PrioValues, + sig: PrioValues, + tade: PrioValues + }; + + constructor() { + super(); + } + + ngOnInit() { + } + + get sumA(): number { + return this.sum('A'); + } + + get sumB(): number { + return this.sum('B'); + } + + get sumC(): number { + return this.sum('C'); + } + + public sum(prio: string) { + return ['core', 'sig', 'tade'].reduce((sum,unit) => sum + this.data[unit][prio], 0); + } +} diff --git a/src/app/tsp-info/shared/anim-gif.model.ts b/src/app/tsp-info/shared/anim-gif.model.ts new file mode 100644 index 0000000..0ef3ee8 --- /dev/null +++ b/src/app/tsp-info/shared/anim-gif.model.ts @@ -0,0 +1,4 @@ +export class AnimGif { + public url: string; + public label: string; +} diff --git a/src/app/tsp-info/shared/expedite-info.model.ts b/src/app/tsp-info/shared/expedite-info.model.ts new file mode 100644 index 0000000..fd98a49 --- /dev/null +++ b/src/app/tsp-info/shared/expedite-info.model.ts @@ -0,0 +1,4 @@ +export class ExpediteInfo { + public unassigned: number; + public all: number; +} diff --git a/src/app/tsp-info/shared/index.ts b/src/app/tsp-info/shared/index.ts new file mode 100644 index 0000000..448105c --- /dev/null +++ b/src/app/tsp-info/shared/index.ts @@ -0,0 +1,9 @@ +export * from './anim-gif.model'; +export * from './expedite-info.model'; +export * from './lab-temperature.model'; +export * from './tr-flow-error.model'; +export * from './prio-values.model'; +export * from './tr-progress.model'; +export * from './tsp-info.model'; + +export * from './tsp-info.service'; diff --git a/src/app/tsp-info/shared/lab-temperature.model.ts b/src/app/tsp-info/shared/lab-temperature.model.ts new file mode 100644 index 0000000..f591cf0 --- /dev/null +++ b/src/app/tsp-info/shared/lab-temperature.model.ts @@ -0,0 +1,2 @@ +export class LabTemperature { +} diff --git a/src/app/tsp-info/shared/prio-values.model.ts b/src/app/tsp-info/shared/prio-values.model.ts new file mode 100644 index 0000000..ee66f3d --- /dev/null +++ b/src/app/tsp-info/shared/prio-values.model.ts @@ -0,0 +1,5 @@ +export class PrioValues { + public A: number = 0; + public B: number = 0; + public C: number = 0; +} diff --git a/src/app/tsp-info/shared/tr-flow-error.model.ts b/src/app/tsp-info/shared/tr-flow-error.model.ts new file mode 100644 index 0000000..f84d0fe --- /dev/null +++ b/src/app/tsp-info/shared/tr-flow-error.model.ts @@ -0,0 +1,4 @@ +export class TrFlowError { + public label: string = ''; + public value: number = 0; +} diff --git a/src/app/tsp-info/shared/tr-progress.model.ts b/src/app/tsp-info/shared/tr-progress.model.ts new file mode 100644 index 0000000..a68f587 --- /dev/null +++ b/src/app/tsp-info/shared/tr-progress.model.ts @@ -0,0 +1,6 @@ +export class TrProgress { + public eriref: string = ''; + public heading: string = ''; + public prio: string = ''; + public lastProgressInDays: number = 0; +} diff --git a/src/app/tsp-info/shared/tsp-info.model.ts b/src/app/tsp-info/shared/tsp-info.model.ts new file mode 100644 index 0000000..35c2cbc --- /dev/null +++ b/src/app/tsp-info/shared/tsp-info.model.ts @@ -0,0 +1,31 @@ +import { + AnimGif, + ExpediteInfo, + LabTemperature, + PrioValues, + TrProgress, + TrFlowError +} from "."; + + +export class TspInfo { + public cameraMovieUrls: Array = []; + public animGifs: Array = []; + public praGoals: { + core: PrioValues, + sig: PrioValues, + tade: PrioValues + }; + public trProgressInfo: Array = []; + public trFlowErrors: Array = []; + public expedites: ExpediteInfo = { + unassigned: 0, + all: 0 + }; + public isVacationSoon: boolean = false; + public labTemperature: LabTemperature = { + back_right: 0, + back_middle: 0, + back_left: 0 + }; +} diff --git a/src/app/tsp-info/shared/tsp-info.service.spec.ts b/src/app/tsp-info/shared/tsp-info.service.spec.ts new file mode 100644 index 0000000..79a32bb --- /dev/null +++ b/src/app/tsp-info/shared/tsp-info.service.spec.ts @@ -0,0 +1,15 @@ +import { TestBed, inject } from '@angular/core/testing'; + +import { TspInfoService } from './tsp-info.service'; + +describe('TspInfoService', () => { + beforeEach(() => { + TestBed.configureTestingModule({ + providers: [TspInfoService] + }); + }); + + it('should be created', inject([TspInfoService], (service: TspInfoService) => { + expect(service).toBeTruthy(); + })); +}); diff --git a/src/app/tsp-info/shared/tsp-info.service.ts b/src/app/tsp-info/shared/tsp-info.service.ts new file mode 100644 index 0000000..ab2505f --- /dev/null +++ b/src/app/tsp-info/shared/tsp-info.service.ts @@ -0,0 +1,54 @@ +import {Injectable} from '@angular/core'; +import {Http, Headers} from "@angular/http"; +import 'rxjs/Rx'; +import {Router, Resolve, ActivatedRouteSnapshot} from '@angular/router'; +import {Observable} from 'rxjs/Observable'; + +import {environment} from '../../../environments/environment'; +import { + TspInfo +} from '.'; + +@Injectable() +export class TspInfoService { + private url = environment.apiUri + '/api/tsp-info'; + + private cachedTspInfo: TspInfo = new TspInfo(); + + constructor(private httpService: Http) {} + + /** + * Returns an observable instance to the kanban board api + * + * @returns {Observable} + */ + public getList(): Observable { + return this.httpService.get(this.url).map(res => res.json()); + } + + /** + * Route preload resolver + * + * @param {ActivatedRouteSnapshot} route + * @returns {Promise} + */ + public resolve(route: ActivatedRouteSnapshot): Promise { + return this.getList().toPromise().then(result => result ? result : false); + } + + /** + * Reload the board + */ + public reload() { + this.getList().subscribe(result => this.cachedTspInfo = result); + } + + get tspInfo(): TspInfo { + return this.cachedTspInfo; + } + + set tspInfo(tspInfo: TspInfo) { + this.cachedTspInfo = tspInfo; + } + +} diff --git a/src/app/tsp-info/tr-flow-errors/tr-flow-errors.component.css b/src/app/tsp-info/tr-flow-errors/tr-flow-errors.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/tsp-info/tr-flow-errors/tr-flow-errors.component.html b/src/app/tsp-info/tr-flow-errors/tr-flow-errors.component.html new file mode 100644 index 0000000..8a37b95 --- /dev/null +++ b/src/app/tsp-info/tr-flow-errors/tr-flow-errors.component.html @@ -0,0 +1,7 @@ +

{{title}} ({{errorSum}})

+
    +
  • + {{flowError.label}} + {{flowError.value}} +
  • +
diff --git a/src/app/tsp-info/tr-flow-errors/tr-flow-errors.component.spec.ts b/src/app/tsp-info/tr-flow-errors/tr-flow-errors.component.spec.ts new file mode 100644 index 0000000..2a57b94 --- /dev/null +++ b/src/app/tsp-info/tr-flow-errors/tr-flow-errors.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TrFlowErrorsComponent } from './tr-flow-errors.component'; + +describe('TrFlowErrorsComponent', () => { + let component: TrFlowErrorsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ TrFlowErrorsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TrFlowErrorsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should be created', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/tsp-info/tr-flow-errors/tr-flow-errors.component.ts b/src/app/tsp-info/tr-flow-errors/tr-flow-errors.component.ts new file mode 100644 index 0000000..ab1212c --- /dev/null +++ b/src/app/tsp-info/tr-flow-errors/tr-flow-errors.component.ts @@ -0,0 +1,27 @@ +import {Component, Input, OnInit} from '@angular/core'; +import {InfoBoxComponent} from "../info-box/info-box.component"; +import {TrFlowError} from "../shared/tr-flow-error.model"; + +@Component({ + selector: 'app-tr-flow-errors', + templateUrl: './tr-flow-errors.component.html', + styleUrls: [ + '../info-box/info-box.component.css', + './tr-flow-errors.component.css' + ] +}) +export class TrFlowErrorsComponent extends InfoBoxComponent implements OnInit { + + @Input() data: Array = []; + + constructor() { + super(); + } + + ngOnInit() { + } + + get errorSum(): number { + return this.data.reduce((sum: number, flowError: TrFlowError) => sum + flowError.value, 0); + } +} diff --git a/src/app/tsp-info/tr-progress/tr-progress.component.css b/src/app/tsp-info/tr-progress/tr-progress.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/tsp-info/tr-progress/tr-progress.component.html b/src/app/tsp-info/tr-progress/tr-progress.component.html new file mode 100644 index 0000000..28beb66 --- /dev/null +++ b/src/app/tsp-info/tr-progress/tr-progress.component.html @@ -0,0 +1,7 @@ +

THE MOST OVERDUE PROGRESS INFOS (DAYS)

+
    +
  • + {{progress.eriref}} {{progress.heading}} + {{progress.lastProgressInDays}} +
  • +
diff --git a/src/app/tsp-info/tr-progress/tr-progress.component.spec.ts b/src/app/tsp-info/tr-progress/tr-progress.component.spec.ts new file mode 100644 index 0000000..562c9f3 --- /dev/null +++ b/src/app/tsp-info/tr-progress/tr-progress.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TrProgressComponent } from './tr-progress.component'; + +describe('TrProgressComponent', () => { + let component: TrProgressComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ TrProgressComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TrProgressComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should be created', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/tsp-info/tr-progress/tr-progress.component.ts b/src/app/tsp-info/tr-progress/tr-progress.component.ts new file mode 100644 index 0000000..5b412f2 --- /dev/null +++ b/src/app/tsp-info/tr-progress/tr-progress.component.ts @@ -0,0 +1,24 @@ +import {Component, Input, OnInit} from '@angular/core'; +import {InfoBoxComponent} from "../info-box/info-box.component"; +import {TrProgress} from "../shared/tr-progress.model"; + +@Component({ + selector: 'app-tr-progress', + templateUrl: './tr-progress.component.html', + styleUrls: [ + '../info-box/info-box.component.css', + './tr-progress.component.css' + ] +}) +export class TrProgressComponent extends InfoBoxComponent implements OnInit { + + @Input() data: Array = []; + + constructor() { + super(); + } + + ngOnInit() { + } + +} diff --git a/src/app/tsp-info/tsp-info-routing.module.ts b/src/app/tsp-info/tsp-info-routing.module.ts new file mode 100644 index 0000000..8845967 --- /dev/null +++ b/src/app/tsp-info/tsp-info-routing.module.ts @@ -0,0 +1,21 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import { InfoPageComponent } from "./info-page/info-page.component"; +import { TspInfoService } from "./shared/tsp-info.service"; + +const routes: Routes = [ + { + path: 'tsp-info-page', + children: [], + component: InfoPageComponent, + resolve: { + tspInfo: TspInfoService, + }, + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class TspInfoRoutingModule { } diff --git a/src/app/tsp-info/tsp-info.module.ts b/src/app/tsp-info/tsp-info.module.ts new file mode 100644 index 0000000..70e86c8 --- /dev/null +++ b/src/app/tsp-info/tsp-info.module.ts @@ -0,0 +1,32 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { TspInfoRoutingModule } from './tsp-info-routing.module'; +import { InfoBoxComponent } from './info-box/info-box.component'; +import { TrProgressComponent } from './tr-progress/tr-progress.component'; +import { ExpeditesComponent } from './expedites/expedites.component'; +import { TrFlowErrorsComponent } from './tr-flow-errors/tr-flow-errors.component'; +import { PraGoalsComponent } from './pra-goals/pra-goals.component'; +import { InfoPageComponent } from './info-page/info-page.component'; +import { AnimgifComponent } from './animgif/animgif.component'; +import { TspInfoService } from './shared/tsp-info.service'; +import { HttpModule } from "@angular/http"; + +@NgModule({ + imports: [ + CommonModule, + HttpModule, + TspInfoRoutingModule + ], + declarations: [ + InfoBoxComponent, + TrProgressComponent, + ExpeditesComponent, + TrFlowErrorsComponent, + PraGoalsComponent, + InfoPageComponent, + AnimgifComponent + ], + providers: [TspInfoService] +}) +export class TspInfoModule { }