(runtime)
| 446 | } |
| 447 | |
| 448 | function renderAutoQuickRefreshRuntime(runtime) { |
| 449 | const info = runtime || {}; |
| 450 | const logs = Array.isArray(info.logs) ? info.logs : []; |
| 451 | if (logs.length === 0) { |
| 452 | return ` |
| 453 | <div class="auto-quick-refresh-log-title">执行日志</div> |
| 454 | <div class="auto-quick-refresh-log-empty">暂无执行日志</div> |
| 455 | `; |
| 456 | } |
| 457 | const rows = logs |
| 458 | .slice(-20) |
| 459 | .reverse() |
| 460 | .map((item) => { |
| 461 | const levelRaw = String(item?.level || 'info').trim().toLowerCase(); |
| 462 | const level = ['success', 'warning', 'error', 'info'].includes(levelRaw) ? levelRaw : 'info'; |
| 463 | const timeText = formatSchedulerTime(item?.time); |
| 464 | const message = String(item?.message || '').trim() || '-'; |
| 465 | return ` |
| 466 | <div class="auto-quick-refresh-log-item level-${level}"> |
| 467 | <span class="log-time">${escapeHtml(timeText)}</span> |
| 468 | <span class="log-level">${escapeHtml(level)}</span> |
| 469 | <span class="log-message">${escapeHtml(message)}</span> |
| 470 | </div> |
| 471 | `; |
| 472 | }) |
| 473 | .join(''); |
| 474 | return ` |
| 475 | <div class="auto-quick-refresh-log-title">执行日志</div> |
| 476 | <div class="auto-quick-refresh-log-list">${rows}</div> |
| 477 | `; |
| 478 | } |
| 479 | |
| 480 | function updateAutoQuickRefreshButton() { |
| 481 | const btn = elements.autoQuickRefreshSettingsBtn; |
no test coverage detected