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
c7337a52
Commit
c7337a52
authored
5 years ago
by
Stephan Porada
Browse files
Options
Downloads
Patches
Plain Diff
Add first stopping and deletion functions etc.
parent
230d057f
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/auth/views.py
+5
-5
5 additions, 5 deletions
app/auth/views.py
app/models.py
+25
-0
25 additions, 0 deletions
app/models.py
app/templates/main/jobs/job.html.j2
+16
-0
16 additions, 0 deletions
app/templates/main/jobs/job.html.j2
with
46 additions
and
5 deletions
app/auth/views.py
+
5
−
5
View file @
c7337a52
...
...
@@ -4,7 +4,7 @@ from . import auth
from
..
import
db
from
.forms
import
ChangePasswordForm
,
LoginForm
,
PasswordResetForm
,
PasswordResetRequestForm
,
RegistrationForm
,
EditProfileForm
from
..email
import
send_email
from
..models
import
User
from
..models
import
User
,
Job
@auth.route
(
'
/login
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
...
...
@@ -162,11 +162,11 @@ def edit_profile():
)
@auth.route
(
'
/edit_profile/delete_self
/<int:user_id>
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
@auth.route
(
'
/edit_profile/delete_self
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
@login_required
def
delete_self
(
user_id
):
selected_user
=
User
.
query
.
filter_by
(
id
=
user_id
).
first
()
db
.
session
.
delete
(
selected_
user
)
def
delete_self
():
user
=
current_user
db
.
session
.
delete
(
user
)
db
.
session
.
commit
()
flash
(
'
Your account has been deleted!
'
)
return
redirect
(
url_for
(
'
main.index
'
))
This diff is collapsed.
Click to expand it.
app/models.py
+
25
−
0
View file @
c7337a52
...
...
@@ -216,6 +216,15 @@ class User(UserMixin, db.Model):
jobs
[
str
(
job
.
id
)]
=
job
.
to_dict
()
return
jobs
def
delete_user
(
self
,
user_id
):
"""
Delete user from database. Also delete all associated jobs and corpora
files.
"""
user
=
User
.
query
.
filter_by
(
user_id
=
user_id
)
db
.
session
.
delete
(
user
)
db
.
session
.
commit
()
class
AnonymousUser
(
AnonymousUserMixin
):
"""
...
...
@@ -276,6 +285,22 @@ class Job(db.Model):
'
title
'
:
self
.
title
,
'
user_id
'
:
self
.
user_id
}
def
flag_for_stop
(
self
):
"""
Flag running or failed job (anything that is not completed) with
stopping. Opaque daemon will end services flaged with
'
stopping
'
.
"""
self
.
status
=
'
stopping
'
db
.
session
.
commit
()
def
delete_job
(
self
,
job_id
):
"""
Delete job with given job id from database. Also delete associated job
files
"""
# TODO
pass
class
Corpus
(
db
.
Model
):
"""
...
...
This diff is collapsed.
Click to expand it.
app/templates/main/jobs/job.html.j2
+
16
−
0
View file @
c7337a52
...
...
@@ -99,11 +99,27 @@
</script>
<div class="col s12 m4">
<h2>Status:</h2>
<h3 id="title"></h3>
<p id="description"></p>
<a class="waves-effect waves-light btn" id="status"></a>
<h2>Actions:</h2>
<!-- Confirm deletion of selected user with modal dialogue
Modal Trigger-->
<a href="#modal-confirm-delete" class="waves-effect waves-light btn red modal-trigger"><i class="material-icons left">delete</i>Delete Job</a>
<!-- Modal Strucutre -->
<div id="modal-confirm-delete" class="modal">
<div class="modal-content">
<h4>Confirm deletion</h4>
<p>Do you really want to delete the job {{job.title}}?</p>
</div>
<div class="modal-footer">
<a href="{{ url_for('main.delete_job', job_id=job.id) }}" class="modal-close waves-effect waves-green btn red"><i class="material-icons left">delete</i>Delete Job</a></a>
</div>
</div>
</div>
<div class="col s12 m8">
<div class="card">
<div class="card-content">
...
...
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