Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odevzdávací Systém MO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Commits
9405aa0b
Commit
9405aa0b
authored
4 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Stránka s detaily jobu
parent
336084a3
No related branches found
No related tags found
3 merge requests
!19
Reforma vyhodnocování práv
,
!18
Dávky okolo feedbacku
,
!17
Výsledkovka pomocí mo.web.table
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
mo/web/org_jobs.py
+21
-0
21 additions, 0 deletions
mo/web/org_jobs.py
mo/web/templates/org_job.html
+33
-0
33 additions, 0 deletions
mo/web/templates/org_job.html
mo/web/templates/org_jobs.html
+2
-0
2 additions, 0 deletions
mo/web/templates/org_jobs.html
with
56 additions
and
0 deletions
mo/web/org_jobs.py
+
21
−
0
View file @
9405aa0b
...
...
@@ -50,6 +50,27 @@ def org_jobs():
)
@app.route
(
'
/org/jobs/<int:id>/
'
)
def
org_job
(
id
:
int
):
sess
=
db
.
get_session
()
job
=
sess
.
query
(
db
.
Job
).
options
(
joinedload
(
db
.
Job
.
user
)).
get
(
id
)
if
job
is
None
:
return
werkzeug
.
exceptions
.
NotFound
()
if
not
(
job
.
user_id
==
g
.
user
.
user_id
or
g
.
user
.
is_org
):
return
werkzeug
.
exceptions
.
Forbidden
()
has_errors
=
(
job
.
state
==
db
.
JobState
.
failed
and
isinstance
(
job
.
out_json
,
dict
)
and
'
errors
'
in
job
.
out_json
)
return
render_template
(
'
org_job.html
'
,
job
=
job
,
db
=
db
,
has_errors
=
has_errors
,
)
@app.route
(
'
/org/jobs/<int:id>/output
'
)
def
org_job_output
(
id
:
int
):
sess
=
db
.
get_session
()
...
...
This diff is collapsed.
Click to expand it.
mo/web/templates/org_job.html
0 → 100644
+
33
−
0
View file @
9405aa0b
{% extends "base.html" %}
{% block head %}
<meta
http-equiv=
refresh
content=
30
>
{% endblock %}
{% block body %}
<h2>
Dávka #{{ job.job_id }}
</h2>
<table
class=
data
>
<tr><th>
Název
<td>
{{ job.description }}
<tr><th>
Vlastník
<td>
{{ job.user.full_name() }}
<tr><th>
Stav
<td>
{{ job.state.friendly_name() }}
<tr><th>
Zpráva
<td>
{{ job.result|or_dash }}
<tr><th>
Vytvořena
<td>
{{ job.created_at|time_and_timedelta }}
<tr><th>
Dokončena
<td>
{{ job.finished_at|time_and_timedelta }}
<tr><th>
Vyprší
<td>
{{ job.expires_at|time_and_timedelta }}
</table>
{% if has_errors %}
<h3>
Chyby
</h3>
<pre><div
class=
"alert alert-danger"
role=
"alert"
>
{{ "" -}}
{% for e in job.out_json['errors'] %}
{{ e }}
{% endfor %}
</div></pre>
{% endif %}
{% if job.out_file %}
<a
class=
'btn btn-xs btn-primary'
href=
'{{ url_for('
org_job_output
',
id=
job.job_id)
}}'
>
Stáhnout výstup
</a>
{% endif %}
{% endblock %}
This diff is collapsed.
Click to expand it.
mo/web/templates/org_jobs.html
+
2
−
0
View file @
9405aa0b
...
...
@@ -31,11 +31,13 @@ dávku po stažení výstupu smažete sami – šetří to místo na serveru.
<td>
{{ j.description }}
<td>
{{ j.created_at|timeformat }}
<td><b>
{{ j.state.friendly_name() }}
</b>
{% if j.finished_at != None %} {{ j.finished_at|timedelta }}{% endif %}
{%- if j.result != "" %}
<br>
{{ j.result }}{% endif %}
<td>
{% if j.expires_at %}{{ j.expires_at|timedelta}}{% endif %}
{% if g.user.is_admin %}
<td>
{{ j.user.full_name() }}{% endif %}
<td>
<div
class=
'btn-group'
><form
action=
""
method=
"POST"
class=
"btn-group"
>
{{ form_delete_job.csrf_token() }}
<a
class=
'btn btn-xs btn-primary'
href=
'{{ url_for('
org_job
',
id=
j.job_id)
}}'
>
Detail
</a>
{% if j.out_file %}
<a
class=
'btn btn-xs btn-primary'
href=
'{{ url_for('
org_job_output
',
id=
j.job_id)
}}'
>
Výsledek
</a>
{% endif %}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment