From 14cf2c55f9a05c134be0d4ee0152a1542a460826 Mon Sep 17 00:00:00 2001
From: Patrick Jentsch
Date: Mon, 3 Feb 2020 15:58:46 +0100
Subject: [PATCH] Fix result addition
---
app/templates/jobs/job.html.j2 | 32 +++++++++++---------------------
1 file changed, 11 insertions(+), 21 deletions(-)
diff --git a/app/templates/jobs/job.html.j2 b/app/templates/jobs/job.html.j2
index e2aa21f6..cc35b938 100644
--- a/app/templates/jobs/job.html.j2
+++ b/app/templates/jobs/job.html.j2
@@ -206,7 +206,7 @@
switch(operation.op) {
case "add":
if (pathArray[1] === "results") {
- this.setResult(operation.value);
+ this.setResults([operation.value]);
}
break;
case "delete":
@@ -238,30 +238,20 @@
}
setResults(results) {
- let resultElement, resultsElement, resultDownloadElement,
- resultDownloadButtonElement, resultDownloadButtonIconElement,
- resultTitleElement;
+ let resultsElement;
resultsElement = document.getElementById("results");
for (let result of results) {
- resultElement = document.createElement("tr");
- resultTitleElement = document.createElement("td");
- resultTitleElement.innerText = result.filename;
- resultElement.append(resultTitleElement);
- resultDownloadElement = document.createElement("td");
- resultDownloadButtonElement = document.createElement("a");
- resultDownloadButtonElement.classList.add("waves-effect", "waves-light",
- "btn-small");
- resultDownloadButtonElement.href = `/jobs/${result.job_id}/results/${result.id}/download`;
- resultDownloadButtonElement.setAttribute("download", "");
- resultDownloadButtonIconElement = document.createElement("i");
- resultDownloadButtonIconElement.classList.add("material-icons");
- resultDownloadButtonIconElement.innerText = "file_download";
- resultDownloadButtonElement.append(resultDownloadButtonIconElement);
- resultDownloadElement.append(resultDownloadButtonElement)
- resultElement.append(resultDownloadElement);
- resultsElement.append(resultElement);
+ resultsElement.insertAdjacentHTML("beforeend", `
+
+ ${result.filename} |
+
+
+ file_download
+
+ |
+
`);
}
}