feat: show next continuous run on dashboard
This commit is contained in:
@@ -524,6 +524,7 @@ function renderContinuous(accountId, data) {
|
|||||||
panel.querySelector('.continuous-last-iteration').textContent = status.last_iteration_at
|
panel.querySelector('.continuous-last-iteration').textContent = status.last_iteration_at
|
||||||
? `${relativeTime(status.last_iteration_at)} (${displayTime(status.last_iteration_at)})`
|
? `${relativeTime(status.last_iteration_at)} (${displayTime(status.last_iteration_at)})`
|
||||||
: '-';
|
: '-';
|
||||||
|
panel.querySelector('.continuous-next-run').textContent = nextContinuousRunLabel(config, status);
|
||||||
panel.querySelector('.continuous-last-error').textContent = status.last_error || '-';
|
panel.querySelector('.continuous-last-error').textContent = status.last_error || '-';
|
||||||
|
|
||||||
// Logs
|
// Logs
|
||||||
@@ -596,6 +597,19 @@ function normalizeLogEntry(entry) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function nextContinuousRunLabel(config, status) {
|
||||||
|
if (!config.enabled) return '-';
|
||||||
|
if (status.running) return 'running now';
|
||||||
|
const baseValue = status.last_iteration_at || status.last_finished_at || status.last_started_at;
|
||||||
|
if (!baseValue) return 'pending';
|
||||||
|
const baseDate = new Date(baseValue);
|
||||||
|
if (Number.isNaN(baseDate.getTime())) return 'pending';
|
||||||
|
const intervalMs = Math.max(1, Number(config.interval_minutes || 1)) * 60 * 1000;
|
||||||
|
const nextDate = new Date(baseDate.getTime() + intervalMs);
|
||||||
|
if (nextDate.getTime() <= Date.now()) return 'due now';
|
||||||
|
return displayTime(nextDate.toISOString());
|
||||||
|
}
|
||||||
|
|
||||||
function renderSummary(accountId, data) {
|
function renderSummary(accountId, data) {
|
||||||
const panel = document.getElementById(`panel-${accountId}`);
|
const panel = document.getElementById(`panel-${accountId}`);
|
||||||
if (!panel) return;
|
if (!panel) return;
|
||||||
|
|||||||
@@ -259,6 +259,7 @@
|
|||||||
<div class="continuous-meta">
|
<div class="continuous-meta">
|
||||||
<div>Status: <span class="continuous-status">-</span></div>
|
<div>Status: <span class="continuous-status">-</span></div>
|
||||||
<div>Last run: <span class="continuous-last-iteration">-</span></div>
|
<div>Last run: <span class="continuous-last-iteration">-</span></div>
|
||||||
|
<div>Next run: <span class="continuous-next-run">-</span></div>
|
||||||
<div>Last error: <span class="continuous-last-error">-</span></div>
|
<div>Last error: <span class="continuous-last-error">-</span></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user