* added watcher slide type to the slideshow

* auto reloading fixed on revision change
* added shortening pipe to the comment field in watcher view
This commit is contained in:
Dávid Danyi 2018-09-13 11:34:01 +02:00
parent 79227258e8
commit ad8f5491b5
3 changed files with 36 additions and 24 deletions

View File

@ -1,8 +1,8 @@
import {Injectable} from '@angular/core'; import { Injectable } from '@angular/core';
import {Slide, SlideVisibility} from '../shared/slide'; import { Slide, SlideVisibility } from '../shared/slide';
import {SlideService} from '../shared/service/slide.service'; import { SlideService } from '../shared/service/slide.service';
import {Router} from '@angular/router'; import { Router } from '@angular/router';
import {SettingsService} from '../shared/service/settings.service'; import { SettingsService } from '../shared/service/settings.service';
@Injectable() @Injectable()
export class SlideShowService { export class SlideShowService {
@ -18,20 +18,28 @@ export class SlideShowService {
} }
public nextSlide() { public nextSlide() {
if (this.currentSlideIndex === this.slides.length - 1) { switch (this.currentSlideIndex) {
this.currentSlideIndex++; case this.slides.length - 1:
this.router.navigate(['/kanban']); this.currentSlideIndex++;
} else if (this.currentSlideIndex === this.slides.length) { this.router.navigate(['/kanban']);
this.currentSlideIndex = -1; break;
this.reloadSlides(); case this.slides.length:
this.router.navigate(['/commit-tracker']); this.currentSlideIndex++;
} else { this.router.navigate(['/commit-tracker']);
this.oddEven = !this.oddEven; break;
this.currentSlideIndex++; case this.slides.length + 1:
this.router.navigate([ this.currentSlideIndex = -1;
this.oddEven ? '/slideshow-odd' : '/slideshow-even', this.reloadSlides();
this.slides[this.currentSlideIndex].id this.router.navigate(['/watchers-fixed']);
]); break;
default:
this.oddEven = !this.oddEven;
this.currentSlideIndex++;
this.router.navigate([
this.oddEven ? '/slideshow-odd' : '/slideshow-even',
this.slides[this.currentSlideIndex].id
]);
break;
} }
} }

View File

@ -31,7 +31,7 @@
<div class="content"> <div class="content">
<span class="author">{{issue.comment.name}}</span> <span class="author">{{issue.comment.name}}</span>
<div class="metadata"><span class="date">{{issue.comment.date}}</span></div> <div class="metadata"><span class="date">{{issue.comment.date}}</span></div>
<div class="text">{{issue.comment.content}}</div> <div class="text">{{issue.comment.content|shortenText:500}}</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,12 +1,12 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { Observable } from 'rxjs';
@Injectable() @Injectable()
export class SelfUpdaterService { export class SelfUpdaterService {
private appRevision: number = 0; private appRevision = 0;
private initFailed = false; private initFailed = false;
constructor(private httpClient: HttpClient, constructor(private httpClient: HttpClient,
@ -16,7 +16,7 @@ export class SelfUpdaterService {
() => { () => {
console.log( console.log(
'%c Couldn\'t load initial revision data from server. Self update disabled.', '%c Couldn\'t load initial revision data from server. Self update disabled.',
'background: #222; color: #bada55;' 'background: #222; color: #FFC300;'
); );
this.initFailed = true; this.initFailed = true;
} }
@ -31,7 +31,11 @@ export class SelfUpdaterService {
if (!this.initFailed) { if (!this.initFailed) {
this.getDeployedRevision().subscribe(revision => { this.getDeployedRevision().subscribe(revision => {
if (revision > this.appRevision) { if (revision > this.appRevision) {
this.locationService.go('/'); console.log(
`%c Version change detected (${this.appRevision}=>${revision}), reloading app.`,
'background: #222; color: #BADA55;'
);
window.location.reload(true);
} }
}); });
} }