diff --git a/app/jobs/forms.py b/app/jobs/forms.py index 19958cf7..82e574b6 100644 --- a/app/jobs/forms.py +++ b/app/jobs/forms.py @@ -67,7 +67,7 @@ class AddOCRJobForm(FlaskForm): ) -class AddMergeImagesJobForm(FlaskForm): +class AddSetupFilesJobForm(FlaskForm): description = StringField('Description', validators=[DataRequired(), Length(1, 255)]) submit = SubmitField() diff --git a/app/services/views.py b/app/services/views.py index 85418202..aa2cd485 100644 --- a/app/services/views.py +++ b/app/services/views.py @@ -1,5 +1,5 @@ from app import db -from app.jobs.forms import AddNLPJobForm, AddOCRJobForm, AddMergeImagesJobForm +from app.jobs.forms import AddNLPJobForm, AddOCRJobForm, AddSetupFilesJobForm from app.models import Job, JobInput from flask import (abort, current_app, flash, make_response, render_template, url_for) @@ -10,9 +10,10 @@ import json import os -SERVICES = {'merge_images': {'name': 'Convert images', +SERVICES = {'corpus_analysis': {'name': 'Corpus analysis'}, + 'setup_files': {'name': 'Setup files', 'resources': {'mem_mb': 4096, 'n_cores': 4}, - 'add_job_form': AddMergeImagesJobForm}, + 'add_job_form': AddSetupFilesJobForm}, 'nlp': {'name': 'Natural Language Processing', 'resources': {'mem_mb': 4096, 'n_cores': 2}, 'add_job_form': AddNLPJobForm}, @@ -26,6 +27,9 @@ SERVICES = {'merge_images': {'name': 'Convert images', def service(service): if service not in SERVICES: abort(404) + if service == 'corpus_analysis': + return render_template('services/{}.html.j2'.format(service), + title=SERVICES[service]['name']) add_job_form = SERVICES[service]['add_job_form']() if add_job_form.is_submitted(): if not add_job_form.validate(): @@ -70,5 +74,6 @@ def service(service): return make_response( {'redirect_url': url_for('jobs.job', job_id=job.id)}, 201) return render_template('services/{}.html.j2'.format(service), + roadmap=True, title=SERVICES[service]['name'], add_job_form=add_job_form) diff --git a/app/static/images/logo_-_dfg.gif b/app/static/images/logo_-_dfg.gif new file mode 100644 index 00000000..68d87e67 Binary files /dev/null and b/app/static/images/logo_-_dfg.gif differ diff --git a/app/static/images/logo_-_sfb_1288.png b/app/static/images/logo_-_sfb_1288.png new file mode 100644 index 00000000..debc1421 Binary files /dev/null and b/app/static/images/logo_-_sfb_1288.png differ diff --git a/app/static/images/logo_dfg.png b/app/static/images/logo_dfg.png deleted file mode 100644 index 410208cc..00000000 Binary files a/app/static/images/logo_dfg.png and /dev/null differ diff --git a/app/static/images/logo_sfb_1288.png b/app/static/images/logo_sfb_1288.png deleted file mode 100644 index 7239cc9d..00000000 Binary files a/app/static/images/logo_sfb_1288.png and /dev/null differ diff --git a/app/static/js/nopaque.js b/app/static/js/nopaque.js index af0ab098..15b284c3 100644 --- a/app/static/js/nopaque.js +++ b/app/static/js/nopaque.js @@ -80,11 +80,23 @@ nopaque.forms.init = function() { nopaque.navigation = {}; nopaque.navigation.init = function() { - for (let entry of document.querySelectorAll("#slide-out a:not(.subheader)")) { + var slideOutElement, tocElement; + + slideOutElement = document.getElementById("slide-out"); + for (let entry of slideOutElement.querySelectorAll("a:not(.subheader)")) { if (entry.href === window.location.href) { entry.parentNode.classList.add("active"); } } + tocElement = document.getElementById("roadmap"); + if (!tocElement) { + return + } + for (let entry of tocElement.querySelectorAll("a")) { + if (entry.href === window.location.href) { + entry.classList.add("active"); + } + } } diff --git a/app/static/js/nopaque.lists.js b/app/static/js/nopaque.lists.js index 41b0fad3..5daaa43e 100644 --- a/app/static/js/nopaque.lists.js +++ b/app/static/js/nopaque.lists.js @@ -7,7 +7,8 @@ class RessourceList extends List { _init(ressources) { - this.addRessources(Object.values(ressources)); + this.add(Object.values(ressources)); + this.sort("creation_date", {order: "desc"}); } @@ -20,7 +21,7 @@ class RessourceList extends List { switch(operation.op) { case "add": if (pathArray.includes("results")) {break;} - this.addRessources([operation.value]); + this.add([operation.value]); break; case "remove": this.remove("id", pathArray[0]); @@ -41,27 +42,29 @@ class RessourceList extends List { } - addRessources(ressources) { + add(ressources) { if (this.dataMapper) { - this.add(ressources.map(x => this.dataMapper(x))); + super.add(ressources.map(x => this.dataMapper(x))); } else { - this.add(ressources); + super.add(ressources); } } } RessourceList.dataMapper = { - corpus: corpus => ({description: corpus.description, - id: corpus.id, - link: `/corpora/${corpus.id}`, - service: "corpus", - status: corpus.status, - title: corpus.title}), - job: job => ({description: job.description, - id: job.id, - link: `/jobs/${job.id}`, - service: job.service, - status: job.status, - title: job.title}) + corpus: corpus => ({creation_date: corpus.creation_date, + description: corpus.description, + id: corpus.id, + link: `/corpora/${corpus.id}`, + service: "corpus", + status: corpus.status, + title: corpus.title}), + job: job => ({creation_date: job.creation_date, + description: job.description, + id: job.id, + link: `/jobs/${job.id}`, + service: job.service, + status: job.status, + title: job.title}) }; RessourceList.options = { item: ` @@ -83,7 +86,8 @@ RessourceList.options = { `, page: 4, pagination: {innerWindow: 8, outerWindow: 1}, - valueNames: ["description", + valueNames: ["creation_date", + "description", "title", {data: ["id"]}, {name: "link", attr: "href"}, diff --git a/app/templates/403.html.j2 b/app/templates/403.html.j2 index 5381a3de..c7036333 100644 --- a/app/templates/403.html.j2 +++ b/app/templates/403.html.j2 @@ -1,4 +1,7 @@ -{% extends "limited_width.html.j2" %} +{% extends "nopaque.html.j2" %} + +{% set full_width = False %} +{% set roadmap = False %} {% block page_content %}