update automation status ever 1s
This commit is contained in:
parent
d97b3d1846
commit
05b5c376e9
1 changed files with 8 additions and 1 deletions
|
|
@ -43432,7 +43432,7 @@ function renderAutomationCard(a) {
|
||||||
const metaParts = [];
|
const metaParts = [];
|
||||||
if (a.last_run) metaParts.push('Last: ' + _autoTimeAgo(a.last_run));
|
if (a.last_run) metaParts.push('Last: ' + _autoTimeAgo(a.last_run));
|
||||||
const _timerTriggers = ['schedule', 'daily_time', 'weekly_time'];
|
const _timerTriggers = ['schedule', 'daily_time', 'weekly_time'];
|
||||||
if (a.next_run && a.enabled && _timerTriggers.includes(a.trigger_type)) metaParts.push('Next: ' + _autoTimeUntil(a.next_run));
|
if (a.next_run && a.enabled && _timerTriggers.includes(a.trigger_type)) metaParts.push('<span class="auto-next-run" data-next="' + _escAttr(a.next_run) + '">Next: ' + _autoTimeUntil(a.next_run) + '</span>');
|
||||||
if (!_timerTriggers.includes(a.trigger_type) && a.enabled) metaParts.push('Listening');
|
if (!_timerTriggers.includes(a.trigger_type) && a.enabled) metaParts.push('Listening');
|
||||||
if (a.run_count) metaParts.push('<span class="auto-runs-link" onclick="event.stopPropagation(); showAutomationHistory(' + a.id + ', \'' + _escAttr(a.name) + '\')" title="View run history">Runs: ' + a.run_count + '</span>');
|
if (a.run_count) metaParts.push('<span class="auto-runs-link" onclick="event.stopPropagation(); showAutomationHistory(' + a.id + ', \'' + _escAttr(a.name) + '\')" title="View run history">Runs: ' + a.run_count + '</span>');
|
||||||
if (a.last_error) metaParts.push('Error: ' + _esc(a.last_error));
|
if (a.last_error) metaParts.push('Error: ' + _esc(a.last_error));
|
||||||
|
|
@ -43534,6 +43534,13 @@ function _autoTimeUntil(ts) {
|
||||||
return 'in ' + Math.round(d/86400) + 'd';
|
return 'in ' + Math.round(d/86400) + 'd';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- Live countdown for "Next: in Xs" ---
|
||||||
|
setInterval(() => {
|
||||||
|
document.querySelectorAll('.auto-next-run[data-next]').forEach(el => {
|
||||||
|
el.textContent = 'Next: ' + _autoTimeUntil(el.dataset.next);
|
||||||
|
});
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
// --- CRUD ---
|
// --- CRUD ---
|
||||||
|
|
||||||
async function deleteAutomation(id, name) {
|
async function deleteAutomation(id, name) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue