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

View File

@ -17,16 +17,28 @@
</ul> </ul>
<div class="card-action"> <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="{{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>
</div> </div>
<script type="text/javascript"> </div>
</div>
<script>
var selected_user_id = {{selected_user.id|tojson|safe}} var selected_user_id = {{selected_user.id|tojson|safe}}
socket.emit('connect_admin', selected_user_id); socket.emit('connect_admin', selected_user_id);
</script> </script>
<div class="col s12 m6"> <div class="col s12 m6">
<div id="job-list"> <div id="job-foreign-list">
<div class="card"> <div class="card">
<div class="card-content"> <div class="card-content">
<div class="row"> <div class="row">
@ -47,7 +59,7 @@
</div> </div>
</div> </div>
<script> <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>', item: '<div><span class="title"></span><span class="description"></span></div>',
page: 4, page: 4,
pagination: true, pagination: true,
@ -56,25 +68,35 @@
jobList.on("filterComplete", List.updatePagination); jobList.on("filterComplete", List.updatePagination);
jobList.on("searchComplete", List.updatePagination); jobList.on("searchComplete", List.updatePagination);
</script> </script>
<div class="col s12"> <div class="col s12 m6">
<div class="card large"> <div id="corpus-foreign-list">
<div class="card">
<div class="card-content"> <div class="card-content">
<span class="card-title">Administration actions</span> <div class="row">
<!-- Confirm deletion of selected user with modal dialogue <div class="col s12">
Modal Trigger--> <div class="input-field">
<a href="#modal-confirm-delete" class="waves-effect waves-light btn red modal-trigger"><i class="material-icons left">delete</i>Delete User</a> <i class="material-icons prefix">search</i>
<!-- Modal Strucutre --> <input id="search-job" class="search" type="text"></input>
<div id="modal-confirm-delete" class="modal"> <label for="search-job">Search corpus</label>
<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>
<div class="modal-footer"> </div>
<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">
<ul class="pagination"></ul>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="collection list"></div>
</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 %} {% endblock %}

View File

@ -76,7 +76,7 @@
var subscriber; var subscriber;
foreignCorpora = JSON.parse(msg); foreignCorpora = JSON.parse(msg);
for (subscriber of foreignCorporaSubscribers) {subscriber._init();} for (subscriber of foreignCorporaSubscribers) {subscriber._init(foreignCorpora);}
}); });
@ -84,7 +84,7 @@
var subscriber; var subscriber;
foreignJobs = JSON.parse(msg); 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>
</div> </div>
<script> <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>', item: '<div><span class="title"></span><span class="description"></span></div>',
page: 4, page: 4,
pagination: true, pagination: true,