Update task visually when changed by drag and drop. Fixes #507.

This commit is contained in:
Matthew Ross 2020-06-28 10:24:26 -04:00
parent ba9771ba79
commit 5493ce5d6e
2 changed files with 31 additions and 6 deletions

View File

@ -195,11 +195,11 @@ Because I like seeing the numbers.
Language | Files | Blank | Comment | Code
-----------|--------:|---------:|---------:|---------:
TypeScript | 67 | 978 | 129 | 4107
PHP | 20 | 752 | 40 | 2265
HTML | 21 | 268 | 2 | 1573
SASS | 14 | 299 | 10 | 1347
**SUM:** | **122** | **2297** | **181** | **9292**
TypeScript | 69 | 1032 | 122 | 4307
PHP | 21 | 790 | 40 | 2396
HTML | 22 | 287 | 2 | 1604
SASS | 14 | 302 | 10 | 1365
**SUM:** | **126** | **2411** | **174** | **9672**
Command: `cloc --exclude-dir=vendor,favicons --exclude-ext=json,svg,ini src/`

View File

@ -244,6 +244,11 @@ export class ColumnDisplayComponent implements OnInit, OnDestroy {
updateTaskColorByCategory(event: Category[]) {
this.modalProps.categories = event;
if (!event.length) {
return;
}
this.modalProps.color = event[event.length - 1].default_task_color;
}
@ -299,7 +304,27 @@ export class ColumnDisplayComponent implements OnInit, OnDestroy {
});
const task = this.activeBoard.columns[colIndex].tasks[event.currentIndex];
this.boardService.updateTask(task).subscribe(() => {});
this.boardService.updateTask(task).subscribe((response: ApiResponse) => {
response.alerts.forEach(alert => {
if (alert.type === 'success') {
return; // No need to show "task updated" for drag and drop
}
this.notes.add(alert);
});
if (response.status !== 'success') {
return;
}
const newTask = response.data[1][0];
const updatedTask = new Task(newTask.id, newTask.title, newTask.description,
newTask.color, newTask.due_date, newTask.points,
newTask.position, newTask.column_id, newTask.ownComment,
newTask.ownAttachment, newTask.sharedUser, newTask.sharedCategory);
this.activeBoard.columns[colIndex].tasks[event.currentIndex] = updatedTask;
});
}
updateTask() {