* funService created to share animgifs and cameraurl between the two modules
* funService is provider for both modules * animgifs are still TBD, camera is visible in kanbanview between 11:30-12:30
This commit is contained in:
parent
d37a6f68c6
commit
6494c5c75c
@ -5,6 +5,7 @@ import { AppRoutingModule } from './app-routing.module';
|
|||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { KanbanModule } from './kanban/kanban.module';
|
import { KanbanModule } from './kanban/kanban.module';
|
||||||
import { TspInfoModule } from "./tsp-info/tsp-info.module";
|
import { TspInfoModule } from "./tsp-info/tsp-info.module";
|
||||||
|
import { FunService } from "./shared/fun.service";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
@ -16,7 +17,9 @@ import { TspInfoModule } from "./tsp-info/tsp-info.module";
|
|||||||
KanbanModule,
|
KanbanModule,
|
||||||
TspInfoModule,
|
TspInfoModule,
|
||||||
],
|
],
|
||||||
providers: [],
|
providers: [
|
||||||
|
FunService,
|
||||||
|
],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
})
|
})
|
||||||
export class AppModule { }
|
export class AppModule { }
|
||||||
|
|||||||
@ -14,5 +14,10 @@
|
|||||||
<div app-kanban-entry-item class="four wide column"
|
<div app-kanban-entry-item class="four wide column"
|
||||||
rowHeading="DÖNER"
|
rowHeading="DÖNER"
|
||||||
[kanbanEntries]="kanbanBoard.done"></div>
|
[kanbanEntries]="kanbanBoard.done"></div>
|
||||||
|
<app-animgif *ngIf="showSomeFun"
|
||||||
|
class="kanban-view"
|
||||||
|
title="ANIMATED IMPORTANCE"
|
||||||
|
[data]="fun.animGifs"
|
||||||
|
[cameraUrls]="fun.cameraUrls"></app-animgif>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import {Component, HostBinding, HostDecorator, HostListener, OnInit} from '@angular/core';
|
import {Component, HostBinding, HostListener, OnDestroy, OnInit} from '@angular/core';
|
||||||
import {Title} from '@angular/platform-browser';
|
import {Title} from '@angular/platform-browser';
|
||||||
import {ActivatedRoute} from '@angular/router';
|
import {ActivatedRoute} from '@angular/router';
|
||||||
|
|
||||||
@ -7,6 +7,12 @@ import {
|
|||||||
KanbanService,
|
KanbanService,
|
||||||
KanbanEntry,
|
KanbanEntry,
|
||||||
} from "../shared";
|
} from "../shared";
|
||||||
|
import {
|
||||||
|
Fun,
|
||||||
|
FunService,
|
||||||
|
} from "../../shared";
|
||||||
|
import {Subscription} from "rxjs/Subscription";
|
||||||
|
import {TimerObservable} from "rxjs/observable/TimerObservable";
|
||||||
|
|
||||||
const WIP_LIMIT_INPROGRESS = 12;
|
const WIP_LIMIT_INPROGRESS = 12;
|
||||||
const WIP_LIMIT_VERIFICATION = 8;
|
const WIP_LIMIT_VERIFICATION = 8;
|
||||||
@ -14,18 +20,24 @@ const WIP_LIMIT_VERIFICATION = 8;
|
|||||||
const STYLE_HIDDEN = 'hidden';
|
const STYLE_HIDDEN = 'hidden';
|
||||||
const STYLE_VISIBLE = 'scroll';
|
const STYLE_VISIBLE = 'scroll';
|
||||||
|
|
||||||
|
const FUN_TIMER = 3000;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-kanban-board',
|
selector: 'app-kanban-board',
|
||||||
templateUrl: './kanban-board.component.html',
|
templateUrl: './kanban-board.component.html',
|
||||||
styleUrls: ['./kanban-board.component.css']
|
styleUrls: ['./kanban-board.component.css']
|
||||||
})
|
})
|
||||||
export class KanbanBoardComponent implements OnInit {
|
export class KanbanBoardComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
|
private funTimer: Subscription;
|
||||||
|
|
||||||
@HostBinding('style.overflow') hostOverflow = STYLE_HIDDEN;
|
@HostBinding('style.overflow') hostOverflow = STYLE_HIDDEN;
|
||||||
|
public showSomeFun: boolean = true;
|
||||||
|
|
||||||
constructor(private titleService: Title,
|
constructor(private titleService: Title,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private kanbanService: KanbanService) {
|
private kanbanService: KanbanService,
|
||||||
|
private funService: FunService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,7 +45,27 @@ export class KanbanBoardComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.titleService.setTitle('TaurusXFT : Kanban board');
|
this.titleService.setTitle('TaurusXFT : Kanban board');
|
||||||
this.route.data.subscribe((data: { kanbanBoard: KanbanBoard }) => this.kanbanBoard = data.kanbanBoard);
|
this.route.data.subscribe((data: {
|
||||||
|
kanbanBoard: KanbanBoard,
|
||||||
|
fun: Fun,
|
||||||
|
}) => {
|
||||||
|
this.kanbanBoard = data.kanbanBoard;
|
||||||
|
this.fun = data.fun;
|
||||||
|
});
|
||||||
|
|
||||||
|
let timer0 = TimerObservable.create(FUN_TIMER, FUN_TIMER);
|
||||||
|
this.funTimer = timer0.subscribe(() => {
|
||||||
|
let now = new Date();
|
||||||
|
if((now.getHours() == 10 && now.getMinutes() > 28) || (now.getHours() == 11 && now.getMinutes() < 30)) {
|
||||||
|
this.showSomeFun = true;
|
||||||
|
} else {
|
||||||
|
this.showSomeFun = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
this.funTimer.unsubscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
get kanbanBoard(): KanbanBoard {
|
get kanbanBoard(): KanbanBoard {
|
||||||
@ -44,6 +76,13 @@ export class KanbanBoardComponent implements OnInit {
|
|||||||
this.kanbanService.kanbanBoard = kanbanBoard;
|
this.kanbanService.kanbanBoard = kanbanBoard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get fun(): Fun {
|
||||||
|
return this.funService.fun;
|
||||||
|
}
|
||||||
|
|
||||||
|
set fun(fun: Fun) {
|
||||||
|
this.funService.fun = fun;
|
||||||
|
}
|
||||||
get inprogressWipLimit(): number {
|
get inprogressWipLimit(): number {
|
||||||
return WIP_LIMIT_INPROGRESS;
|
return WIP_LIMIT_INPROGRESS;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import {NgModule} from '@angular/core';
|
|||||||
import {Routes, RouterModule} from '@angular/router';
|
import {Routes, RouterModule} from '@angular/router';
|
||||||
import {KanbanBoardComponent} from "./kanban-board/kanban-board.component";
|
import {KanbanBoardComponent} from "./kanban-board/kanban-board.component";
|
||||||
import {KanbanService} from "./shared/kanban.service";
|
import {KanbanService} from "./shared/kanban.service";
|
||||||
|
import {FunService} from "../shared/fun.service";
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{
|
{
|
||||||
@ -10,6 +11,7 @@ const routes: Routes = [
|
|||||||
component: KanbanBoardComponent,
|
component: KanbanBoardComponent,
|
||||||
resolve: {
|
resolve: {
|
||||||
kanbanBoard: KanbanService,
|
kanbanBoard: KanbanService,
|
||||||
|
fun: FunService,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@ -11,12 +11,14 @@ import { ShortenTextPipe } from './shared/shorten-text.pipe';
|
|||||||
import { SelfUpdaterService } from './shared/self-updater.service';
|
import { SelfUpdaterService } from './shared/self-updater.service';
|
||||||
import { BlockedDaysPipe } from './shared/blocked-days.pipe';
|
import { BlockedDaysPipe } from './shared/blocked-days.pipe';
|
||||||
import {KanbanRoutingModule} from "./kanban-routing.module";
|
import {KanbanRoutingModule} from "./kanban-routing.module";
|
||||||
|
import {TspInfoModule} from "../tsp-info/tsp-info.module";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
HttpModule,
|
HttpModule,
|
||||||
KanbanRoutingModule
|
KanbanRoutingModule,
|
||||||
|
TspInfoModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
KanbanBoardComponent,
|
KanbanBoardComponent,
|
||||||
|
|||||||
6
src/app/shared/fun.model.ts
Normal file
6
src/app/shared/fun.model.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import {AnimGif} from "./anim-gif.model";
|
||||||
|
|
||||||
|
export class Fun {
|
||||||
|
public cameraUrls: Array<string> = [];
|
||||||
|
public animGifs: Array<AnimGif> = [];
|
||||||
|
}
|
||||||
15
src/app/shared/fun.service.spec.ts
Normal file
15
src/app/shared/fun.service.spec.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
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();
|
||||||
|
}));
|
||||||
|
});
|
||||||
53
src/app/shared/fun.service.ts
Normal file
53
src/app/shared/fun.service.ts
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
4
src/app/shared/index.ts
Normal file
4
src/app/shared/index.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export * from './anim-gif.model';
|
||||||
|
export * from './fun.model';
|
||||||
|
|
||||||
|
export * from './fun.service';
|
||||||
@ -1,3 +1,13 @@
|
|||||||
|
: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 {
|
.widget.camera {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import {Component, Input, OnDestroy, OnInit} from '@angular/core';
|
import {Component, Input, OnDestroy, OnInit} from '@angular/core';
|
||||||
import {InfoBoxComponent} from "../info-box/info-box.component";
|
import {InfoBoxComponent} from "../info-box/info-box.component";
|
||||||
import {AnimGif} from "../shared/anim-gif.model";
|
import {AnimGif} from "../../shared/anim-gif.model";
|
||||||
|
|
||||||
// import gifyParse from "gify-parse/gify-parse";
|
// import gifyParse from "gify-parse/gify-parse";
|
||||||
|
|
||||||
|
|||||||
@ -17,6 +17,6 @@
|
|||||||
<app-animgif
|
<app-animgif
|
||||||
class="col3 row2"
|
class="col3 row2"
|
||||||
title="ANIMATED IMPORTANCE"
|
title="ANIMATED IMPORTANCE"
|
||||||
[data]="tspInfo.animGifs"
|
[data]="fun.animGifs"
|
||||||
[cameraUrls]="tspInfo.cameraUrls"></app-animgif>
|
[cameraUrls]="fun.cameraUrls"></app-animgif>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@ -6,6 +6,8 @@ import {
|
|||||||
TspInfo,
|
TspInfo,
|
||||||
TspInfoService,
|
TspInfoService,
|
||||||
} from "../shared";
|
} from "../shared";
|
||||||
|
import {FunService} from "../../shared/fun.service";
|
||||||
|
import {Fun} from "../../shared/fun.model";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-info-page',
|
selector: 'app-info-page',
|
||||||
@ -16,12 +18,19 @@ export class InfoPageComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(private titleService: Title,
|
constructor(private titleService: Title,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private tspInfoService: TspInfoService) {
|
private tspInfoService: TspInfoService,
|
||||||
|
private funService: FunService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.titleService.setTitle('TaurusXFT : TSP INFO');
|
this.titleService.setTitle('TaurusXFT : TSP INFO');
|
||||||
this.route.data.subscribe((data: { tspInfo: TspInfo }) => this.tspInfo = data.tspInfo);
|
this.route.data.subscribe((data: {
|
||||||
|
tspInfo: TspInfo,
|
||||||
|
fun: Fun
|
||||||
|
}) => {
|
||||||
|
this.tspInfo = data.tspInfo;
|
||||||
|
this.fun = data.fun;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get tspInfo(): TspInfo {
|
get tspInfo(): TspInfo {
|
||||||
@ -31,4 +40,12 @@ export class InfoPageComponent implements OnInit {
|
|||||||
set tspInfo(tspInfo: TspInfo) {
|
set tspInfo(tspInfo: TspInfo) {
|
||||||
this.tspInfoService.tspInfo = tspInfo;
|
this.tspInfoService.tspInfo = tspInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get fun(): Fun {
|
||||||
|
return this.funService.fun;
|
||||||
|
}
|
||||||
|
|
||||||
|
set fun(fun: Fun) {
|
||||||
|
this.funService.fun = fun;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
export * from './anim-gif.model';
|
|
||||||
export * from './expedite-info.model';
|
export * from './expedite-info.model';
|
||||||
export * from './lab-temperature.model';
|
export * from './lab-temperature.model';
|
||||||
export * from './tr-flow-error.model';
|
export * from './tr-flow-error.model';
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import {
|
import {
|
||||||
AnimGif,
|
|
||||||
ExpediteInfo,
|
ExpediteInfo,
|
||||||
LabTemperature,
|
LabTemperature,
|
||||||
PrioValues,
|
PrioValues,
|
||||||
@ -9,8 +8,6 @@ import {
|
|||||||
|
|
||||||
|
|
||||||
export class TspInfo {
|
export class TspInfo {
|
||||||
public cameraUrls: Array<string> = [];
|
|
||||||
public animGifs: Array<AnimGif> = [];
|
|
||||||
public praGoals: {
|
public praGoals: {
|
||||||
core: PrioValues,
|
core: PrioValues,
|
||||||
sig: PrioValues,
|
sig: PrioValues,
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import {NgModule} from '@angular/core';
|
|||||||
import {Routes, RouterModule} from '@angular/router';
|
import {Routes, RouterModule} from '@angular/router';
|
||||||
import {InfoPageComponent} from "./info-page/info-page.component";
|
import {InfoPageComponent} from "./info-page/info-page.component";
|
||||||
import {TspInfoService} from "./shared/tsp-info.service";
|
import {TspInfoService} from "./shared/tsp-info.service";
|
||||||
|
import {FunService} from "../shared/fun.service";
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{
|
{
|
||||||
@ -10,6 +11,7 @@ const routes: Routes = [
|
|||||||
component: InfoPageComponent,
|
component: InfoPageComponent,
|
||||||
resolve: {
|
resolve: {
|
||||||
tspInfo: TspInfoService,
|
tspInfo: TspInfoService,
|
||||||
|
fun: FunService,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@ -18,6 +18,9 @@ import {HttpModule} from "@angular/http";
|
|||||||
HttpModule,
|
HttpModule,
|
||||||
TspInfoRoutingModule
|
TspInfoRoutingModule
|
||||||
],
|
],
|
||||||
|
exports:[
|
||||||
|
AnimgifComponent,
|
||||||
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
InfoBoxComponent,
|
InfoBoxComponent,
|
||||||
TrProgressComponent,
|
TrProgressComponent,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user