2019-02-12 09:08:37 +01:00
|
|
|
import {AttractRowBase} from '../../attracttable/rows/AttractRowBase'
|
|
|
|
|
|
|
|
class TaskRow extends AttractRowBase {
|
|
|
|
constructor(task) {
|
|
|
|
super(task);
|
|
|
|
this.parent = undefined;
|
2019-04-02 14:09:20 +02:00
|
|
|
if (task.parent && task.parent._id) {
|
2019-02-12 09:08:37 +01:00
|
|
|
// Deattach parent from task to avoid parent to be overwritten when task is updated
|
|
|
|
let parentId = task.parent._id;
|
|
|
|
this.parent = task.parent;
|
|
|
|
task.parent = parentId;
|
|
|
|
pillar.events.Nodes.onUpdated(parentId, this.onParentUpdated.bind(this));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
getTask() {
|
|
|
|
return this.underlyingObject;
|
|
|
|
}
|
|
|
|
|
|
|
|
getParent() {
|
|
|
|
return this.parent;
|
|
|
|
}
|
|
|
|
|
2019-03-13 13:53:40 +01:00
|
|
|
onParentUpdated(event) {
|
|
|
|
this.parent = event.detail;
|
2019-02-12 09:08:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export { TaskRow }
|