mirror of
https://github.com/ComputerScienceHouse/proxstar.git
synced 2025-02-14 22:11:51 +00:00
Allow admins to cleanup vnc sessions with a button
Puts a button on the "settings" page that will run the 'cleanup vnc sessions' task manually. Useful for debugging, or if something is really busted.
This commit is contained in:
parent
50855e3712
commit
509ea616fc
3 changed files with 34 additions and 1 deletions
|
@ -568,6 +568,8 @@ def settings():
|
|||
templates=templates,
|
||||
ignored_pools=db_ignored_pools,
|
||||
allowed_users=db_allowed_users,
|
||||
vnc_cleanup_token=app.config['VNC_CLEANUP_TOKEN'],
|
||||
server_name=app.config['SERVER_NAME']
|
||||
)
|
||||
else:
|
||||
return abort(403)
|
||||
|
|
|
@ -627,6 +627,31 @@ $(".add-ignored-pool").click(function(){
|
|||
});
|
||||
});
|
||||
|
||||
$("#generate-pool-cache-task-button").click(function(){
|
||||
|
||||
});
|
||||
|
||||
$("#process-expiring-vms-task-button").click(function(){
|
||||
});
|
||||
|
||||
$("#cleanup-vnc-task-button").click(function(){
|
||||
const vncCleanupToken = $(this).data('vnc_cleanup_token');
|
||||
// let data = {'token': vncCleanupToken};
|
||||
|
||||
console.log(vncCleanupToken);
|
||||
|
||||
var formData = new FormData();
|
||||
formData.append('token', vncCleanupToken);
|
||||
fetch(`/console/cleanup`, {
|
||||
method: 'post',
|
||||
credentials: 'same-origin',
|
||||
body: formData
|
||||
}).then(res => {
|
||||
console.log("Request complete! response:", res);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function change_for_template(obj) {
|
||||
var template_element = obj;
|
||||
var selected = template_element.options[template_element.selectedIndex].value;
|
||||
|
@ -653,7 +678,6 @@ $("#console-vm").click(function(){
|
|||
return response.json()
|
||||
}).then((vnc_params) => {
|
||||
// TODO (willnilges): encrypt=true
|
||||
// TODO (willnilges): set host and port to an env variable
|
||||
window.open(`/static/noVNC/vnc.html?autoconnect=true&password=${vnc_params.password}&host=${vnc_params.host}&port=${vnc_params.port}&path=path?token=${vnc_params.token}`, '_blank');
|
||||
}).catch(err => {
|
||||
if (err) {
|
||||
|
|
|
@ -113,6 +113,13 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
|
||||
|
||||
<button class="btn btn-secondary" id="generate-pool-cache-task-button" name="generate-pool-cache-task-button" >GENERATE POOL CACHE</button>
|
||||
<button class="btn btn-secondary" id="process-expiring-vms-task-button" name="process-expiring-vms-task-button">PROCESS EXPIRING VMS</button>
|
||||
<button class="btn btn-secondary" id="cleanup-vnc-task-button" name="cleanup-vnc-task-button" data-vnc_cleanup_token="{{ vnc_cleanup_token }}" data-server_name="{{ server_name }}">CLEANUP VNC SESSIONS</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue