From 8e9d52b8e29be7c48814080671ac2c843effecb6 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Wed, 21 Aug 2019 10:40:05 +0200 Subject: [PATCH] runsummary: tasks graph implementation Add a tasks graph display in addition to the list display. A button will let the user choose between the two display formats (defaulting to the tasks graph). Since the graph is a DAG with many edges it's quite difficult to organize the tasks and the edges without any overlap. The current implementation uses a simpler approach where tasks are distributed horizontally by their level and tasks at the same level are distributed in a way that there's always space for an edge also if the child is some levels below. In this way edges may overlap and in this case they will appear as a single edge. The user, when hovering over a task, will see the connections with the other tasks since the related edges becomes bolder. --- src/components/runsummary.vue | 72 ++++--- src/components/task.vue | 72 ------- src/components/tasks.vue | 99 +++++++++ src/components/tasksgraph.vue | 378 ++++++++++++++++++++++++++++++++++ 4 files changed, 523 insertions(+), 98 deletions(-) delete mode 100644 src/components/task.vue create mode 100644 src/components/tasks.vue create mode 100644 src/components/tasksgraph.vue diff --git a/src/components/runsummary.vue b/src/components/runsummary.vue index 419e81c..84dfdf8 100644 --- a/src/components/runsummary.vue +++ b/src/components/runsummary.vue @@ -7,21 +7,33 @@ >
{{ fetchRunError }}
- +
-
Tasks
+
+ Tasks -
    -
  • - -
  • -
+
+ + +
+
+ +

Setup Errors

@@ -42,11 +54,12 @@ import { fetchRun } from "@/util/data.js"; import { userDirectRunTaskLink, projectRunTaskLink } from "@/util/link.js"; import rundetail from "@/components/rundetail.vue"; -import task from "@/components/task.vue"; +import tasks from "@/components/tasks.vue"; +import tasksgraph from "@/components/tasksgraph.vue"; export default { name: "runsummary", - components: { rundetail, task }, + components: { rundetail, tasks, tasksgraph }, props: { ownertype: String, ownername: String, @@ -57,7 +70,15 @@ export default { return { fetchRunError: null, run: null, - polling: null + polling: null, + + taskWidth: 200, + taskHeight: 40, + taskXSpace: 60, + taskYSpace: 20, + hoverTask: null, + + tasksDisplay: "graph" }; }, methods: { @@ -95,18 +116,17 @@ export default { this.fetchRunError = null; this.run = data; - // sort tasks by level let tasks = this.run.tasks; - let sortedTasks = Object.keys(this.run.tasks) - .sort((a, b) => - tasks[a].level > tasks[b].level - ? 1 - : tasks[b].level > tasks[a].level - ? -1 - : 0 - ) - .map(k => this.run.tasks[k]); - this.run.sortedTasks = sortedTasks; + + // add additional properties to every task + for (let taskID in tasks) { + let task = tasks[taskID]; + task.link = this.runTaskLink(task); + task.parents = this.parents(task); + task.waiting_approval = this.run.tasks_waiting_approval.includes( + taskID + ); + } }, pollData() { this.polling = setInterval(() => { diff --git a/src/components/task.vue b/src/components/task.vue deleted file mode 100644 index c5335c3..0000000 --- a/src/components/task.vue +++ /dev/null @@ -1,72 +0,0 @@ - - - - - diff --git a/src/components/tasks.vue b/src/components/tasks.vue new file mode 100644 index 0000000..600689e --- /dev/null +++ b/src/components/tasks.vue @@ -0,0 +1,99 @@ + + + \ No newline at end of file diff --git a/src/components/tasksgraph.vue b/src/components/tasksgraph.vue new file mode 100644 index 0000000..06c9082 --- /dev/null +++ b/src/components/tasksgraph.vue @@ -0,0 +1,378 @@ + + + \ No newline at end of file