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