Minor cleanup and sorting tweak
This commit is contained in:
parent
289ea397bb
commit
f5971e65b6
@ -2,18 +2,13 @@ import { Component, OnInit, OnDestroy } from '@angular/core';
|
|||||||
import { Router, ActivatedRoute } from '@angular/router';
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
import { Title } from '@angular/platform-browser';
|
import { Title } from '@angular/platform-browser';
|
||||||
|
|
||||||
import {
|
|
||||||
ApiResponse,
|
|
||||||
Board,
|
|
||||||
Column,
|
|
||||||
User
|
|
||||||
} from '../shared/models';
|
|
||||||
import {
|
import {
|
||||||
AuthService,
|
AuthService,
|
||||||
ContextMenuService,
|
ContextMenuService,
|
||||||
NotificationsService,
|
NotificationsService,
|
||||||
StringsService
|
StringsService
|
||||||
} from '../shared/services';
|
} from '../shared/services';
|
||||||
|
import { ApiResponse, Board, User } from '../shared/models';
|
||||||
import { BoardService } from './board.service';
|
import { BoardService } from './board.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -178,16 +173,7 @@ export class BoardDisplayComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
this.boards = activeBoards;
|
this.boards = activeBoards;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
this.updateActiveBoard();
|
||||||
this.sortColumns().then(() => { this.updateActiveBoard(); })
|
|
||||||
}
|
|
||||||
|
|
||||||
private async sortColumns() {
|
|
||||||
this.boards.forEach(board => {
|
|
||||||
board.columns.sort((a: Column, b: Column) => {
|
|
||||||
return +a.position - +b.position;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateActiveBoard(): void {
|
private updateActiveBoard(): void {
|
||||||
|
@ -26,15 +26,13 @@ export class Board {
|
|||||||
this.users = [];
|
this.users = [];
|
||||||
|
|
||||||
columnArray.forEach((column: any) => {
|
columnArray.forEach((column: any) => {
|
||||||
this.convertColumn(column).then(col => {
|
this.columns.push(this.convertColumn(column));
|
||||||
this.columns.push(col);
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.columns.sort((a, b) => a.position - b.position);
|
||||||
|
|
||||||
categoryArray.forEach((category: any) => {
|
categoryArray.forEach((category: any) => {
|
||||||
this.convertCategory(category).then(cat => {
|
this.categories.push(this.convertCategory(category));
|
||||||
this.categories.push(cat);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
actionsArray.forEach((action: any) => {
|
actionsArray.forEach((action: any) => {
|
||||||
@ -78,7 +76,7 @@ export class Board {
|
|||||||
this.issue_trackers.push(new IssueTracker(0, url, regex));
|
this.issue_trackers.push(new IssueTracker(0, url, regex));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async convertColumn(column: any): Promise<Column> {
|
private convertColumn(column: any): Column {
|
||||||
const col = new Column(+column.id, column.name, +column.position,
|
const col = new Column(+column.id, column.name, +column.position,
|
||||||
+column.board_id, +column.task_limit,
|
+column.board_id, +column.task_limit,
|
||||||
column.ownTask);
|
column.ownTask);
|
||||||
@ -86,7 +84,7 @@ export class Board {
|
|||||||
return col;
|
return col;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async convertCategory(category: any): Promise<Category> {
|
private convertCategory(category: any): Category {
|
||||||
|
|
||||||
const cat = new Category(+category.id, category.name,
|
const cat = new Category(+category.id, category.name,
|
||||||
category.default_task_color, +category.board_id);
|
category.default_task_color, +category.board_id);
|
||||||
|
@ -14,9 +14,6 @@
|
|||||||
"typeRoots": [
|
"typeRoots": [
|
||||||
"node_modules/@types"
|
"node_modules/@types"
|
||||||
],
|
],
|
||||||
"paths": {
|
|
||||||
"dragula": ["../node_modules/dragula/dist/dragula.min.js"]
|
|
||||||
},
|
|
||||||
"lib": [
|
"lib": [
|
||||||
"es2018",
|
"es2018",
|
||||||
"dom"
|
"dom"
|
||||||
|
Reference in New Issue
Block a user