- Dashboard com 5 gráficos Chart.js (execuções, status, custo, agentes, pipelines) - Sistema de notificações com polling, badge e Browser Notification API - Relatórios MD automáticos para execuções de agentes e pipelines (data/reports/) - Lucide local (v0.475.0) com nomes de ícones atualizados e refreshIcons centralizado - Correção de ícones icon-only (padding CSS sobrescrito por btn-sm) - Cards de agentes e pipelines com botões alinhados na base (flex column) - Terminal com busca, download, cópia e auto-scroll toggle - Histórico com export CSV, retry, paginação e truncamento de texto - Webhooks com edição e teste inline - Duplicação de agentes e export/import JSON - Rate limiting, CORS, correlação de requests e health check no backend - Escrita atômica em JSON (temp + rename) e store de notificações - Tema claro/escuro com toggle e persistência em localStorage - Atalhos de teclado 1-9 para navegação entre seções
41 lines
1.0 KiB
JavaScript
41 lines
1.0 KiB
JavaScript
const Utils = {
|
|
escapeHtml(str) {
|
|
if (str === null || str === undefined) return '';
|
|
return String(str)
|
|
.replace(/&/g, '&')
|
|
.replace(/</g, '<')
|
|
.replace(/>/g, '>')
|
|
.replace(/"/g, '"')
|
|
.replace(/'/g, ''');
|
|
},
|
|
|
|
formatDuration(ms) {
|
|
if (!ms || ms < 0) return '—';
|
|
if (ms < 1000) return `${ms}ms`;
|
|
if (ms < 60000) return `${(ms / 1000).toFixed(1)}s`;
|
|
const m = Math.floor(ms / 60000);
|
|
const s = Math.floor((ms % 60000) / 1000);
|
|
return `${m}m ${s}s`;
|
|
},
|
|
|
|
formatCost(usd) {
|
|
if (!usd || usd === 0) return '$0.0000';
|
|
return `$${Number(usd).toFixed(4)}`;
|
|
},
|
|
|
|
truncate(str, max = 80) {
|
|
if (!str) return '';
|
|
return str.length > max ? str.slice(0, max) + '…' : str;
|
|
},
|
|
|
|
refreshIcons(container) {
|
|
if (!window.lucide) return;
|
|
const target = container || document;
|
|
const pending = target.querySelectorAll('i[data-lucide]');
|
|
if (pending.length === 0) return;
|
|
lucide.createIcons();
|
|
},
|
|
};
|
|
|
|
window.Utils = Utils;
|