mirror of
https://github.com/stellarshenson/stellars-jupyterhub-ds.git
synced 2026-03-07 21:50:28 +00:00
debug: add console logging to custom handlers for troubleshooting
- Add console.log statements to track button clicks and API calls - Log username, base URL, and button existence on page load - Log success/error responses from API calls - Help diagnose why restart server button does nothing
This commit is contained in:
@@ -3,7 +3,7 @@ PROJECT_NAME="stellars-jupyterhub-ds"
|
||||
PROJECT_DESCRIPTION="Multi-user JupyterHub 4 deployment platform with data science stack, GPU auto-detection, NativeAuthenticator, and isolated per-user environments spawned via DockerSpawner"
|
||||
|
||||
# Version
|
||||
VERSION="2.11.38_cuda-12.9.1_jh-5.4.2"
|
||||
VERSION="2.11.39_cuda-12.9.1_jh-5.4.2"
|
||||
VERSION_COMMENT="Jupyterhub with GPU auto-detection, NativeAuthenticator, and DockerSpawner configuration and new build system"
|
||||
|
||||
# Author
|
||||
|
||||
@@ -177,11 +177,21 @@
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
const username = "{{ user.name }}";
|
||||
console.log('[Custom Handlers] Page loaded, username:', username);
|
||||
console.log('[Custom Handlers] Base URL:', '{{ base_url }}');
|
||||
|
||||
// Helper function to get cookie value
|
||||
function getCookie(name) {
|
||||
const value = `; ${document.cookie}`;
|
||||
const parts = value.split(`; ${name}=`);
|
||||
if (parts.length === 2) return parts.pop().split(';').shift();
|
||||
}
|
||||
|
||||
// Reset Home Volume handler
|
||||
$('#confirm-reset-btn').on('click', function() {
|
||||
const apiUrl = `{{ base_url }}api/users/${username}/reset-home-volume`;
|
||||
const $btn = $(this);
|
||||
console.log('[Reset Volume] Button clicked, URL:', apiUrl);
|
||||
|
||||
// Disable button and show loading state
|
||||
$btn.prop('disabled', true).text('Resetting...');
|
||||
@@ -193,11 +203,13 @@
|
||||
'X-XSRFToken': getCookie('_xsrf')
|
||||
},
|
||||
success: function(response) {
|
||||
console.log('[Reset Volume] Success:', response);
|
||||
$('#reset-volume-modal').modal('hide');
|
||||
alert('Home volume successfully reset. Your home directory will be recreated on next server start.');
|
||||
location.reload();
|
||||
},
|
||||
error: function(xhr) {
|
||||
console.log('[Reset Volume] Error:', xhr.status, xhr.responseText);
|
||||
$('#reset-volume-modal').modal('hide');
|
||||
const errorMsg = xhr.responseJSON?.message || xhr.statusText || 'Failed to reset volume';
|
||||
alert(`Error: ${errorMsg}`);
|
||||
@@ -210,6 +222,7 @@
|
||||
$('#confirm-restart-btn').on('click', function() {
|
||||
const apiUrl = `{{ base_url }}api/users/${username}/restart-server`;
|
||||
const $btn = $(this);
|
||||
console.log('[Restart Server] Button clicked, URL:', apiUrl);
|
||||
|
||||
// Disable button and show loading state
|
||||
$btn.prop('disabled', true).text('Restarting...');
|
||||
@@ -221,6 +234,7 @@
|
||||
'X-XSRFToken': getCookie('_xsrf')
|
||||
},
|
||||
success: function(response) {
|
||||
console.log('[Restart Server] Success:', response);
|
||||
$('#restart-server-modal').modal('hide');
|
||||
alert('Server successfully restarted. Redirecting to your server...');
|
||||
// Wait a moment for restart to complete, then redirect
|
||||
@@ -229,6 +243,7 @@
|
||||
}, 2000);
|
||||
},
|
||||
error: function(xhr) {
|
||||
console.log('[Restart Server] Error:', xhr.status, xhr.responseText);
|
||||
$('#restart-server-modal').modal('hide');
|
||||
const errorMsg = xhr.responseJSON?.message || xhr.statusText || 'Failed to restart server';
|
||||
alert(`Error: ${errorMsg}`);
|
||||
@@ -237,12 +252,11 @@
|
||||
});
|
||||
});
|
||||
|
||||
// Helper function to get cookie value
|
||||
function getCookie(name) {
|
||||
const value = `; ${document.cookie}`;
|
||||
const parts = value.split(`; ${name}=`);
|
||||
if (parts.length === 2) return parts.pop().split(';').shift();
|
||||
}
|
||||
// Debug: Check if buttons exist
|
||||
console.log('[Custom Handlers] Restart button exists:', $('#restart-server-btn').length > 0);
|
||||
console.log('[Custom Handlers] Reset button exists:', $('#reset-home-volume-btn').length > 0);
|
||||
console.log('[Custom Handlers] Confirm restart button exists:', $('#confirm-restart-btn').length > 0);
|
||||
console.log('[Custom Handlers] Confirm reset button exists:', $('#confirm-reset-btn').length > 0);
|
||||
});
|
||||
</script>
|
||||
{% endblock script %}
|
||||
|
||||
Reference in New Issue
Block a user