Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nopaque
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
6e20e00c
Commit
6e20e00c
authored
5 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Patches
Plain Diff
Change models
parent
3dad22d4
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/models.py
+2
-8
2 additions, 8 deletions
app/models.py
app/templates/jobs/job.html.j2
+32
-62
32 additions, 62 deletions
app/templates/jobs/job.html.j2
migrations/versions/6227310c2112_.py
+30
-0
30 additions, 0 deletions
migrations/versions/6227310c2112_.py
with
64 additions
and
70 deletions
app/models.py
+
2
−
8
View file @
6e20e00c
...
@@ -246,9 +246,6 @@ class JobInput(db.Model):
...
@@ -246,9 +246,6 @@ class JobInput(db.Model):
filename
=
db
.
Column
(
db
.
String
(
255
))
filename
=
db
.
Column
(
db
.
String
(
255
))
dir
=
db
.
Column
(
db
.
String
(
255
))
dir
=
db
.
Column
(
db
.
String
(
255
))
job_id
=
db
.
Column
(
db
.
Integer
,
db
.
ForeignKey
(
'
jobs.id
'
))
job_id
=
db
.
Column
(
db
.
Integer
,
db
.
ForeignKey
(
'
jobs.id
'
))
# Relationships
results
=
db
.
relationship
(
'
JobResult
'
,
backref
=
'
job_input
'
,
lazy
=
'
dynamic
'
,
cascade
=
'
save-update, merge, delete
'
)
def
__repr__
(
self
):
def
__repr__
(
self
):
"""
"""
...
@@ -260,8 +257,7 @@ class JobInput(db.Model):
...
@@ -260,8 +257,7 @@ class JobInput(db.Model):
return
{
'
id
'
:
self
.
id
,
return
{
'
id
'
:
self
.
id
,
'
dir
'
:
self
.
dir
,
'
dir
'
:
self
.
dir
,
'
filename
'
:
self
.
filename
,
'
filename
'
:
self
.
filename
,
'
job_id
'
:
self
.
job_id
,
'
job_id
'
:
self
.
job_id
}
'
results
'
:
[
result
.
to_dict
()
for
result
in
self
.
results
]}
class
JobResult
(
db
.
Model
):
class
JobResult
(
db
.
Model
):
...
@@ -274,7 +270,6 @@ class JobResult(db.Model):
...
@@ -274,7 +270,6 @@ class JobResult(db.Model):
filename
=
db
.
Column
(
db
.
String
(
255
))
filename
=
db
.
Column
(
db
.
String
(
255
))
dir
=
db
.
Column
(
db
.
String
(
255
))
dir
=
db
.
Column
(
db
.
String
(
255
))
job_id
=
db
.
Column
(
db
.
Integer
,
db
.
ForeignKey
(
'
jobs.id
'
))
job_id
=
db
.
Column
(
db
.
Integer
,
db
.
ForeignKey
(
'
jobs.id
'
))
job_input_id
=
db
.
Column
(
db
.
Integer
,
db
.
ForeignKey
(
'
job_inputs.id
'
))
def
__repr__
(
self
):
def
__repr__
(
self
):
"""
"""
...
@@ -286,8 +281,7 @@ class JobResult(db.Model):
...
@@ -286,8 +281,7 @@ class JobResult(db.Model):
return
{
'
id
'
:
self
.
id
,
return
{
'
id
'
:
self
.
id
,
'
dir
'
:
self
.
dir
,
'
dir
'
:
self
.
dir
,
'
filename
'
:
self
.
filename
,
'
filename
'
:
self
.
filename
,
'
job_id
'
:
self
.
job_id
,
'
job_id
'
:
self
.
job_id
}
'
job_input_id
'
:
self
.
job_input_id
}
class
Job
(
db
.
Model
):
class
Job
(
db
.
Model
):
...
...
This diff is collapsed.
Click to expand it.
app/templates/jobs/job.html.j2
+
32
−
62
View file @
6e20e00c
...
@@ -76,7 +76,7 @@
...
@@ -76,7 +76,7 @@
<h4>Input and result files</h4>
<h4>Input and result files</h4>
</div>
</div>
<div class="col s12 m
8
">
<div class="col s12 m
7
">
<div class="card">
<div class="card">
<div class="card-content">
<div class="card-content">
<span class="card-title">Filewise</span>
<span class="card-title">Filewise</span>
...
@@ -85,10 +85,9 @@
...
@@ -85,10 +85,9 @@
<tr>
<tr>
<th>Filename</th>
<th>Filename</th>
<th>Download</th>
<th>Download</th>
<th>Result</th>
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody
id="inputs"
>
{% for input in job.inputs %}
{% for input in job.inputs %}
<tr>
<tr>
<td id="input-{{ input.id }}-filename">{{ input.filename }}</td>
<td id="input-{{ input.id }}-filename">{{ input.filename }}</td>
...
@@ -97,7 +96,6 @@
...
@@ -97,7 +96,6 @@
<i class="material-icons">file_download</i>
<i class="material-icons">file_download</i>
</a>
</a>
</td>
</td>
<td id="input-{{ input.id }}-results"></td>
</tr>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</tbody>
...
@@ -106,7 +104,7 @@
...
@@ -106,7 +104,7 @@
</div>
</div>
</div>
</div>
<div class="col s12 m
4
">
<div class="col s12 m
5
">
<div class="card">
<div class="card">
<div class="card-content">
<div class="card-content">
<span class="card-title">Bundled</span>
<span class="card-title">Bundled</span>
...
@@ -117,40 +115,7 @@
...
@@ -117,40 +115,7 @@
<th>Download</th>
<th>Download</th>
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody id="results"></tbody>
<tr>
<td>AIO-Bundle</td>
<td>
<a class="waves-effect waves-light btn-small" download href="">
<i class="material-icons">file_download</i>
</a>
</td>
</tr>
<tr>
<td>PDF-Bundle</td>
<td>
<a class="waves-effect waves-light btn" download href="">
<i class="material-icons">file_download</i>
</a>
</td>
</tr>
<tr>
<td>TXT-Bundle</td>
<td>
<a class="waves-effect waves-light btn" download href="">
<i class="material-icons">file_download</i>
</a>
</td>
</tr>
<tr>
<td>XML-Bundle</td>
<td>
<a class="waves-effect waves-light btn" download href="">
<i class="material-icons">file_download</i>
</a>
</td>
</tr>
</tbody>
</table>
</table>
</div>
</div>
</div>
</div>
...
@@ -166,7 +131,6 @@
...
@@ -166,7 +131,6 @@
<tr>
<tr>
<th>Filename</th>
<th>Filename</th>
<th>Download</th>
<th>Download</th>
<th>Results</th>
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody>
...
@@ -228,12 +192,8 @@
...
@@ -228,12 +192,8 @@
this.setStatus(job.status);
this.setStatus(job.status);
// End date
// End date
if (job.end_date) {this.setEndDate(job.end_date);}
if (job.end_date) {this.setEndDate(job.end_date);}
// Input results
// Results
for (let input of job.inputs) {
if (job.results) {this.setResults(job.results);}
for (let result of input.results) {
this.setResult(result);
}
}
}
}
_update(patch) {
_update(patch) {
...
@@ -245,7 +205,7 @@
...
@@ -245,7 +205,7 @@
if (pathArray[0] != this.jobId) {continue;}
if (pathArray[0] != this.jobId) {continue;}
switch(operation.op) {
switch(operation.op) {
case "add":
case "add":
if (pathArray[1] ===
"inputs" && pathArray[3] ===
"results") {
if (pathArray[1] === "results") {
this.setResult(operation.value);
this.setResult(operation.value);
}
}
break;
break;
...
@@ -277,22 +237,32 @@
...
@@ -277,22 +237,32 @@
M.updateTextFields();
M.updateTextFields();
}
}
setResult(result) {
setResults(results) {
let resultsElement, resultDownloadButtonElement,
let resultElement, resultsElement, resultDownloadElement,
resultDownloadButtonIconElement;
resultDownloadButtonElement, resultDownloadButtonIconElement,
resultTitleElement;
resultsElement = document.getElementById("results");
resultsElement = document.getElementById(`input-${result.job_input_id}-results`);
for (let result of results) {
resultDownloadButtonElement = document.createElement("a");
resultElement = document.createElement("tr");
resultDownloadButtonElement.classList.add("waves-effect", "waves-light", "btn-small");
resultTitleElement = document.createElement("td");
resultDownloadButtonElement.href = `/jobs/${this.jobId}/results/${result.id}/download`;
resultTitleElement.innerText = result.filename;
resultDownloadButtonElement.innerText = result.filename.split(".").reverse()[0];
resultElement.append(resultTitleElement);
resultDownloadButtonElement.setAttribute("download", "");
resultDownloadElement = document.createElement("td");
resultDownloadButtonIconElement = document.createElement("i");
resultDownloadButtonElement = document.createElement("a");
resultDownloadButtonIconElement.classList.add("material-icons", "left");
resultDownloadButtonElement.classList.add("waves-effect", "waves-light",
resultDownloadButtonIconElement.innerText = "file_download";
"btn-small");
resultDownloadButtonElement.prepend(resultDownloadButtonIconElement);
resultDownloadButtonElement.href = `/jobs/${result.job_id}/results/${result.id}/download`;
resultsElement.append(resultDownloadButtonElement);
resultDownloadButtonElement.setAttribute("download", "");
resultsElement.append(" ");
resultDownloadButtonIconElement = document.createElement("i");
resultDownloadButtonIconElement.classList.add("material-icons");
resultDownloadButtonIconElement.innerText = "file_download";
resultDownloadButtonElement.append(resultDownloadButtonIconElement);
resultDownloadElement.append(resultDownloadButtonElement)
resultElement.append(resultDownloadElement);
resultsElement.append(resultElement);
}
}
}
setStatus(status) {
setStatus(status) {
...
...
This diff is collapsed.
Click to expand it.
migrations/versions/6227310c2112_.py
0 → 100644
+
30
−
0
View file @
6e20e00c
"""
empty message
Revision ID: 6227310c2112
Revises: ded5a37f8a7b
Create Date: 2020-01-30 09:28:06.770159
"""
from
alembic
import
op
import
sqlalchemy
as
sa
# revision identifiers, used by Alembic.
revision
=
'
6227310c2112
'
down_revision
=
'
ded5a37f8a7b
'
branch_labels
=
None
depends_on
=
None
def
upgrade
():
# ### commands auto generated by Alembic - please adjust! ###
op
.
drop_constraint
(
'
job_results_job_input_id_fkey
'
,
'
job_results
'
,
type_
=
'
foreignkey
'
)
op
.
drop_column
(
'
job_results
'
,
'
job_input_id
'
)
# ### end Alembic commands ###
def
downgrade
():
# ### commands auto generated by Alembic - please adjust! ###
op
.
add_column
(
'
job_results
'
,
sa
.
Column
(
'
job_input_id
'
,
sa
.
INTEGER
(),
autoincrement
=
False
,
nullable
=
True
))
op
.
create_foreign_key
(
'
job_results_job_input_id_fkey
'
,
'
job_results
'
,
'
job_inputs
'
,
[
'
job_input_id
'
],
[
'
id
'
])
# ### end Alembic commands ###
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