mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
Add notifications on status changes of jobs and corpora
This commit is contained in:
parent
606c8cf761
commit
7fc1084749
@ -29,7 +29,10 @@ def add_corpus():
|
||||
flash('[ERROR]: Could not add corpus!')
|
||||
corpus.delete()
|
||||
else:
|
||||
flash('Corpus added!')
|
||||
corpus_url = url_for('corpora.corpus', corpus_id=corpus.id)
|
||||
flash('<i class="left material-icons">book</i>'
|
||||
'[<a href="{}">{}</a>] added'.format(corpus_url,
|
||||
corpus.title))
|
||||
return redirect(url_for('corpora.corpus', corpus_id=corpus.id))
|
||||
return render_template('corpora/add_corpus.html.j2',
|
||||
add_corpus_form=add_corpus_form,
|
||||
|
@ -74,7 +74,9 @@ def service(service):
|
||||
db.session.add(job_input)
|
||||
job.status = 'submitted'
|
||||
db.session.commit()
|
||||
flash('Job added!')
|
||||
job_url = url_for('jobs.job', job_id=job.id)
|
||||
flash('<i class="left material-icons">work</i>'
|
||||
'[<a href="{}">{}</a>] added'.format(job_url, job.title))
|
||||
return make_response(
|
||||
{'redirect_url': url_for('jobs.job', job_id=job.id)}, 201)
|
||||
return render_template('services/{}.html.j2'.format(service),
|
||||
|
@ -43,6 +43,13 @@ nopaque.socket.init = function() {
|
||||
var patch;
|
||||
|
||||
patch = JSON.parse(msg);
|
||||
for (operation of patch) {
|
||||
/* "/corpusId/valueName" -> ["corpusId", "valueName"] */
|
||||
pathArray = operation.path.split("/").slice(1);
|
||||
if (operation.op === "replace" && pathArray[1] === "status") {
|
||||
nopaque.flash(`<i class="left material-icons">book</i>[<a href="/jobs/${pathArray[0]}">${nopaque.corpora[pathArray[0]].title}</a>] New status: ${operation.value}`);
|
||||
}
|
||||
}
|
||||
nopaque.corpora = jsonpatch.apply_patch(nopaque.corpora, patch);
|
||||
for (let subscriber of nopaque.corporaSubscribers) {subscriber._update(patch);}
|
||||
});
|
||||
@ -51,6 +58,13 @@ nopaque.socket.init = function() {
|
||||
var patch;
|
||||
|
||||
patch = JSON.parse(msg);
|
||||
for (operation of patch) {
|
||||
/* "/jobId/valueName" -> ["jobId", "valueName"] */
|
||||
pathArray = operation.path.split("/").slice(1);
|
||||
if (operation.op === "replace" && pathArray[1] === "status") {
|
||||
nopaque.flash(`<i class="left material-icons">work</i>[<a href="/jobs/${pathArray[0]}">${nopaque.jobs[pathArray[0]].title}</a>] New status: ${operation.value}`);
|
||||
}
|
||||
}
|
||||
nopaque.jobs = jsonpatch.apply_patch(nopaque.jobs, patch);
|
||||
for (let subscriber of nopaque.jobsSubscribers) {subscriber._update(patch);}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user