Merge branch 'development' of gitlab.ub.uni-bielefeld.de:sfb1288inf/opaque into development

This commit is contained in:
Patrick Jentsch 2019-11-06 15:44:10 +01:00
commit 414ebc73ff
5 changed files with 38 additions and 3 deletions

View File

@ -54,12 +54,14 @@ def corpus(corpus_id):
def corpus_analysis(corpus_id):
logger = logging.getLogger(__name__)
corpus = Corpus.query.get_or_404(corpus_id)
corpus.status = 'start analysis'
query = request.args.get('query')
logger.warning('Query first: {}'.format(query))
hits_per_page = request.args.get('hits_per_page', 30)
context = request.args.get('context', 10)
dl_form = QueryDownloadForm()
form = QueryForm(hits_per_page=hits_per_page, context=context, query=query)
db.session.commit()
if form.validate_on_submit():
logger = logging.getLogger(__name__)
logger.warning('Data has been sent!')

View File

@ -442,6 +442,7 @@ class Corpus(db.Model):
status = db.Column(db.String(16))
title = db.Column(db.String(32))
user_id = db.Column(db.Integer, db.ForeignKey('users.id'))
analysis_ip = db.Column(db.String(16))
# Relationships
files = db.relationship('CorpusFile',
backref='corpus',

View File

@ -83,4 +83,6 @@ CorpusList.STATUS_COLORS = {"unprepared": "grey",
"preparable": "orange",
"preparing": "yellow",
"prepared": "green",
"default": "red"};
"start analysis": "yellow",
"analysing": "green",
"stop analysis": "red", "default": "red"};

View File

@ -61,11 +61,13 @@
statusElement.classList.remove(...Object.values(CorpusList.STATUS_COLORS));
statusElement.classList.add(CorpusList.STATUS_COLORS[status] || CorpusList.STATUS_COLORS['default']);
statusElement.innerText = status;
if (status === 'prepared') {
if (status === 'prepared' || status === 'start analysis' || status === 'analysing') {
var analyseBtn = document.getElementById('analyse');
analyseBtn.classList.remove('hide');
}
if (status === 'prepared' || status === 'start analysis' || status === 'analysing') {
var prepareBtn = document.getElementById('prepare');
prepareBtn.classList.add('hide')
prepareBtn.classList.add('hide');
}
}
}

View File

@ -0,0 +1,28 @@
"""empty message
Revision ID: 0aa38a7973c5
Revises: 1210adfe1e34
Create Date: 2019-11-06 09:33:46.296653
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '0aa38a7973c5'
down_revision = '1210adfe1e34'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('corpora', sa.Column('analysis_ip', sa.String(length=16), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('corpora', 'analysis_ip')
# ### end Alembic commands ###