diff --git a/web/app/static/js/nopaque.lists.js b/web/app/static/js/nopaque.lists.js
index b5ce9dd6..3a23aee3 100644
--- a/web/app/static/js/nopaque.lists.js
+++ b/web/app/static/js/nopaque.lists.js
@@ -89,6 +89,7 @@ RessourceList.dataMapper = {
// Mapping for Corpus entities shown in the dashboard table.
Corpus: corpus => ({creation_date: corpus.creation_date,
+ "delete-onclick": `prepareDeleteCorpusModal(${corpus.id})`,
description: corpus.description,
id: corpus.id,
"analyse-link": ["analysing", "prepared", "start analysis"].includes(corpus.status) ? `/corpora/${corpus.id}/analyse` : "",
@@ -105,6 +106,7 @@ RessourceList.dataMapper = {
"delete-modal": `delete-corpus-file-${corpus_file.id}-modal`}),
// Mapping for job entities shown in the dashboard table.
Job: job => ({creation_date: job.creation_date,
+ "delete-onclick": `prepareDeleteJobModal(${job.id})`,
description: job.description,
id: job.id,
link: `/jobs/${job.id}`,
@@ -118,7 +120,7 @@ RessourceList.dataMapper = {
// Mapping for imported result entities from corpus analysis.
// Shown in imported results table
QueryResult: query_result => ({corpus_name: query_result.query_metadata.corpus_name,
- "delete-link": `prepareQueryResultModal(${query_result.id})`,
+ "delete-onclick": `prepareDeleteQueryResultModal(${query_result.id})`,
description: query_result.description,
id: query_result.id,
"inspect-link": `/query_results/${query_result.id}/inspect`,
@@ -167,6 +169,9 @@ RessourceList.options = {
+
+ delete
+
edit
@@ -180,6 +185,7 @@ RessourceList.options = {
"title",
{data: ["id"]},
{name: "analyse-link", attr: "href"},
+ {name: "delete-onclick", attr: "onclick"},
{name: "edit-link", attr: "href"},
{name: "status", attr: "data-status"}]},
CorpusFile: {item: ` |
@@ -220,6 +226,9 @@ RessourceList.options = {
+
+ delete
+
send
@@ -229,17 +238,18 @@ RessourceList.options = {
"description",
"title",
{data: ["id"]},
+ {name: "delete-onclick", attr: "onclick"},
{name: "link", attr: "href"},
{name: "service", attr: "data-service"},
{name: "status", attr: "data-status"}]},
JobInput: {item : ` |
|
-
-
- file_download
-
- |
-
`,
+
+
+ file_download
+
+ |
+ `,
valueNames: ["filename",
"id",
{name: "download-link", attr: "href"}]},
@@ -253,14 +263,14 @@ RessourceList.options = {
-
- search
-
-
+
delete
-
- send
+
+ info
+
+
+ search
|
`,
@@ -269,7 +279,7 @@ RessourceList.options = {
"query",
"title",
{data: ["id"]},
- {name: "delete-link", attr: "onclick"},
+ {name: "delete-onclick", attr: "onclick"},
{name: "inspect-link", attr: "href"},
{name: "link", attr: "href"}]},
// User entity blueprint setting html strucuture per entity per row
diff --git a/web/app/templates/admin/user.html.j2 b/web/app/templates/admin/user.html.j2
index 113ef7b8..bbf8204a 100644
--- a/web/app/templates/admin/user.html.j2
+++ b/web/app/templates/admin/user.html.j2
@@ -88,6 +88,28 @@
+
+
+
Confirm corpus deletion
+
Do you really want to delete the corpus ? All files will be permanently deleted!
+
+
+
+
+
+
+
Confirm job deletion
+
Do you really want to delete the job ? All files will be permanently deleted!
+
+
+
+
Confirm user deletion
@@ -103,8 +125,44 @@
{% endblock %}
diff --git a/web/app/templates/main/dashboard.html.j2 b/web/app/templates/main/dashboard.html.j2
index fa45862c..e3f07590 100644
--- a/web/app/templates/main/dashboard.html.j2
+++ b/web/app/templates/main/dashboard.html.j2
@@ -65,6 +65,29 @@
+
+
+
+
Confirm corpus deletion
+
Do you really want to delete the corpus ? All files will be permanently deleted!
+
+
+
+
+
+
+
Confirm job deletion
+
Do you really want to delete the job ? All files will be permanently deleted!
+
+
+
+
Select a service
@@ -107,5 +130,44 @@
var corpusList = new RessourceList("corpora", nopaque.corporaSubscribers,
"Corpus");
var jobList = new RessourceList("jobs", nopaque.jobsSubscribers, "Job");
+ var deleteCorpusModalElement = document.getElementById("delete-corpus-modal");
+ var deleteCorpusModal;
+ var deleteJobModalElement = document.getElementById("delete-job-modal");
+ var deleteJobModal;
+ var selectedCorpusDeleteLinkElement = document.getElementById("selected-corpus-delete-link");
+ var selectedCorpusTitleElement = document.getElementById("selected-corpus-title");
+ var selectedJobDeleteLinkElement = document.getElementById("selected-job-delete-link");
+ var selectedJobTitleElement = document.getElementById("selected-job-title");
+ function prepareDeleteCorpusModal(selectedCorpusId) {
+ var selectedCorpus;
+ if (selectedCorpusId in nopaque.user.corpora) {
+ selectedCorpus = nopaque.user.corpora[selectedCorpusId];
+ selectedCorpusDeleteLinkElement.href = `/corpora/${selectedCorpus.id}/delete`;
+ selectedCorpusTitleElement.innerText = selectedCorpus.title;
+ } else {
+ selectedQueryResult = undefined;
+ selectedCorpusDeleteLinkElement.href = "";
+ selectedCorpusTitleElement.innerText = "";
+ }
+ deleteCorpusModal.open();
+ }
+ function prepareDeleteJobModal(selectedJobId) {
+ var selectedJob;
+ if (selectedJobId in nopaque.user.jobs) {
+ selectedJob = nopaque.user.jobs[selectedJobId];
+ selectedJobDeleteLinkElement.href = `/jobs/${selectedJob.id}/delete`;
+ selectedJobTitleElement.innerText = selectedJob.title;
+ } else {
+ selectedJob = undefined;
+ selectedJobDeleteLinkElement.href = "";
+ selectedJobTitleElement.innerText = "";
+ }
+ deleteJobModal.open();
+ }
+ document.addEventListener("DOMContentLoaded", () => {
+ deleteCorpusModal = M.Modal.init(deleteCorpusModalElement);
+ deleteJobModal = M.Modal.init(deleteJobModalElement);
+ });
+
{% endblock %}
diff --git a/web/app/templates/services/corpus_analysis.html.j2 b/web/app/templates/services/corpus_analysis.html.j2
index 6c34bf02..2067e14c 100644
--- a/web/app/templates/services/corpus_analysis.html.j2
+++ b/web/app/templates/services/corpus_analysis.html.j2
@@ -84,9 +84,20 @@
+
+
+
Confirm corpus deletion
+
Do you really want to delete the corpus ? All files will be permanently deleted!
+
+
+
+
-
Confirm deletion
+
Confirm query result deletion
Do you really want to delete the query result ? It will be permanently deleted.