From 611bb6ef6234cc023669e9d83749813d1266ee10 Mon Sep 17 00:00:00 2001
From: Patrick Jentsch
Date: Wed, 12 Feb 2020 12:19:54 +0100
Subject: [PATCH] Change RessourceList
---
app/static/js/nopaque.lists.js | 95 ++++++++------
app/templates/admin/user.html.j2 | 5 +-
app/templates/jobs/job.html.j2 | 121 +++++++-----------
app/templates/main/dashboard.html.j2 | 5 +-
.../services/corpus_analysis.html.j2 | 3 +-
5 files changed, 109 insertions(+), 120 deletions(-)
diff --git a/app/static/js/nopaque.lists.js b/app/static/js/nopaque.lists.js
index ba61b8d4..683f36e1 100644
--- a/app/static/js/nopaque.lists.js
+++ b/app/static/js/nopaque.lists.js
@@ -1,7 +1,13 @@
class RessourceList extends List {
- constructor(idOrElement, subscriberList, dataMapper=null, options={}) {
- super(idOrElement, {...RessourceList.options, ...options});
- this.dataMapper = dataMapper;
+ constructor(idOrElement, subscriberList, type, options={}) {
+ if (!['corpus', 'job'].includes(type)) {
+ console.error("Unknown Type!");
+ return;
+ }
+ super(idOrElement, {...RessourceList.options['common'],
+ ...RessourceList.options[type],
+ ...options});
+ this.type = type;
subscriberList.push(this);
}
@@ -43,19 +49,15 @@ class RessourceList extends List {
addRessources(ressources) {
- if (this.dataMapper) {
- this.add(ressources.map(x => this.dataMapper(x)));
- } else {
- this.add(ressources);
- }
+ this.add(ressources.map(x => RessourceList.dataMapper[this.type](x)));
}
}
RessourceList.dataMapper = {
corpus: corpus => ({creation_date: corpus.creation_date,
description: corpus.description,
id: corpus.id,
- link: `/corpora/${corpus.id}`,
- service: "corpus",
+ "analyse-link": `/corpora/${corpus.id}/analyse`,
+ "edit-link": `/corpora/${corpus.id}`,
status: corpus.status,
title: corpus.title}),
job: job => ({creation_date: job.creation_date,
@@ -67,32 +69,53 @@ RessourceList.dataMapper = {
title: job.title})
};
RessourceList.options = {
- item: `
-
-
-
-
- |
-
-
-
- |
-
-
- |
-
- Viewsend
- |
-
`,
- page: 4,
- pagination: {innerWindow: 8, outerWindow: 1},
- valueNames: ["creation_date",
- "description",
- "title",
- {data: ["id"]},
- {name: "link", attr: "href"},
- {name: "service", attr: "data-service"},
- {name: "status", attr: "data-status"}]};
+ common: {page: 4, pagination: {innerWindow: 8, outerWindow: 1}},
+ corpus: {item: `
+
+
+ book
+
+ |
+
+
+
+ |
+
+
+ |
+
+ edit
+ Analysesearch
+ |
+
`,
+ valueNames: ["creation_date", "description", "title",
+ {data: ["id"]},
+ {name: "analyse-link", attr: "href"},
+ {name: "edit-link", attr: "href"},
+ {name: "status", attr: "data-status"}]},
+ job: {item: `
+
+
+
+
+ |
+
+
+
+ |
+
+
+ |
+
+ Viewsend
+ |
+
`,
+ valueNames: ["creation_date", "description", "title",
+ {data: ["id"]},
+ {name: "link", attr: "href"},
+ {name: "service", attr: "data-service"},
+ {name: "status", attr: "data-status"}]}
+};
class ResultList extends List {
diff --git a/app/templates/admin/user.html.j2 b/app/templates/admin/user.html.j2
index d50bf843..e4e24b6f 100644
--- a/app/templates/admin/user.html.j2
+++ b/app/templates/admin/user.html.j2
@@ -103,8 +103,9 @@
{% endblock %}
diff --git a/app/templates/jobs/job.html.j2 b/app/templates/jobs/job.html.j2
index ed01f3eb..f4a3eb7f 100644
--- a/app/templates/jobs/job.html.j2
+++ b/app/templates/jobs/job.html.j2
@@ -73,85 +73,50 @@
deleteDelete Job
-
-
-
Input and result files
-
-
-
-
-
-
Filewise
-
-
-
- Filename |
- Download |
-
-
-
- {% for input in job.inputs %}
-
- {{ input.filename }} |
-
-
- file_download
-
- |
-
- {% endfor %}
-
-
-
-
-
-
-
-
-
-
Bundled
-
-
-
- Bundlename |
- Download |
-
-
-
-
-
-
-
-
-
-
-
-
-
Files
-
-
-
- Filename |
- Download |
-
-
-
- {% for input in job.inputs %}
-
- {{ input.filename }} |
-
-
- file_download
-
- |
- |
-
- {% endfor %}
-
-
-
-
+
+ -
+
+
+
+
+
+ Bundlename |
+ Download |
+
+
+
+
+
+
+ -
+
+
+
+
+
+ Filename |
+ Download |
+
+
+
+ {% for input in job.inputs %}
+
+ {{ input.filename }} |
+
+
+ file_download
+
+ |
+
+ {% endfor %}
+
+
+
+
+
diff --git a/app/templates/main/dashboard.html.j2 b/app/templates/main/dashboard.html.j2
index 08b51221..1ca22117 100644
--- a/app/templates/main/dashboard.html.j2
+++ b/app/templates/main/dashboard.html.j2
@@ -89,7 +89,8 @@
{% endblock %}
diff --git a/app/templates/services/corpus_analysis.html.j2 b/app/templates/services/corpus_analysis.html.j2
index c3a6d0b3..4d9280c6 100644
--- a/app/templates/services/corpus_analysis.html.j2
+++ b/app/templates/services/corpus_analysis.html.j2
@@ -38,7 +38,6 @@
{% endblock %}