* code cleanup

This commit is contained in:
Dávid Danyi 2018-08-06 18:02:24 +02:00
parent 5f2639061b
commit e346f84eeb
52 changed files with 23 additions and 1098 deletions

View File

@ -4,7 +4,7 @@ import {Routes, RouterModule} from '@angular/router';
const routes: Routes = [
{
path: '',
redirectTo: '/tspinfopage',
redirectTo: '/kanban-fixed',
pathMatch: 'full',
}
];

View File

@ -2,26 +2,11 @@ import {Component, OnDestroy, OnInit} from '@angular/core';
import {Subscription} from "rxjs/Subscription";
import {TimerObservable} from "rxjs/observable/TimerObservable";
import {KanbanService} from "./kanban/shared/kanban.service";
// import {ActivatedRoute, NavigationEnd, Router} from "@angular/router";
import {KanbanService} from "./kanban/shared";
import {SelfUpdaterService} from "./kanban/shared/self-updater.service";
// import {TspInfoService} from "./tsp-info/shared/tsp-info.service";
const TIMER_DEPLOY_REFRESH = 30000;
const TIMER_JIRA_REFRESH = 60000;
// const TIMER_TSPINFO_REFRESH = 60000;
// const TIMER_PAGE_SWITCH_TICK = 1000;
/**
* Page switch timer in seconds
* @type {number}
*/
// const TIMESPENT_KANBAN = 120000;
// const TIMESPENT_TSPINFO = 30000;
// const PAGE_KANBAN = '/kanban';
// const PAGE_TSPINFO = '/tspinfopage';
@Component({
selector: 'app-root',
@ -29,20 +14,12 @@ const TIMER_JIRA_REFRESH = 60000;
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit, OnDestroy {
// private currentPage: string = PAGE_KANBAN;
// private lastNavOccured: number = Date.now();
// private autoSwitchEnabled: boolean = true;
private selfUpdateCheckerTimer: Subscription;
private reloadKanbanTimer: Subscription;
// private reloadTspInfoTimer: Subscription;
// private pageSwitchTimer: Subscription;
constructor(private selfUpdaterService: SelfUpdaterService,
private kanbanService: KanbanService,
// private tspInfoService: TspInfoService,
// private router: Router,
// private activatedRoute: ActivatedRoute
) {}
/**
@ -60,81 +37,10 @@ export class AppComponent implements OnInit, OnDestroy {
this.reloadKanbanTimer = timer1.subscribe(() => {
this.kanbanService.reload();
});
// let timer2 = TimerObservable.create(TIMER_TSPINFO_REFRESH, TIMER_TSPINFO_REFRESH);
// this.reloadTspInfoTimer = timer2.subscribe(() => {
// this.tspInfoService.reload();
// });
// this.router.events
// .filter(e => e instanceof NavigationEnd)
// .map(() => {
// let route = this.activatedRoute;
// while (route.firstChild) {
// route = route.firstChild;
// }
// return route;
// })
// .filter((route) => route.outlet === 'primary')
// .mergeMap((route) => route.data)
// .subscribe(data => {
// if (!data['disableAutoSwitch']) {
// let timer4 = TimerObservable.create(TIMER_PAGE_SWITCH_TICK, TIMER_PAGE_SWITCH_TICK);
// this.pageSwitchTimer = timer4.subscribe(this.switchSubscriber.bind(this));
// }
// });
}
public ngOnDestroy() {
this.selfUpdateCheckerTimer.unsubscribe();
this.reloadKanbanTimer.unsubscribe();
// this.reloadTspInfoTimer.unsubscribe();
// if (this.pageSwitchTimer) {
// this.pageSwitchTimer.unsubscribe();
// }
}
// private switchSubscriber() {
// let now = new Date();
// let weekDay = now.getDay();
// // on weekdays
// if (weekDay > 0 && weekDay < 6) {
// if (now.getHours() == 10) {
// if (this.autoSwitchEnabled && now.getMinutes() > 14) {
// this.navigateToPage(PAGE_KANBAN);
// this.autoSwitchEnabled = false;
// }
// if (!this.autoSwitchEnabled && now.getMinutes() > 30) {
// this.autoSwitchEnabled = true;
// }
// }
// }
// if (this.autoSwitchEnabled) {
// let compareTimer: number = 0;
// let switchTo: string = '';
// switch (this.currentPage) {
// case PAGE_KANBAN:
// compareTimer = TIMESPENT_KANBAN;
// switchTo = PAGE_TSPINFO;
// break;
// case PAGE_TSPINFO:
// compareTimer = TIMESPENT_TSPINFO;
// switchTo = PAGE_KANBAN;
// break;
// default:
// console.error("Unknown page in pageSwitcherTimer");
// return false;
// }
// if ((Date.now() - this.lastNavOccured) > compareTimer) {
// this.navigateToPage(switchTo);
// }
// }
// }
//
// private navigateToPage(page: string) {
// if (page != this.currentPage) {
// this.router.navigate([page]);
// this.currentPage = page;
// this.lastNavOccured = Date.now();
// }
// }
}

View File

@ -4,8 +4,6 @@ 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";
import { FunService } from "./shared/fun.service";
@NgModule({
declarations: [
@ -15,10 +13,6 @@ import { FunService } from "./shared/fun.service";
BrowserModule,
AppRoutingModule,
KanbanModule,
TspInfoModule,
],
providers: [
FunService,
],
bootstrap: [AppComponent]
})

View File

@ -10,6 +10,8 @@
[ngClass]="entryClass(kanbanEntry)">
<div class="content">
<div class="task-description">
<span *ngIf="kanbanEntry.epicName"
class="ui mini olive right floated label">{{kanbanEntry.epicName}}</span>
<ng-template [ngIf]="hasLabels(kanbanEntry)">
<span *ngFor="let label of kanbanEntry.labels"
class="ui mini {{labelClass(label)}} right floated label">{{label|uppercase|blockedDays:kanbanEntry.daysBlocked}}</span>

View File

@ -2,10 +2,10 @@ import {Component, Input} from '@angular/core';
import { environment } from "../../../environments/environment";
import { KanbanEntry } from "../shared";
import { JiraAssignee } from "../shared/jira-assignee.model";
import { JiraAssignee } from "../shared";
const DEFAULT_AVATAR = '/assets/riddler.png';
const JIRA_BOARD_BASE_HREF = 'https://jirapducc.mo.ca.am.ericsson.se/browse/';
const JIRA_BOARD_BASE_HREF = 'https://cc-jira.rnd.ki.sw.ericsson.se/browse/';
const labelColors = {
TSP: 'teal',

View File

@ -4,14 +4,13 @@ import { HttpModule } from "@angular/http";
import { KanbanBoardComponent } from './kanban-board/kanban-board.component';
import { KanbanService } from './shared/kanban.service';
import { KanbanService } from './shared';
import { KanbanEntryItemComponent } from './kanban-entry-item/kanban-entry-item.component';
import { PriorityColorPipe } from './shared/priority-color.pipe';
import { ShortenTextPipe } from './shared/shorten-text.pipe';
import { SelfUpdaterService } from './shared/self-updater.service';
import { BlockedDaysPipe } from './shared/blocked-days.pipe';
import { KanbanRoutingModule } from "./kanban-routing.module";
import { TspInfoModule } from "../tsp-info/tsp-info.module";
import { PrefixJiraIdPipe } from './shared/prefix-jira-id.pipe';
@NgModule({
@ -19,7 +18,6 @@ import { PrefixJiraIdPipe } from './shared/prefix-jira-id.pipe';
CommonModule,
HttpModule,
KanbanRoutingModule,
TspInfoModule
],
declarations: [
KanbanBoardComponent,

View File

@ -7,22 +7,23 @@ export class KanbanEntry {
public key: string;
public summary: string;
public issueType: JiraIssueType;
public epicName: string;
public status: JiraStatus;
public assignee: JiraAssignee;
public additionalAssignees: Array<JiraAssignee> = [];
public issuePriority: string;
public issuePriorityIcon: string;
public labels: Array<string>;
public prio: number;
public functionalAreas: Array<string>;
public externalId: string;
public externalLink: string;
public project: string;
public mhwebStatus: string;
public mhwebHot: boolean;
public mhwebExternal: boolean;
public team: string;
public answerCode: string;
// public prio: number;
// public functionalAreas: Array<string>;
// public externalId: string;
// public externalLink: string;
// public project: string;
// public mhwebStatus: string;
// public mhwebHot: boolean;
// public mhwebExternal: boolean;
// public team: string;
// public answerCode: string;
public isLastOfPriority: boolean;
public worklog: number;
public daysBlocked: number;

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { Http, Headers } from "@angular/http";
import { Http } from "@angular/http";
import 'rxjs/Rx';
import { Router, Resolve, ActivatedRouteSnapshot } from '@angular/router';
import { ActivatedRouteSnapshot } from '@angular/router';
import { Observable } from 'rxjs/Observable';
import { environment } from '../../../environments/environment';
@ -23,7 +23,6 @@ export class KanbanService {
* @returns {Observable<KanbanBoard>}
*/
public getList(): Observable<KanbanBoard> {
// return this.httpService.get(this.url).map(res => this.preprocessPriorities(<KanbanBoard>res.json()));
return this.httpService.get(this.url).map(res => <KanbanBoard>res.json());
}
@ -51,27 +50,4 @@ export class KanbanService {
set kanbanBoard(kanbanBoard: KanbanBoard) {
this.cachedKanbanBoard = kanbanBoard;
}
/**
* Used to preprocess all the entries, mark last item of every priority type for display formatting
*
* @param {KanbanBoard} kanbanBoard
* @returns {KanbanBoard}
*/
// private preprocessPriorities(kanbanBoard: KanbanBoard): KanbanBoard {
// ['inbox','inProgress','verification'].map(progress => {
// kanbanBoard[progress].map(entry => entry.isLastOfPriority = false);
// ['Trivial',
// 'Minor',
// 'Major',
// 'Critical',
// 'Blocker'].map(prio => {
// let prioLastIndex = kanbanBoard[progress].reduce((accumulator, value, idx) => value.issuePriority==prio ? idx : accumulator, -1);
// try {
// kanbanBoard[progress][prioLastIndex].isLastOfPriority = true;
// } catch(e) {}
// });
// });
// return kanbanBoard;
// }
}

View File

@ -1,4 +0,0 @@
export class AnimGif {
public url: string;
public label: string;
}

View File

@ -1,6 +0,0 @@
import {AnimGif} from "./anim-gif.model";
export class Fun {
public cameraUrls: Array<string> = [];
public animGifs: Array<AnimGif> = [];
}

View File

@ -1,15 +0,0 @@
import { TestBed, inject } from '@angular/core/testing';
import { FunService } from './fun.service';
describe('FunService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [FunService]
});
});
it('should be created', inject([FunService], (service: FunService) => {
expect(service).toBeTruthy();
}));
});

View File

@ -1,53 +0,0 @@
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 {Fun} from "./fun.model";
@Injectable()
export class FunService {
private url = environment.apiUri + '/api/want-some-fun';
private cachedFun: Fun = new Fun();
constructor(private httpService: Http) {
}
/**
* Returns an observable instance to the kanban board api
*
* @returns {Observable<Fun>}
*/
public getList(): Observable<Fun> {
return this.httpService.get(this.url).map(res => <Fun>res.json());
}
/**
* Route preload resolver
*
* @param {ActivatedRouteSnapshot} route
* @returns {Promise<Fun>}
*/
public resolve(route: ActivatedRouteSnapshot): Promise<Fun> {
return this.getList().toPromise().then(result => result ? result : false);
}
/**
* Reload the board
*/
public reload() {
this.getList().subscribe(result => this.cachedFun = result);
}
get fun(): Fun {
return this.cachedFun;
}
set fun(fun: Fun) {
this.cachedFun = fun;
}
}

View File

@ -1,4 +0,0 @@
export * from './anim-gif.model';
export * from './fun.model';
export * from './fun.service';

View File

@ -1,13 +0,0 @@
:host(.kanban-view) {
position: absolute;
z-index: 100;
bottom: 0;
right: 0;
background-color: rgba(0,41,94,0.95);
width: 480px;
height: 500px;
}
.widget.camera {
padding: 0;
}

View File

@ -1,3 +0,0 @@
<div class="widget camera">
<img *ngFor="let src of cameraUrls" [src]="src">
</div>

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AnimgifComponent } from './animgif.component';
describe('AnimgifComponent', () => {
let component: AnimgifComponent;
let fixture: ComponentFixture<AnimgifComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AnimgifComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AnimgifComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,37 +0,0 @@
import {Component, Input, OnDestroy, OnInit} from '@angular/core';
import {InfoBoxComponent} from "../info-box/info-box.component";
import {AnimGif} from "../../shared/anim-gif.model";
// import gifyParse from "gify-parse/gify-parse";
@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, OnDestroy {
@Input() data: Array<AnimGif> = [];
@Input() cameraUrls: Array<string> = [];
constructor() {
super();
// gifyParse.getInfo();
}
ngOnInit() {
// @todo subscriber
}
ngOnDestroy() {
}
get imgHref(): string {
return this.cameraUrls[1];
}
}

View File

@ -1,16 +0,0 @@
h2 {
text-transform: uppercase;
font-size: 76px;
font-weight: 700
}
h3 {
font-weight: 500;
font-size: 30px;
color: white;
}
p {
font-size: 15px;
color: rgba(255, 255, 255, 0.7);
}

View File

@ -1,7 +0,0 @@
<div class="widget {{widgetClass}}">
<h1>{{title}}</h1>
<h2>{{data.all}}</h2>
<h3>{{data.unassigned}}</h3>
<p>unassigned</p>
<i class="warning sign icon icon-background"></i>
</div>

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ExpeditesComponent } from './expedites.component';
describe('ExpeditesComponent', () => {
let component: ExpeditesComponent;
let fixture: ComponentFixture<ExpeditesComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ExpeditesComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ExpeditesComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,30 +0,0 @@
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() {}
get widgetClass(): string {
return this.data.unassigned > 0
? 'critical'
: this.data.all > 0
? 'warn'
: 'ok';
}
}

View File

@ -1,107 +0,0 @@
:host {
position: absolute;
z-index: 2;
display: table;
width: 468px;
height: 525px;
background-color: #00285F;
color: rgba(255, 255, 255, 0.7);
font-family: 'Open Sans', "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 20px;
box-shadow: 5px 5px 10px #222;
}
:host-context(.sizex2) {
width: 946px;
}
:host-context(.sizey2) {
height: 1060px;
}
:host-context(.col1) {
left: 10px;
}
:host-context(.col2) {
left: 488px;
}
:host-context(.col3) {
left: 966px;
}
:host-context(.col4) {
left: 1444px;
}
:host-context(.row1) {
top: 10px;
}
:host-context(.row2) {
top: 545px;
}
h1 {
font-family: 'EricssonCapital', "Helvetica Neue", Helvetica, Arial, sans-serif;
margin-bottom: 12px;
text-align: center;
font-size: 30px;
font-weight: bold;
padding: 0;
}
ul {
list-style: none;
margin: 0 15px;
padding: 0;
overflow: hidden;
}
ul > li {
margin: 0 0 5px;
overflow: hidden;
}
ul > li > span.label {
float: left;
}
ul > li > span.value {
float: right;
}
.widget {
width: 100%;
height: 100%;
padding: 52px 12px;
display: table-cell;
vertical-align: middle;
text-align: center;
position: relative;
}
.icon-background {
width: 100% !important;
height: 100%;
position: absolute;
left: 0;
top: 0;
opacity: 0.1;
font-size: 300px;
text-align: center;
margin-top: 255px;
}
.ok {
background-color: rgb(137, 186, 23);
}
.warn {
background-color: #E95C38;
}
.critical {
background-color: rgb(227, 33, 25);
}

View File

@ -1 +0,0 @@
<p>info-box works!</p>

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { InfoBoxComponent } from './info-box.component';
describe('InfoBoxComponent', () => {
let component: InfoBoxComponent;
let fixture: ComponentFixture<InfoBoxComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ InfoBoxComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(InfoBoxComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,21 +0,0 @@
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() {
}
get widgetClass(): string {
return '';
}
}

View File

@ -1,22 +0,0 @@
<p>
<app-tr-progress
class="sizex2 col1 row1"
title="TR INFO"
[data]="{
topData: tspInfo.trProgressInfo,
bottomData: tspInfo.trFlowErrors
}"></app-tr-progress>
<app-pra-goals
class="sizey2 col4 row1"
title="PRA TR GOALS (A,B,C PRIO)"
[data]="tspInfo.praGoals"></app-pra-goals>
<app-expedites
class="col3 row1"
title="NUMBER OF EXPEDITES (W/O PA)"
[data]="tspInfo.expedites"></app-expedites>
<app-animgif
class="col3 row2"
title="ANIMATED IMPORTANCE"
[data]="fun.animGifs"
[cameraUrls]="fun.cameraUrls"></app-animgif>
</p>

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { InfoPageComponent } from './info-page.component';
describe('InfoPageComponent', () => {
let component: InfoPageComponent;
let fixture: ComponentFixture<InfoPageComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ InfoPageComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(InfoPageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,51 +0,0 @@
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from "@angular/router";
import {Title} from "@angular/platform-browser";
import {
TspInfo,
TspInfoService,
} from "../shared";
import {FunService} from "../../shared/fun.service";
import {Fun} from "../../shared/fun.model";
@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,
private funService: FunService) {
}
ngOnInit() {
this.titleService.setTitle('TaurusXFT : TSP INFO');
this.route.data.subscribe((data: {
tspInfo: TspInfo,
fun: Fun
}) => {
this.tspInfo = data.tspInfo;
this.fun = data.fun;
});
}
get tspInfo(): TspInfo {
return this.tspInfoService.tspInfo;
}
set tspInfo(tspInfo: TspInfo) {
this.tspInfoService.tspInfo = tspInfo;
}
get fun(): Fun {
return this.funService.fun;
}
set fun(fun: Fun) {
this.funService.fun = fun;
}
}

View File

@ -1,28 +0,0 @@
p > span {
margin: 0 30px;
}
.header {
margin: 0 20px 0;
font-size: 20px;
font-weight: 200;
}
.smallnum {
font-size: 30px;
font-weight: 500;
}
.bignum {
text-transform: uppercase;
font-size: 76px;
font-weight: 700;
}
.numok {
color: rgb(137, 186, 23);
}
.numbad {
color: rgb(227, 33, 25);
}

View File

@ -1,27 +0,0 @@
<div class="widget">
<h1>{{title}}</h1>
<p class="header">
<span>CORE</span>
<span>SIG</span>
<span>TADE</span>
</p>
<p class="smallnum">
<span [class]="getClass(data.core.A)">{{data.core.A}}</span>
<span [class]="getClass(data.sig.A)">{{data.sig.A}}</span>
<span [class]="getClass(data.tade.A)">{{data.tade.A}}</span>
</p>
<h2 class="bignum {{getClass(sumA)}}">{{sumA}}</h2>
<p class="smallnum">
<span [class]="getClass(data.core.B)">{{data.core.B}}</span>
<span [class]="getClass(data.sig.B)">{{data.sig.B}}</span>
<span [class]="getClass(data.tade.B)">{{data.tade.B}}</span>
</p>
<h2 class="bignum {{getClass(sumB)}}">{{sumB}}</h2>
<p class="smallnum">
<span [class]="getClass(data.core.C)">{{data.core.C}}</span>
<span [class]="getClass(data.sig.C)">{{data.sig.C}}</span>
<span [class]="getClass(data.tade.C)">{{data.tade.C}}</span>
</p>
<h2 class="bignum {{getClass(sumC)}}">{{sumC}}</h2>
<i class="cocktail icon icon-background"></i>
</div>

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PraGoalsComponent } from './pra-goals.component';
describe('PraGoalsComponent', () => {
let component: PraGoalsComponent;
let fixture: ComponentFixture<PraGoalsComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PraGoalsComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(PraGoalsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,47 +0,0 @@
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);
}
public getClass(value: number) {
return value < 1 ? 'numok' : 'numbad';
}
}

View File

@ -1,4 +0,0 @@
export class ExpediteInfo {
public unassigned: number;
public all: number;
}

View File

@ -1,8 +0,0 @@
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';

View File

@ -1,2 +0,0 @@
export class LabTemperature {
}

View File

@ -1,5 +0,0 @@
export class PrioValues {
public A: number = 0;
public B: number = 0;
public C: number = 0;
}

View File

@ -1,4 +0,0 @@
export class TrFlowError {
public label: string = '';
public value: number = 0;
}

View File

@ -1,6 +0,0 @@
export class TrProgress {
public eriref: string = '';
public heading: string = '';
public prio: string = '';
public lastProgressInDays: number = 0;
}

View File

@ -1,28 +0,0 @@
import {
ExpediteInfo,
LabTemperature,
PrioValues,
TrProgress,
TrFlowError
} from ".";
export class TspInfo {
public praGoals: {
core: PrioValues,
sig: PrioValues,
tade: PrioValues
};
public trProgressInfo: Array<TrProgress> = [];
public trFlowErrors: Array<TrFlowError> = [];
public expedites: ExpediteInfo = {
unassigned: 0,
all: 0
};
public isVacationSoon: boolean = false;
public labTemperature: LabTemperature = {
back_right: 0,
back_middle: 0,
back_left: 0
};
}

View File

@ -1,15 +0,0 @@
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();
}));
});

View File

@ -1,54 +0,0 @@
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<TspInfo>}
*/
public getList(): Observable<TspInfo> {
return this.httpService.get(this.url).map(res => <TspInfo>res.json());
}
/**
* Route preload resolver
*
* @param {ActivatedRouteSnapshot} route
* @returns {Promise<TspInfo>}
*/
public resolve(route: ActivatedRouteSnapshot): Promise<TspInfo> {
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;
}
}

View File

@ -1,10 +0,0 @@
<div class="widget {{widgetClass}}">
<h1>{{title}} ({{errorSum}})</h1>
<ul>
<li *ngFor="let flowError of data">
<span class="label">{{flowError.label}}</span>
<span class="value">{{flowError.value}}</span>
</li>
</ul>
<i class="fire icon icon-background"></i>
</div>

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TrFlowErrorsComponent } from './tr-flow-errors.component';
describe('TrFlowErrorsComponent', () => {
let component: TrFlowErrorsComponent;
let fixture: ComponentFixture<TrFlowErrorsComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TrFlowErrorsComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TrFlowErrorsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,31 +0,0 @@
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<TrFlowError> = [];
constructor() {
super();
}
ngOnInit() {
}
get errorSum(): number {
return this.data.reduce((sum: number, flowError: TrFlowError) => sum + flowError.value, 0);
}
get widgetClass(): string {
return this.data.length ? 'warn' : 'ok';
}
}

View File

@ -1,3 +0,0 @@
.separator {
margin-top: 65px;
}

View File

@ -1,17 +0,0 @@
<div class="widget {{widgetClass}}">
<h1>THE MOST OVERDUE PROGRESS INFOS (DAYS)</h1>
<ul>
<li *ngFor="let progress of data.topData">
<span class="label">{{progress.eriref}} {{progress.heading}}</span>
<span class="value">{{progress.lastProgressInDays}}</span>
</li>
</ul>
<h1 class="separator">TR FLOW ERRORS ({{errorSum}})</h1>
<ul>
<li *ngFor="let flowError of data.bottomData">
<span class="label">{{flowError.label}}</span>
<span class="value">{{flowError.value}}</span>
</li>
</ul>
<i class="warning sign icon icon-background"></i>
</div>

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TrProgressComponent } from './tr-progress.component';
describe('TrProgressComponent', () => {
let component: TrProgressComponent;
let fixture: ComponentFixture<TrProgressComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TrProgressComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TrProgressComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,38 +0,0 @@
import {Component, Input, OnInit} from '@angular/core';
import {InfoBoxComponent} from "../info-box/info-box.component";
import {TrProgress} from "../shared/tr-progress.model";
import {TrFlowError} from "../shared/tr-flow-error.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: {
topData: Array<TrProgress>,
bottomData: Array<TrFlowError>,
};
constructor() {
super();
}
ngOnInit() {
}
get widgetClass(): string {
return [
this.data.topData,
this.data.bottomData
].every(data => data.length > 0) ? 'critical' : 'ok';
}
get errorSum(): number {
return this.data.bottomData.reduce((sum: number, flowError: TrFlowError) => sum + flowError.value, 0);
}
}

View File

@ -1,24 +0,0 @@
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";
import {FunService} from "../shared/fun.service";
const routes: Routes = [
{
path: 'tspinfopage',
children: [],
component: InfoPageComponent,
resolve: {
tspInfo: TspInfoService,
fun: FunService,
},
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class TspInfoRoutingModule {
}

View File

@ -1,36 +0,0 @@
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
],
exports:[
AnimgifComponent,
],
declarations: [
InfoBoxComponent,
TrProgressComponent,
ExpeditesComponent,
TrFlowErrorsComponent,
PraGoalsComponent,
InfoPageComponent,
AnimgifComponent
],
providers: [TspInfoService]
})
export class TspInfoModule {
}