Merge branch 'task-link' into dev

This commit is contained in:
Matthew Ross 2020-06-16 11:01:28 -04:00
commit efad6e9a38
12 changed files with 254 additions and 933 deletions

1091
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -65,7 +65,7 @@
"chartist-plugin-tooltips": "^0.0.17",
"classlist.js": "^1.1.20150312",
"core-js": "^3.6.5",
"highlight.js": "^10.0.3",
"highlight.js": "^10.1.0",
"marked": "^1.1.0",
"node-sass": "^4.14.1",
"rxjs": "^6.5.5",
@ -90,7 +90,7 @@
"jasmine": "^3.5.0",
"jasmine-core": "^3.5.0",
"jasmine-spec-reporter": "~5.0.2",
"karma": "^5.0.9",
"karma": "^5.1.0",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage-istanbul-reporter": "^3.0.3",
"karma-jasmine": "^3.3.1",
@ -98,7 +98,7 @@
"npm-run-all": "^4.1.5",
"npm-watch": "^0.6.0",
"protractor": "^7.0.0",
"puppeteer": "^3.3.0",
"puppeteer": "^4.0.0",
"ts-node": "^8.10.2",
"tslib": "^1.13.0",
"tslint": "^6.1.2",

21
src/api/composer.lock generated
View File

@ -1298,16 +1298,16 @@
},
{
"name": "phpunit/phpunit",
"version": "8.5.5",
"version": "8.5.6",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "63dda3b212a0025d380a745f91bdb4d8c985adb7"
"reference": "3f9c4079d1407cd84c51c02c6ad1df6ec2ed1348"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/63dda3b212a0025d380a745f91bdb4d8c985adb7",
"reference": "63dda3b212a0025d380a745f91bdb4d8c985adb7",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3f9c4079d1407cd84c51c02c6ad1df6ec2ed1348",
"reference": "3f9c4079d1407cd84c51c02c6ad1df6ec2ed1348",
"shasum": ""
},
"require": {
@ -1387,7 +1387,7 @@
"type": "github"
}
],
"time": "2020-05-22T13:51:52+00:00"
"time": "2020-06-15T10:45:47+00:00"
},
{
"name": "psr/container",
@ -2684,16 +2684,16 @@
},
{
"name": "webmozart/assert",
"version": "1.8.0",
"version": "1.9.0",
"source": {
"type": "git",
"url": "https://github.com/webmozart/assert.git",
"reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6"
"reference": "9dc4f203e36f2b486149058bade43c851dd97451"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozart/assert/zipball/ab2cb0b3b559010b75981b1bdce728da3ee90ad6",
"reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6",
"url": "https://api.github.com/repos/webmozart/assert/zipball/9dc4f203e36f2b486149058bade43c851dd97451",
"reference": "9dc4f203e36f2b486149058bade43c851dd97451",
"shasum": ""
},
"require": {
@ -2701,6 +2701,7 @@
"symfony/polyfill-ctype": "^1.8"
},
"conflict": {
"phpstan/phpstan": "<0.12.20",
"vimeo/psalm": "<3.9.1"
},
"require-dev": {
@ -2728,7 +2729,7 @@
"check",
"validate"
],
"time": "2020-04-18T12:12:48+00:00"
"time": "2020-06-16T10:16:42+00:00"
}
],
"packages-dev": [],

View File

@ -22,6 +22,11 @@ export const ROUTES: Routes = [
component: BoardDisplayComponent,
canActivate: [ AuthGuard ]
},
{
path: 'boards/:id/:taskId',
component: BoardDisplayComponent,
canActivate: [ AuthGuard ]
},
{
path: 'settings',
component: SettingsComponent,

View File

@ -80,6 +80,13 @@ export class BoardDisplayComponent implements OnInit, OnDestroy {
this.loading = true;
this.boardNavId = id ? id : null;
this.updateActiveBoard();
if (!params.taskId) {
boardService.showTask(null);
return;
}
boardService.showTask(params.taskId);
});
this.subs.push(sub);
}

View File

@ -28,8 +28,10 @@ export class BoardService extends ApiService {
complete: 0
};
private activeBoard = new BehaviorSubject<Board>(null);
private showTaskId = new BehaviorSubject<number>(null);
public activeBoardChanged = this.activeBoard.asObservable();
public showTaskIdChanged = this.showTaskId.asObservable();
constructor(private http: HttpClient, strat: LocationStrategy) {
super(strat);
@ -42,6 +44,10 @@ export class BoardService extends ApiService {
hljs.registerLanguage('php', php);
}
showTask(id: number) {
this.showTaskId.next(id);
}
async convertMarkdown(markdown: string, callback = this.defaultCallback,
doCount = false): Promise<MarkedReturn> {
this.checkCounts.total = 0;

View File

@ -89,7 +89,7 @@
[remove-task]="getRemoveTaskFunction(task.id)"
[collapse]="collapseTasks"
(on-update-boards)="callBoardUpdate();"
(dblclick)="$event.preventDefault();showViewModal(task.id)">
(dblclick)="$event.preventDefault();getShowViewModalFunction(task.id)()">
</tb-task>
</div>

View File

@ -8,6 +8,7 @@ import {
Output,
} from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { Location } from '@angular/common';
import {
CdkDragDrop,
moveItemInArray,
@ -92,6 +93,7 @@ export class ColumnDisplayComponent implements OnInit, OnDestroy {
constructor(public elRef: ElementRef,
private auth: AuthService,
private location: Location,
public notes: NotificationsService,
public modal: ModalService,
public stringsService: StringsService,
@ -99,7 +101,7 @@ export class ColumnDisplayComponent implements OnInit, OnDestroy {
private sanitizer: DomSanitizer) {
this.templateElement = elRef.nativeElement;
this.collapseTasks = false;
this.commentOrder = "oldest";
this.commentOrder = 'oldest';
this.sortOption = 'pos';
this.MODAL_ID = 'add-task-form-';
@ -126,6 +128,17 @@ export class ColumnDisplayComponent implements OnInit, OnDestroy {
});
this.subs.push(sub);
sub = boardService.showTaskIdChanged.subscribe(taskId => {
setTimeout(() => {
this.columnData?.tasks?.forEach(task => {
if (+task.id === +taskId) {
this.showViewModal(+taskId);
}
});
}, 0);
});
this.subs.push(sub);
sub = auth.userChanged.subscribe((user: User) => {
if (user === null) {
return;
@ -559,7 +572,11 @@ export class ColumnDisplayComponent implements OnInit, OnDestroy {
}
getShowViewModalFunction(taskId: number): () => void {
return () => { this.showViewModal(taskId); };
return () => {
const url = 'boards/' + this.activeBoard.id + '/' + taskId;
this.location.go(url);
this.showViewModal(taskId);
};
}
showModal(taskId: number = 0) {

View File

@ -4,6 +4,7 @@ import {
OnInit,
ContentChild
} from '@angular/core';
import { Location } from '@angular/common';
import { ModalService } from './modal.service';
@ -30,7 +31,7 @@ export class ModalComponent implements OnInit {
isOpen = false;
animate = true;
constructor(public modalService: ModalService) {
constructor(public modalService: ModalService, private location: Location) {
}
ngOnInit() {
@ -39,6 +40,11 @@ export class ModalComponent implements OnInit {
close(checkBlocking = false): void {
this.modalService.close(this.modalId, checkBlocking);
const path = this.location.path().split('/');
path.length -= 1;
this.location.go(path.join('/'))
}
filterClick(event: Event): void {
@ -52,13 +58,11 @@ export class ModalComponent implements OnInit {
}
keyup(event: KeyboardEvent): void {
// tslint:disable-next-line
if (event.keyCode === 27) {
this.modalService.close(this.modalId, true);
if (event.key === 'Escape' && this.isOpen) {
this.close(true);
}
// tslint:disable-next-line
if (event.keyCode === 13) {
if (event.key === 'Enter') {
this.clickDefaultAction();
}
}

View File

@ -513,7 +513,7 @@ describe('ColumnDisplay', () => {
expect(called).toEqual(true);
});
it('opens a model to add a task', () => {
it('opens a modal to add a task', () => {
component.quickAdd = { title: '' } as any;
component.columnData = { id: 1 } as any;

View File

@ -19,6 +19,12 @@ export class BoardServiceMock {
public activeBoardChanged =
new BehaviorSubject({ id: 0, name: 'Test', columns: [] });
public showTaskIdChanged = new BehaviorSubject(null);
showTask(id: number) {
this.showTaskIdChanged.next(id);
}
getBoards() {
return new BehaviorSubject({
data: [{}, [{ id: 1, name: 'Test', is_active: '1' }]]

View File

@ -73,7 +73,7 @@ describe('Modal', () => {
expect(checkBlocking).toEqual(true);
};
keyUp({ keyCode: 27 } as any);
keyUp({ key: 'Escape' } as any);
});
it('handles the Enter key', () => {
@ -85,7 +85,7 @@ describe('Modal', () => {
click: () => called = true
} };
keyUp({ keyCode: 13 } as any);
keyUp({ key: 'Enter' } as any);
expect(called).toEqual(true);
});