+
+
+
+
+
+
+
+ No task found. Consider changing the search query.
+
+
-
-
+
+
+
+
+
+
+
@@ -254,231 +294,286 @@
\ No newline at end of file
diff --git a/src/models/list.js b/src/models/list.js
index 5f90c451..7d2291ca 100644
--- a/src/models/list.js
+++ b/src/models/list.js
@@ -62,17 +62,7 @@ export default class ListModel extends AbstractModel {
* @param task
*/
addTaskToList(task) {
- // If it's a subtask, add it to its parent, otherwise append it to the list of tasks
- if (task.parentTaskID === 0) {
- this.tasks.push(task)
- } else {
- for (const t in this.tasks) {
- if (this.tasks[t].id === task.parentTaskID) {
- this.tasks[t].subtasks.push(task)
- break
- }
- }
- }
+ this.tasks.push(task)
this.sortTasks()
}
@@ -92,7 +82,7 @@ export default class ListModel extends AbstractModel {
}
/**
- * Loops through all tasks and updates the one with the id it has
+ * Loops through all tasks and updates the one with the id it has
* @param task
*/
updateTaskByID(task) {
@@ -101,15 +91,6 @@ export default class ListModel extends AbstractModel {
this.tasks[t] = task
break
}
-
- if (this.tasks[t].id === task.parentTaskID) {
- for (const s in this.tasks[t].subtasks) {
- if (this.tasks[t].subtasks[s].id === task.id) {
- this.tasks[t].subtasks[s] = task
- break
- }
- }
- }
}
this.sortTasks()
}
diff --git a/src/models/relationKinds.json b/src/models/relationKinds.json
new file mode 100644
index 00000000..2129c6d3
--- /dev/null
+++ b/src/models/relationKinds.json
@@ -0,0 +1,13 @@
+{
+ "subtask": "Subtask",
+ "parenttask": "Parent Task",
+ "related": "Related Task",
+ "duplicateof": "Duplicate Of",
+ "duplicates": "Duplicates",
+ "blocking": "Blocking",
+ "blocked": "Blocked By",
+ "precedes": "Preceds",
+ "follows": "Follows",
+ "copiedfrom": "Copied From",
+ "copiedto": "Copied To"
+}
\ No newline at end of file
diff --git a/src/models/task.js b/src/models/task.js
index 56187d80..a1fd80d8 100644
--- a/src/models/task.js
+++ b/src/models/task.js
@@ -37,6 +37,13 @@ export default class TaskModel extends AbstractModel {
if (this.hexColor.substring(0, 1) !== '#') {
this.hexColor = '#' + this.hexColor
}
+
+ // Make all subtasks to task models
+ Object.keys(this.related_tasks).forEach(relationKind => {
+ this.related_tasks[relationKind] = this.related_tasks[relationKind].map(t => {
+ return new TaskModel(t)
+ })
+ })
}
defaults() {
@@ -54,10 +61,10 @@ export default class TaskModel extends AbstractModel {
endDate: 0,
repeatAfter: 0,
reminderDates: [],
- subtasks: [],
parentTaskID: 0,
hexColor: '',
percentDone: 0,
+ related_tasks: {},
createdBy: UserModel,
created: 0,
diff --git a/src/models/taskRelation.js b/src/models/taskRelation.js
new file mode 100644
index 00000000..d88e8686
--- /dev/null
+++ b/src/models/taskRelation.js
@@ -0,0 +1,21 @@
+import AbstractModel from './abstractModel'
+import UserModel from "./user";
+
+export default class TaskRelationModel extends AbstractModel {
+ constructor(data) {
+ super(data)
+ this.created_by = new UserModel(this.created_by)
+ }
+
+ defaults() {
+ return {
+ id: 0,
+ other_task_id: 0,
+ task_id: 0,
+ relation_kind: '',
+
+ created_by: UserModel,
+ created: 0,
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/services/taskRelation.js b/src/services/taskRelation.js
new file mode 100644
index 00000000..5934aace
--- /dev/null
+++ b/src/services/taskRelation.js
@@ -0,0 +1,15 @@
+import AbstractService from "./abstractService";
+import TaskRelationModel from '../models/taskRelation'
+
+export default class TaskRelationService extends AbstractService {
+ constructor() {
+ super({
+ create: '/tasks/{task_id}/relations',
+ delete: '/tasks/{task_id}/relations',
+ })
+ }
+
+ modelFactory(data) {
+ return new TaskRelationModel(data)
+ }
+}
\ No newline at end of file
diff --git a/src/styles/tasks.scss b/src/styles/tasks.scss
index 386c2daf..1b31a6c8 100644
--- a/src/styles/tasks.scss
+++ b/src/styles/tasks.scss
@@ -68,6 +68,10 @@
}
}
+ .remove {
+ color: $red;
+ }
+
.high-priority{
color: $red;