* 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 {Slide, SlideVisibility} from '../shared/slide';
import {SlideService} from '../shared/service/slide.service';
import {Router} from '@angular/router';
import {SettingsService} from '../shared/service/settings.service';
import { Injectable } from '@angular/core';
import { Slide, SlideVisibility } from '../shared/slide';
import { SlideService } from '../shared/service/slide.service';
import { Router } from '@angular/router';
import { SettingsService } from '../shared/service/settings.service';
@Injectable()
export class SlideShowService {
@ -18,20 +18,28 @@ export class SlideShowService {
}
public nextSlide() {
if (this.currentSlideIndex === this.slides.length - 1) {
this.currentSlideIndex++;
this.router.navigate(['/kanban']);
} else if (this.currentSlideIndex === this.slides.length) {
this.currentSlideIndex = -1;
this.reloadSlides();
this.router.navigate(['/commit-tracker']);
} else {
this.oddEven = !this.oddEven;
this.currentSlideIndex++;
this.router.navigate([
this.oddEven ? '/slideshow-odd' : '/slideshow-even',
this.slides[this.currentSlideIndex].id
]);
switch (this.currentSlideIndex) {
case this.slides.length - 1:
this.currentSlideIndex++;
this.router.navigate(['/kanban']);
break;
case this.slides.length:
this.currentSlideIndex++;
this.router.navigate(['/commit-tracker']);
break;
case this.slides.length + 1:
this.currentSlideIndex = -1;
this.reloadSlides();
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">
<span class="author">{{issue.comment.name}}</span>
<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>

View File

@ -1,12 +1,12 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { Location } from '@angular/common';
import { Observable } from 'rxjs';
@Injectable()
export class SelfUpdaterService {
private appRevision: number = 0;
private appRevision = 0;
private initFailed = false;
constructor(private httpClient: HttpClient,
@ -16,7 +16,7 @@ export class SelfUpdaterService {
() => {
console.log(
'%c Couldn\'t load initial revision data from server. Self update disabled.',
'background: #222; color: #bada55;'
'background: #222; color: #FFC300;'
);
this.initFailed = true;
}
@ -31,7 +31,11 @@ export class SelfUpdaterService {
if (!this.initFailed) {
this.getDeployedRevision().subscribe(revision => {
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);
}
});
}