105 lines
2.7 KiB
TypeScript
Executable File
105 lines
2.7 KiB
TypeScript
Executable File
import {Component, OnInit} from '@angular/core';
|
|
import {Title} from '@angular/platform-browser';
|
|
import {ActivatedRoute} from '@angular/router';
|
|
|
|
import {KanbanBoard, KanbanEntry, KanbanService,} from '../shared';
|
|
import {SettingsService} from '../../shared/service/settings.service';
|
|
|
|
@Component({
|
|
selector: 'app-kanban-board',
|
|
templateUrl: './kanban-board.component.html',
|
|
styleUrls: ['./kanban-board.component.css'],
|
|
})
|
|
export class KanbanBoardComponent implements OnInit {
|
|
|
|
constructor(private titleService: Title,
|
|
private route: ActivatedRoute,
|
|
private kanbanService: KanbanService,
|
|
private settings: SettingsService) {
|
|
}
|
|
|
|
/**
|
|
* Set page title, and handle preloaded kanbanBoard data
|
|
*/
|
|
ngOnInit() {
|
|
this.titleService.setTitle(`${this.settings.team.name} : Kanban board`);
|
|
this.route.data.subscribe((data: {
|
|
kanbanBoard: KanbanBoard,
|
|
}) => {
|
|
this.kanbanBoard = data.kanbanBoard;
|
|
});
|
|
}
|
|
|
|
get kanbanBoard(): KanbanBoard {
|
|
return this.kanbanService.kanbanBoard;
|
|
}
|
|
|
|
set kanbanBoard(kanbanBoard: KanbanBoard) {
|
|
this.kanbanService.kanbanBoard = kanbanBoard;
|
|
}
|
|
|
|
get inprogressWipLimit(): number {
|
|
return this.settings.team.inprogressColumn.wipLimit;
|
|
}
|
|
|
|
get inprogressWipCount(): number {
|
|
return this.kanbanBoard.inProgress.filter(
|
|
(entry: KanbanEntry) => entry.labels.every(
|
|
label => label.toUpperCase() !== 'BLOCKED'
|
|
)
|
|
).length;
|
|
}
|
|
|
|
/**
|
|
* Set 'over-wip' class on inprogress row if its over the wip limit
|
|
* This excludes issues marked as BLOCKED with labels
|
|
*
|
|
* @returns {{over-wip: boolean}}
|
|
*/
|
|
get inprogressWipClass() {
|
|
return {
|
|
'over-wip': this.inprogressWipCount > this.settings.team.inprogressColumn.wipLimit,
|
|
};
|
|
}
|
|
|
|
get verificationWipLimit(): number {
|
|
return this.settings.team.verificationColumn.wipLimit;
|
|
}
|
|
|
|
get verificationWipCount(): number {
|
|
return this.kanbanBoard.verification.filter(
|
|
(entry: KanbanEntry) => entry.labels.every(
|
|
label => label.toUpperCase() !== 'BLOCKED'
|
|
)
|
|
).length;
|
|
}
|
|
|
|
/**
|
|
* Set 'over-wip' class on verification row if its over the wip limit
|
|
* This excludes issues marked as BLOCKED with labels
|
|
*
|
|
* @returns {{over-wip: boolean}}
|
|
*/
|
|
get verificationWipClass() {
|
|
return {
|
|
'over-wip': this.verificationWipCount > this.settings.team.verificationColumn.wipLimit,
|
|
};
|
|
}
|
|
|
|
get backlogLabel(): string {
|
|
return this.settings.team.backlogColumn.label;
|
|
}
|
|
|
|
get inProgressLabel(): string {
|
|
return this.settings.team.inprogressColumn.label;
|
|
}
|
|
|
|
get verificationLabel(): string {
|
|
return this.settings.team.verificationColumn.label;
|
|
}
|
|
|
|
get doneLabel(): string {
|
|
return this.settings.team.doneColumn.label;
|
|
}
|
|
}
|