new editor features
This commit is contained in:
@@ -459,6 +459,7 @@
|
||||
let activeInterval = null;
|
||||
// Only auto-poll if we have a latest run
|
||||
let currentRunId = {{ active_run.id if active_run else 'null' }};
|
||||
const initialRunStatus = "{{ active_run.status if active_run else '' }}";
|
||||
|
||||
function fetchLog() {
|
||||
if (!currentRunId) return;
|
||||
@@ -509,8 +510,9 @@
|
||||
} else {
|
||||
if (activeInterval) clearInterval(activeInterval);
|
||||
activeInterval = null;
|
||||
// Reload page on completion to show download buttons
|
||||
if (data.status === 'completed' && !document.querySelector('.alert-success')) {
|
||||
|
||||
// Reload if we were polling (watched it finish) OR if page loaded as running but is now done
|
||||
if (initialRunStatus === 'running' || initialRunStatus === 'queued') {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,6 +260,7 @@
|
||||
|
||||
<script>
|
||||
const runId = {{ run.id }};
|
||||
const initialStatus = "{{ run.status }}";
|
||||
const consoleEl = document.getElementById('console-log');
|
||||
const statusText = document.getElementById('status-text');
|
||||
const statusBar = document.getElementById('status-bar');
|
||||
@@ -297,6 +298,11 @@
|
||||
// Poll if running
|
||||
if (data.status === 'running' || data.status === 'queued') {
|
||||
setTimeout(updateLog, 2000);
|
||||
} else {
|
||||
// If the run was active when we loaded the page, reload now that it's finished to show artifacts
|
||||
if (initialStatus === 'running' || initialStatus === 'queued') {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(err => console.error(err));
|
||||
|
||||
Reference in New Issue
Block a user