feat(dashboard): drop /api/agents and /api/activity endpoints
This commit is contained in:
@@ -155,33 +155,6 @@
|
||||
color: #818cf8;
|
||||
}
|
||||
|
||||
.status-section-icon.agents {
|
||||
background: rgba(168, 85, 247, 0.15);
|
||||
color: #a855f7;
|
||||
}
|
||||
|
||||
.agents-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.agent-chip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
padding: var(--space-2) var(--space-3);
|
||||
background: var(--bg-elevated);
|
||||
border-radius: var(--radius-md);
|
||||
font-size: var(--text-xs);
|
||||
}
|
||||
|
||||
.agent-chip .emoji { font-size: 14px; }
|
||||
.agent-chip .name { font-weight: 500; color: var(--text-primary); }
|
||||
.agent-chip .status { color: var(--text-muted); }
|
||||
.agent-chip.active { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.3); }
|
||||
.agent-chip.active .status { color: #22c55e; }
|
||||
|
||||
.status-section-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
@@ -426,121 +399,6 @@
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
/* Activity panel */
|
||||
.activity-panel .panel-header {
|
||||
background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
|
||||
}
|
||||
|
||||
.activity-panel .panel-title svg {
|
||||
color: #8b5cf6;
|
||||
}
|
||||
|
||||
.activity-section {
|
||||
margin-bottom: var(--space-4);
|
||||
}
|
||||
|
||||
.activity-section-title {
|
||||
font-size: var(--text-xs);
|
||||
font-weight: 600;
|
||||
color: var(--text-muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
margin-bottom: var(--space-2);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.activity-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--space-3);
|
||||
padding: var(--space-2) var(--space-3);
|
||||
border-radius: var(--radius-md);
|
||||
margin-bottom: var(--space-1);
|
||||
transition: background var(--transition-fast);
|
||||
}
|
||||
|
||||
.activity-item:hover {
|
||||
background: var(--bg-elevated);
|
||||
}
|
||||
|
||||
.activity-icon {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 50%;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.activity-icon.done, .activity-icon.task {
|
||||
background: rgba(34, 197, 94, 0.2);
|
||||
color: #22c55e;
|
||||
}
|
||||
|
||||
.activity-icon.running {
|
||||
background: rgba(59, 130, 246, 0.2);
|
||||
color: #3b82f6;
|
||||
}
|
||||
|
||||
.activity-icon.cron {
|
||||
background: rgba(168, 85, 247, 0.2);
|
||||
color: #a855f7;
|
||||
}
|
||||
|
||||
.activity-icon.git {
|
||||
background: rgba(249, 115, 22, 0.2);
|
||||
color: #f97316;
|
||||
}
|
||||
|
||||
.activity-icon.git-file {
|
||||
background: rgba(234, 179, 8, 0.2);
|
||||
color: #eab308;
|
||||
}
|
||||
|
||||
.activity-icon.file {
|
||||
background: rgba(20, 184, 166, 0.2);
|
||||
color: #14b8a6;
|
||||
}
|
||||
|
||||
.activity-icon svg {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
.activity-type {
|
||||
font-size: var(--text-xs);
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
background: var(--bg-surface);
|
||||
}
|
||||
|
||||
.activity-content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.activity-text {
|
||||
font-size: var(--text-sm);
|
||||
color: var(--text-primary);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.activity-meta {
|
||||
font-size: var(--text-xs);
|
||||
color: var(--text-muted);
|
||||
display: flex;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.activity-agent {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
height: 4px;
|
||||
background: var(--bg-elevated);
|
||||
@@ -1231,29 +1089,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Activity Panel -->
|
||||
<div class="panel activity-panel" id="activityPanel">
|
||||
<div class="panel-header" onclick="toggleSection('activityPanel')">
|
||||
<div class="panel-header-left">
|
||||
<div class="panel-title">
|
||||
<span>Activity</span>
|
||||
</div>
|
||||
<span class="panel-count" id="activityCount">0</span>
|
||||
</div>
|
||||
<div class="panel-header-right" onclick="event.stopPropagation()">
|
||||
<button class="btn btn-icon" onclick="refreshActivity()" title="Refresh">
|
||||
<i data-lucide="refresh-cw"></i>
|
||||
</button>
|
||||
<i data-lucide="chevron-down" class="panel-toggle" onclick="event.stopPropagation(); toggleSection('activityPanel')"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body" id="activityBody">
|
||||
<div class="empty-state">
|
||||
<i data-lucide="loader"></i>
|
||||
<p>Se încarcă...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
@@ -1451,7 +1286,6 @@
|
||||
|
||||
// Data
|
||||
let issuesData = null;
|
||||
let activityData = [];
|
||||
let currentFilter = 'all';
|
||||
let collapsedPriorities = new Set(['backlog', 'done']);
|
||||
|
||||
@@ -1728,42 +1562,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function loadAgentsStatus() {
|
||||
try {
|
||||
const response = await fetch('/echo/api/agents?' + Date.now());
|
||||
if (!response.ok) throw new Error('API error');
|
||||
const data = await response.json();
|
||||
|
||||
const agents = data.agents || [];
|
||||
const activeCount = agents.filter(a => a.active).length;
|
||||
|
||||
// Update badge
|
||||
const badge = document.getElementById('agentsBadge');
|
||||
badge.textContent = `${activeCount}/${agents.length}`;
|
||||
badge.className = 'status-badge ' + (activeCount > 0 ? 'ok' : 'warning');
|
||||
|
||||
// Update subtitle
|
||||
const subtitle = document.getElementById('agentsSubtitle');
|
||||
const activeNames = agents.filter(a => a.active).map(a => a.name).join(', ');
|
||||
subtitle.textContent = activeCount > 0 ? `Activi: ${activeNames}` : 'Niciun agent activ';
|
||||
|
||||
// Update grid
|
||||
const grid = document.getElementById('agentsGrid');
|
||||
grid.innerHTML = agents.map(agent => `
|
||||
<div class="agent-chip ${agent.active ? 'active' : ''}">
|
||||
<span class="emoji">${agent.emoji || '🤖'}</span>
|
||||
<span class="name">${agent.name}</span>
|
||||
<span class="status">${agent.active ? '●' : '○'}</span>
|
||||
</div>
|
||||
`).join('');
|
||||
|
||||
} catch (e) {
|
||||
console.log('Agents status error:', e);
|
||||
document.getElementById('agentsBadge').textContent = '-';
|
||||
document.getElementById('agentsSubtitle').textContent = 'Nu se poate încărca';
|
||||
}
|
||||
}
|
||||
|
||||
function updateStatusSummary() {
|
||||
const gitBadge = document.getElementById('gitBadge');
|
||||
const anafBadge = document.getElementById('anafBadge');
|
||||
@@ -2063,115 +1861,6 @@
|
||||
document.getElementById('issuesCount').textContent = todoCount;
|
||||
}
|
||||
|
||||
async function loadActivity() {
|
||||
try {
|
||||
// Fetch from unified activity API
|
||||
const response = await fetch('/echo/api/activity?t=' + Date.now());
|
||||
const data = await response.json();
|
||||
|
||||
if (data.error) throw new Error(data.error);
|
||||
|
||||
activityData = (data.activities || []).map(a => ({
|
||||
type: a.type,
|
||||
icon: a.icon || 'activity',
|
||||
text: a.text,
|
||||
agent: a.agent || 'Echo',
|
||||
time: a.time,
|
||||
timestamp: a.timestamp,
|
||||
status: a.status,
|
||||
path: a.path
|
||||
}));
|
||||
|
||||
} catch (e) {
|
||||
console.error('Failed to load activity:', e);
|
||||
activityData = [];
|
||||
}
|
||||
|
||||
renderActivity();
|
||||
document.getElementById('activityCount').textContent = activityData.length;
|
||||
}
|
||||
|
||||
function formatActivityTime(timestamp) {
|
||||
if (!timestamp) return '';
|
||||
const date = new Date(timestamp);
|
||||
if (isNaN(date.getTime())) return timestamp;
|
||||
|
||||
const now = new Date();
|
||||
const isToday = date.toDateString() === now.toDateString();
|
||||
|
||||
if (isToday) {
|
||||
return date.toLocaleTimeString('ro-RO', { hour: '2-digit', minute: '2-digit' });
|
||||
} else {
|
||||
return date.toLocaleDateString('ro-RO', { day: 'numeric', month: 'short' }) +
|
||||
' ' + date.toLocaleTimeString('ro-RO', { hour: '2-digit', minute: '2-digit' });
|
||||
}
|
||||
}
|
||||
|
||||
function refreshActivity() {
|
||||
loadActivity();
|
||||
showToast('Activitate reîmprospătată');
|
||||
}
|
||||
|
||||
function renderActivity() {
|
||||
const body = document.getElementById('activityBody');
|
||||
|
||||
if (activityData.length === 0) {
|
||||
body.innerHTML = `
|
||||
<div class="empty-state">
|
||||
<i data-lucide="inbox"></i>
|
||||
<p>Nicio activitate recentă</p>
|
||||
</div>
|
||||
`;
|
||||
lucide.createIcons();
|
||||
return;
|
||||
}
|
||||
|
||||
const today = new Date().toLocaleDateString('ro-RO', { day: 'numeric', month: 'short' });
|
||||
|
||||
// Group by type for better display
|
||||
const typeLabels = {
|
||||
'cron': '⏰ Cron Jobs',
|
||||
'git': '📦 Git Commits',
|
||||
'git-file': '🔸 Git Changes',
|
||||
'file': '📄 Fișiere',
|
||||
'task': '✅ Task-uri'
|
||||
};
|
||||
|
||||
body.innerHTML = `
|
||||
<div class="activity-section">
|
||||
<div class="activity-section-title">
|
||||
<i data-lucide="activity"></i>
|
||||
Ultimele 24h
|
||||
</div>
|
||||
${activityData.map(item => {
|
||||
let clickAttr = '';
|
||||
if (item.type === 'git-file' && item.path) {
|
||||
clickAttr = `onclick="window.open('files.html#${item.path}', '_blank')" style="cursor:pointer"`;
|
||||
} else if (item.path) {
|
||||
clickAttr = `onclick="window.open('files.html#${item.path}', '_blank')" style="cursor:pointer"`;
|
||||
} else if (item.type === 'git' && item.commitHash) {
|
||||
clickAttr = `onclick="window.open('https://gitea.romfast.ro/romfast/clawd/commit/${item.commitHash}', '_blank')" style="cursor:pointer"`;
|
||||
}
|
||||
return `
|
||||
<div class="activity-item" ${clickAttr}>
|
||||
<div class="activity-icon ${item.type}">
|
||||
<i data-lucide="${item.icon || 'activity'}"></i>
|
||||
</div>
|
||||
<div class="activity-content">
|
||||
<div class="activity-text">${item.type === 'git' && item.commitHash ? `<code style="font-size:10px;margin-right:4px">${item.commitHash}</code>` : ''}${item.text}</div>
|
||||
<div class="activity-meta">
|
||||
<span class="activity-type">${typeLabels[item.type] || item.type}</span>
|
||||
<span class="activity-agent">${item.agent}</span>
|
||||
<span>${item.time}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`}).join('')}
|
||||
</div>
|
||||
`;
|
||||
lucide.createIcons();
|
||||
}
|
||||
|
||||
function renderIssues() {
|
||||
const body = document.getElementById('issuesBody');
|
||||
|
||||
@@ -2488,7 +2177,6 @@
|
||||
loadStatus();
|
||||
loadIssues();
|
||||
loadTodos();
|
||||
loadActivity();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user