Add roadmap and use just one template

This commit is contained in:
Patrick Jentsch
2020-02-07 15:21:59 +01:00
parent 3ce28de053
commit acf5ae32ae
35 changed files with 256 additions and 131 deletions

View File

@ -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)