diff --git a/static/index.html b/static/index.html index 0ce491f..8b34749 100644 --- a/static/index.html +++ b/static/index.html @@ -487,32 +487,63 @@ function renderJobsTable(inst) { header += ''; let rows = ''; for (const j of jobs) { - const isDisabled = strIsFalse(j.schedule_enabled) || strIsStopped(j.state); + const scheduleEnabled = strIsFalse(j.schedule_enabled) ? false : true; + const stateStopped = strIsStopped(j.state); + const isDisabled = !scheduleEnabled || stateStopped; + const pts = j.restore_points_to_keep != null ? j.restore_points_to_keep : (j.restorePointsToKeep != null ? j.restorePointsToKeep : null); const actual = j.actual_restore_points != null ? j.actual_restore_points : null; let ptsDisplay = '—'; if (pts !== null || actual !== null) { ptsDisplay = actual !== null ? (pts !== null ? pts + ' / ' + actual : actual + ' (actual)') : (pts + ' (max)'); } + + let stateBadge = stateStopped ? '' + (j.state || 'stopped') + '' : ''; + + let scheduleBadge = ''; + if (!scheduleEnabled) { + scheduleBadge = 'расписание откл'; + } else if (stateStopped) { + scheduleBadge = 'вкл, но stopped'; + } else { + scheduleBadge = 'включено'; + } + + let statusDisplay = stateStopped + ? (scheduleEnabled ? 'вкл, но ' + (j.state || 'stopped') + '' : 'расписание откл') + : (scheduleEnabled ? 'включено' : 'расписание откл'); + rows += ''; rows += '' + esc(j.name || j.Name || '—') + ''; rows += '' + esc(j.type || j.jobType || '—') + ''; rows += '' + ptsDisplay + ''; rows += '' + formatDate(j.last_backup) + ''; - rows += '' + (isDisabled ? 'выключена' : 'включена') + ''; + rows += '' + statusDisplay + ''; rows += ''; } - let html = header + '
' + rows + '
ИмяТипТочки восст.Последний бэкапРасписание
'; + let html = header + '
' + rows + '
ИмяТипТочки восст.Последний бэкапРасписаниеState
'; const policies = inst.agent_policies || []; if (policies.length) { html += '

Агентские политики

'; html += '
'; for (const p of policies) { - const isDisabled = strIsFalse(p.schedule_enabled) || strIsStopped(p.state); + const scheduleEnabled = strIsFalse(p.schedule_enabled) ? false : true; + const stateStopped = strIsStopped(p.state); + const isDisabled = !scheduleEnabled || stateStopped; + + let scheduleBadge = ''; + if (!scheduleEnabled) { + scheduleBadge = 'расписание откл'; + } else if (stateStopped) { + scheduleBadge = 'stopped'; + } else { + scheduleBadge = 'включено'; + } + html += ''; html += ''; html += ''; - html += ''; + html += ''; html += ''; } html += '
ИмяТипРасписание
' + esc(p.name || p.Name || '—') + '' + esc(p.type || p.jobType || '—') + '' + (isDisabled ? 'выключена' : 'включена') + '' + scheduleBadge + '
';