mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 02:24:20 +00:00
smaller rework while getting an overview
This commit is contained in:
parent
9c9790be89
commit
ab21768311
@ -1,5 +1,5 @@
|
||||
from flask import flash, redirect, render_template, url_for
|
||||
from flask_login import current_user, login_required
|
||||
from flask_login import login_required
|
||||
from . import admin
|
||||
from .forms import EditGeneralSettingsAdminForm
|
||||
from .. import db
|
||||
@ -12,13 +12,7 @@ from ..settings import tasks as settings_tasks
|
||||
@login_required
|
||||
@admin_required
|
||||
def users():
|
||||
users = User.query.all()
|
||||
users = [dict(username=u.username,
|
||||
email=u.email,
|
||||
role_id=u.role_id,
|
||||
confirmed=u.confirmed,
|
||||
id=u.id)
|
||||
for u in users]
|
||||
users = [user.to_dict() for user in User.query.all()]
|
||||
return render_template('admin/users.html.j2', title='Users', users=users)
|
||||
|
||||
|
||||
|
@ -145,17 +145,18 @@ class User(UserMixin, db.Model):
|
||||
'email': self.email,
|
||||
'last_seen': self.last_seen.timestamp(),
|
||||
'member_since': self.member_since.timestamp(),
|
||||
'username': self.username,
|
||||
'settings': {'dark_mode': self.setting_dark_mode,
|
||||
'job_status_mail_notifications':
|
||||
self.setting_job_status_mail_notifications,
|
||||
'job_status_site_notifications':
|
||||
self.setting_job_status_site_notifications},
|
||||
'username': self.username,
|
||||
'corpora': {corpus.id: corpus.to_dict()
|
||||
for corpus in self.corpora},
|
||||
'jobs': {job.id: job.to_dict() for job in self.jobs},
|
||||
'query_results': {query_result.id: query_result.to_dict()
|
||||
for query_result in self.query_results}}
|
||||
for query_result in self.query_results},
|
||||
'role': self.role.to_dict()}
|
||||
|
||||
def __repr__(self):
|
||||
'''
|
||||
@ -334,6 +335,7 @@ class Job(db.Model):
|
||||
end_date = db.Column(db.DateTime())
|
||||
mem_mb = db.Column(db.Integer)
|
||||
n_cores = db.Column(db.Integer)
|
||||
# This is used for zip creation
|
||||
secure_filename = db.Column(db.String(32))
|
||||
service = db.Column(db.String(64))
|
||||
'''
|
||||
@ -413,16 +415,14 @@ class Job(db.Model):
|
||||
'description': self.description,
|
||||
'end_date': (self.end_date.timestamp() if self.end_date else
|
||||
None),
|
||||
'inputs': {input.id: input.to_dict() for input in self.inputs},
|
||||
'mem_mb': self.mem_mb,
|
||||
'n_cores': self.n_cores,
|
||||
'results': {result.id: result.to_dict()
|
||||
for result in self.results},
|
||||
'service': self.service,
|
||||
'service_args': self.service_args,
|
||||
'service_version': self.service_version,
|
||||
'service': {'args': self.service_args,
|
||||
'name': self.service,
|
||||
'version': self.service_version},
|
||||
'status': self.status,
|
||||
'title': self.title}
|
||||
'title': self.title,
|
||||
'inputs': {input.id: input.to_dict() for input in self.inputs},
|
||||
'results': {result.id: result.to_dict()
|
||||
for result in self.results}}
|
||||
|
||||
|
||||
class NotificationData(db.Model):
|
||||
|
@ -131,7 +131,7 @@ RessourceList.dataMappers = {
|
||||
email: user.email,
|
||||
id: user.id,
|
||||
link: `users/${user.id}`,
|
||||
role_id: user.role_id,
|
||||
role: user.role.name,
|
||||
username: user.username,
|
||||
username2: user.username,
|
||||
"delete-link": `/admin/users/${user.id}/delete`,
|
||||
@ -388,11 +388,10 @@ RessourceList.options = {
|
||||
},
|
||||
User: {
|
||||
item: `<tr>
|
||||
<td class="id"></td>
|
||||
<td class="username"></td>
|
||||
<td class="email"></td>
|
||||
<td class="role_id"></td>
|
||||
<td class="confirmed"></td>
|
||||
<td class="id"></td>
|
||||
<td class="role"></td>
|
||||
<td>
|
||||
<div class="right-align">
|
||||
<a class="btn-floating modal-trigger red tooltipped waves-effect waves-light delete-modal-trigger" data-position="top" data-tooltip="Delete">
|
||||
@ -418,8 +417,7 @@ RessourceList.options = {
|
||||
"username",
|
||||
"username2",
|
||||
"email",
|
||||
"role_id",
|
||||
"confirmed",
|
||||
"role",
|
||||
"id",
|
||||
{name: "link", attr: "href"},
|
||||
{name: "delete-link", attr: "href"},
|
||||
|
@ -19,16 +19,14 @@
|
||||
<table class="highlight responsive-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="sort" data-sort="id">Id</th>
|
||||
<th class="sort" data-sort="username">Username</th>
|
||||
<th class="sort" data-sort="email">Email</th>
|
||||
<th class="sort" data-sort="role_id">Role</th>
|
||||
<th class="sort" data-sort="confirmed">Confirmed Status</th>
|
||||
<th class="sort" data-sort="id">Id</th>
|
||||
<th>{# Actions #}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="list">
|
||||
</tbody>
|
||||
<tbody class="list"></tbody>
|
||||
</table>
|
||||
<ul class="pagination paginationBottom"></ul>
|
||||
</div>
|
||||
@ -43,6 +41,6 @@
|
||||
<script type="module">
|
||||
import {RessourceList} from '{{ url_for('static', filename='js/nopaque.lists.js') }}';
|
||||
let userList = new RessourceList('users', null, "User", RessourceList.options.extended);
|
||||
userList._add({{ users|tojson}});
|
||||
userList._add({{ users|tojson }});
|
||||
</script>
|
||||
{% endblock scripts %}
|
||||
|
Loading…
Reference in New Issue
Block a user