Add foreign admin views

This commit is contained in:
Stephan Porada 2019-09-18 12:06:34 +02:00
parent daf6c15111
commit 5ad5bc0a2f
4 changed files with 47 additions and 22 deletions

View File

@ -24,6 +24,8 @@ def connect():
' will be used for further information exchange generated by a background
' task associated with the sid.
'''
logger = logging.getLogger(__name__)
logger.warning('[connect] Session id is: {}.'.format(request.sid))
socketio.start_background_task(background_task,
current_app._get_current_object(),
current_user.id,
@ -43,6 +45,7 @@ def connect_admin(selected_user_id):
'''
logger = logging.getLogger(__name__)
logger.warning('Admin emitted "connect_admin".')
logger.warning('[connect_admin] Session id is: {}.'.format(request.sid))
logger.warning('Selected user id is: {}'.format(selected_user_id))
socketio.start_background_task(background_task_foreign,
current_app._get_current_object(),

View File

@ -17,16 +17,28 @@
</ul>
<div class="card-action">
<a href="{{url_for('admin.edit_profile_admin', user_id=selected_user.id)}}" class="waves-effect waves-light btn"><i class="material-icons left">edit</i>Edit user</a>
<a href="#modal-confirm-delete" class="waves-effect waves-light btn red modal-trigger"><i class="material-icons left">delete</i>Delete User</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 current selected user ({{selected_user.username}})?
All associated jobs and job files will be permanently deleted.</p>
</div>
<div class="modal-footer">
<a href="{{url_for('admin.admin_delete_user', user_id=selected_user.id)}}" class="modal-close waves-effect waves-green btn red"><i class="material-icons left">delete</i>Delete User</a></a>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
<script>
var selected_user_id = {{selected_user.id|tojson|safe}}
socket.emit('connect_admin', selected_user_id);
</script>
<div class="col s12 m6">
<div id="job-list">
<div id="job-foreign-list">
<div class="card">
<div class="card-content">
<div class="row">
@ -47,7 +59,7 @@
</div>
</div>
<script>
var jobList = new JobList("job-list", {
var jobList = new JobList("job-foreign-list", foreignJobsSubscribers, {
item: '<div><span class="title"></span><span class="description"></span></div>',
page: 4,
pagination: true,
@ -56,25 +68,35 @@
jobList.on("filterComplete", List.updatePagination);
jobList.on("searchComplete", List.updatePagination);
</script>
<div class="col s12">
<div class="card large">
<div class="card-content">
<span class="card-title">Administration actions</span>
<!-- 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 User</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 current selected user ({{selected_user.username}})?
All associated jobs and job files will be permanently deleted.</p>
</div>
<div class="modal-footer">
<a href="{{url_for('admin.admin_delete_user', user_id=selected_user.id)}}" class="modal-close waves-effect waves-green btn red"><i class="material-icons left">delete</i>Delete User</a></a>
<div class="col s12 m6">
<div id="corpus-foreign-list">
<div class="card">
<div class="card-content">
<div class="row">
<div class="col s12">
<div class="input-field">
<i class="material-icons prefix">search</i>
<input id="search-job" class="search" type="text"></input>
<label for="search-job">Search corpus</label>
</div>
</div>
<div class="col s12">
<ul class="pagination"></ul>
</div>
</div>
</div>
</div>
<div class="collection list"></div>
</div>
</div>
<script>
var corpusList = new CorpusList("corpus-foreign-list", foreignCorpusSubscribers, {
item: '<div><span class="title"></span><span class="description"></span></div>',
page: 4,
pagination: true,
valueNames: ["description", "title", {data: ["id"]}]
});
corpusList.on("filterComplete", List.updatePagination);
corpusList.on("searchComplete", List.updatePagination);
</script>
{% endblock %}

View File

@ -76,7 +76,7 @@
var subscriber;
foreignCorpora = JSON.parse(msg);
for (subscriber of foreignCorporaSubscribers) {subscriber._init();}
for (subscriber of foreignCorporaSubscribers) {subscriber._init(foreignCorpora);}
});
@ -84,7 +84,7 @@
var subscriber;
foreignJobs = JSON.parse(msg);
for (subscriber of foreignJobsSubscribers) {subscriber._init();}
for (subscriber of foreignJobsSubscribers) {subscriber._init(foreignJobs);}
});

View File

@ -31,7 +31,7 @@
</div>
</div>
<script>
var corpusList = new CorpusList("corpus-list", {
var corpusList = new CorpusList("corpus-list", corporaSubscribers ,{
item: '<div><span class="title"></span><span class="description"></span></div>',
page: 4,
pagination: true,