diff --git a/src/app/display/commit-tracker/commit-tracker.component.html b/src/app/display/commit-tracker/commit-tracker.component.html old mode 100644 new mode 100755 index 4141b3b..e52ddb4 --- a/src/app/display/commit-tracker/commit-tracker.component.html +++ b/src/app/display/commit-tracker/commit-tracker.component.html @@ -1,5 +1,5 @@
- +
@@ -43,4 +43,4 @@
Owner
-
\ No newline at end of file + diff --git a/src/app/display/display-routing.module.ts b/src/app/display/display-routing.module.ts old mode 100644 new mode 100755 index 37be86f..d3a784b --- a/src/app/display/display-routing.module.ts +++ b/src/app/display/display-routing.module.ts @@ -9,6 +9,8 @@ import { SlideShowComponent } from './slide-show/slide-show.component'; import { SlideResolverService } from '../admin/slide-resolver.service'; import { KanbanBoardComponent } from './kanban-board/kanban-board.component'; import { KanbanService } from './shared'; +import {WatchersComponent} from './watchers/watchers.component'; +import {WatcherService} from './shared/watcher.service'; const routes: Routes = [ { @@ -78,6 +80,26 @@ const routes: Routes = [ data: { autoSwitchable: false } + }, { + path: 'watchers', + component: WatchersComponent, + // canActivate: [AuthGuardService, RoleGuardService], + resolve: { + watchers: WatcherService, + }, + data: { + autoSwitchable: true + } + }, { + path: 'watchers-fixed', + component: WatchersComponent, + // canActivate: [AuthGuardService, RoleGuardService], + resolve: { + watchers: WatcherService, + }, + data: { + autoSwitchable: false + } }, { path: 'settings', component: SettingsComponent, diff --git a/src/app/display/display.module.ts b/src/app/display/display.module.ts index c4e9c22..385d094 100755 --- a/src/app/display/display.module.ts +++ b/src/app/display/display.module.ts @@ -17,6 +17,7 @@ import { PriorityColorPipe } from './shared/priority-color.pipe'; import { ShortenTextPipe } from './shared/shorten-text.pipe'; import { KanbanService } from './shared'; import { SlideIframeComponent } from './slide-iframe/slide-iframe.component'; +import { WatchersComponent } from './watchers/watchers.component'; @NgModule({ imports: [ @@ -39,6 +40,7 @@ import { SlideIframeComponent } from './slide-iframe/slide-iframe.component'; PriorityColorPipe, ShortenTextPipe, SlideIframeComponent, + WatchersComponent, ], providers: [ SlideShowService, diff --git a/src/app/display/settings/settings.component.html b/src/app/display/settings/settings.component.html old mode 100644 new mode 100755 index 6ca19ac..71f0f0c --- a/src/app/display/settings/settings.component.html +++ b/src/app/display/settings/settings.component.html @@ -18,7 +18,7 @@
diff --git a/src/app/display/shared/kanban-board.model.ts b/src/app/display/shared/kanban-board.model.ts old mode 100644 new mode 100755 index 915ebe8..537f600 --- a/src/app/display/shared/kanban-board.model.ts +++ b/src/app/display/shared/kanban-board.model.ts @@ -1,4 +1,4 @@ -import {KanbanEntry} from "./kanban-entry.model"; +import {KanbanEntry} from './kanban-entry.model'; export class KanbanBoard { public inbox: Array; diff --git a/src/app/display/shared/watched-issue.model.ts b/src/app/display/shared/watched-issue.model.ts new file mode 100755 index 0000000..d2d7480 --- /dev/null +++ b/src/app/display/shared/watched-issue.model.ts @@ -0,0 +1,13 @@ +export class WatchedIssue { + public issue = ''; + public summary = ''; + public assignee = ''; + public comment: WatchedIssueComment; +} + +export class WatchedIssueComment { + public signum = ''; + public name = ''; + public content = ''; + public date = ''; +} diff --git a/src/app/display/shared/watcher.service.spec.ts b/src/app/display/shared/watcher.service.spec.ts new file mode 100644 index 0000000..c96eb78 --- /dev/null +++ b/src/app/display/shared/watcher.service.spec.ts @@ -0,0 +1,15 @@ +import { TestBed, inject } from '@angular/core/testing'; + +import { WatcherService } from './watcher.service'; + +describe('WatcherService', () => { + beforeEach(() => { + TestBed.configureTestingModule({ + providers: [WatcherService] + }); + }); + + it('should be created', inject([WatcherService], (service: WatcherService) => { + expect(service).toBeTruthy(); + })); +}); diff --git a/src/app/display/shared/watcher.service.ts b/src/app/display/shared/watcher.service.ts new file mode 100755 index 0000000..a053ebc --- /dev/null +++ b/src/app/display/shared/watcher.service.ts @@ -0,0 +1,62 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { ActivatedRouteSnapshot } from '@angular/router'; +import { Observable } from 'rxjs'; + +import { environment } from '../../../environments/environment'; +import { KanbanBoard } from './kanban-board.model'; +import { SettingsService } from '../../shared/service/settings.service'; +import { TeamService } from '../../shared/service/team.service'; +import { flatMap } from 'rxjs/operators'; +import {WatchedIssue} from './watched-issue.model'; + +@Injectable({ + providedIn: 'root' +}) +export class WatcherService { + private url = environment.apiUrl + '/api/watched'; + + private cachedWatchers: Array = []; + + constructor(private httpService: HttpClient, + private teamService: TeamService, + private settingService: SettingsService) { + } + + /** + * Returns an observable instance to the kanban board api + * Reloads team data before, to refresh team config + * + * @returns {Observable} + */ + public getList(): Observable> { + return this.teamService.get(this.settingService.team.id).pipe( + flatMap(() => this.httpService.get>(`${this.url}/${this.settingService.team.id}`)) + ); + } + + /** + * Route preload resolver + * + * @param {ActivatedRouteSnapshot} route + * @returns {Promise} + */ + public resolve(route: ActivatedRouteSnapshot): Promise | boolean> { + return this.getList().toPromise().then(result => result ? result : false); + } + + /** + * Reload the board + */ + public reload() { + this.getList().subscribe(result => this.cachedWatchers = result); + } + + get watchers(): Array { + return this.cachedWatchers; + } + + set watchers(kanbanBoard: Array) { + this.cachedWatchers = kanbanBoard; + } +} diff --git a/src/app/display/watchers/watchers.component.css b/src/app/display/watchers/watchers.component.css new file mode 100755 index 0000000..0394016 --- /dev/null +++ b/src/app/display/watchers/watchers.component.css @@ -0,0 +1,52 @@ +:host { + background-color: #444; +} + +/* avatar */ +.ui.jira-avatar.image { + width: 45px; + height: auto; + /*font-size: 1em;*/ + margin-right: 4px; + margin-bottom: 0; +} + +.ui.jira-avatar.image > img { + border-radius: 4px; + max-width: 45px; + height: auto; +} + +/* items */ +.ui.items .item .header { + color: white; +} + +.ui.items .item .meta { + color: lightgray; +} + +/* comments */ +.ui.comments .comment .metadata { + color: lightgray; +} + +.ui.comments .comment .text { + color: white; +} + +.ui.comments .comment .author { + color: white; +} + +/* header */ +h1.massive { + font-size: 72px; + position: absolute; + top: calc(50% - 157px); + left: calc(50% - 541px); +} + +.ui.comments { + max-width: initial; +} diff --git a/src/app/display/watchers/watchers.component.html b/src/app/display/watchers/watchers.component.html new file mode 100755 index 0000000..4027b36 --- /dev/null +++ b/src/app/display/watchers/watchers.component.html @@ -0,0 +1,48 @@ +
+ + + + + + + + + + + + + + + +
AssigneeIssueLast comment
+
+ +
+
+
+
+
+ {{issue.issue}} +
{{issue.summary}}
+
+
+
+
+
+
+ +
+ {{issue.comment.name}} + +
{{issue.comment.content}}
+
+
+
+
+
+

+ +
No watched item needs attention.
+

+
+
diff --git a/src/app/display/watchers/watchers.component.spec.ts b/src/app/display/watchers/watchers.component.spec.ts new file mode 100644 index 0000000..0f5f386 --- /dev/null +++ b/src/app/display/watchers/watchers.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { WatchersComponent } from './watchers.component'; + +describe('WatchersComponent', () => { + let component: WatchersComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ WatchersComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(WatchersComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/display/watchers/watchers.component.ts b/src/app/display/watchers/watchers.component.ts new file mode 100755 index 0000000..0c5b81f --- /dev/null +++ b/src/app/display/watchers/watchers.component.ts @@ -0,0 +1,48 @@ +import {Component, HostBinding, OnInit} from '@angular/core'; +import { Title } from '@angular/platform-browser'; +import { ActivatedRoute } from '@angular/router'; +import { SettingsService } from '../../shared/service/settings.service'; +import {slideInOutAnimation} from '../../shared/slide-in-out-animation'; +import {WatcherService} from '../shared/watcher.service'; +import {WatchedIssue} from '../shared/watched-issue.model'; +import {environment} from '../../../environments/environment'; + +const DEFAULT_AVATAR = '/assets/riddler.png'; + +@Component({ + selector: 'app-watchers', + templateUrl: './watchers.component.html', + styleUrls: ['./watchers.component.css'], + animations: [slideInOutAnimation] +}) +export class WatchersComponent implements OnInit { + + @HostBinding('@slideInOutAnimation') + slideIn = true; + + constructor(private titleService: Title, + private route: ActivatedRoute, + private watcherService: WatcherService, + private settingService: SettingsService) { } + + ngOnInit() { + this.titleService.setTitle(`${this.settingService.team.name} : Watched issue activity`); + this.route.data.subscribe((data: { + watchers: Array, + }) => { + this.watchers = data.watchers; + }); + } + + get watchers(): Array { + return this.watcherService.watchers; + } + + set watchers(watchers: Array) { + this.watcherService.watchers = watchers; + } + + public avatarUrl(signum: string): string { + return environment.apiUrl + (signum ? `/avatars/${signum}` : DEFAULT_AVATAR); + } +}