claw-code/.guardrails/web/index.html

269 lines
9.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Team Manager Dashboard</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: #f5f5f5;
color: #333;
line-height: 1.6;
}
.container {
max-width: 1400px;
margin: 0 auto;
padding: 20px;
}
header {
background: #2c3e50;
color: white;
padding: 20px;
border-radius: 8px;
margin-bottom: 20px;
}
header h1 {
font-size: 24px;
margin-bottom: 5px;
}
.project-selector {
margin: 20px 0;
}
select {
padding: 10px;
font-size: 16px;
border: 1px solid #ddd;
border-radius: 4px;
width: 300px;
}
.dashboard {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
gap: 20px;
}
.card {
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.card h2 {
font-size: 18px;
margin-bottom: 15px;
color: #2c3e50;
}
.status-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 10px;
margin-top: 15px;
}
.status-item {
text-align: center;
padding: 15px;
border-radius: 4px;
}
.status-not_started { background: #ecf0f1; }
.status-active { background: #3498db; color: white; }
.status-completed { background: #2ecc71; color: white; }
.team-list {
margin-top: 15px;
}
.team-item {
padding: 15px;
border-bottom: 1px solid #ecf0f1;
display: flex;
justify-content: space-between;
align-items: center;
}
.team-item:last-child { border-bottom: none; }
.team-name { font-weight: 500; }
.team-phase {
font-size: 12px;
color: #7f8c8d;
}
.badge {
padding: 4px 8px;
border-radius: 12px;
font-size: 12px;
font-weight: 500;
}
.badge-not_started { background: #95a5a6; color: white; }
.badge-active { background: #3498db; color: white; }
.badge-completed { background: #2ecc71; color: white; }
.metrics {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 15px;
}
.metric {
background: #ecf0f1;
padding: 15px;
border-radius: 4px;
text-align: center;
}
.metric-value {
font-size: 32px;
font-weight: bold;
color: #2c3e50;
}
.metric-label {
font-size: 12px;
color: #7f8c8d;
text-transform: uppercase;
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>Team Manager Dashboard</h1>
<p>View and manage team assignments across all projects</p>
</header>
<div class="project-selector">
<label for="project">Select Project:</label>
<select id="project" onchange="loadProject()">
<option value="">-- Select a project --</option>
</select>
</div>
<div id="dashboard" class="dashboard" style="display: none;">
<div class="card">
<h2>Project Overview</h2>
<div class="metrics">
<div class="metric">
<div class="metric-value" id="total-teams">0</div>
<div class="metric-label">Total Teams</div>
</div>
<div class="metric">
<div class="metric-value" id="active-teams">0</div>
<div class="metric-label">Active</div>
</div>
<div class="metric">
<div class="metric-value" id="completed-teams">0</div>
<div class="metric-label">Completed</div>
</div>
<div class="metric">
<div class="metric-value" id="completion-rate">0%</div>
<div class="metric-label">Completion Rate</div>
</div>
</div>
</div>
<div class="card">
<h2>Phase Status</h2>
<div class="status-grid">
<div class="status-item status-not_started">
<div class="metric-value" id="phase1-count">0</div>
<div>Phase 1</div>
</div>
<div class="status-item status-active">
<div class="metric-value" id="phase2-count">0</div>
<div>Phase 2</div>
</div>
<div class="status-item status-completed">
<div class="metric-value" id="phase3-count">0</div>
<div>Phase 3</div>
</div>
</div>
</div>
<div class="card" style="grid-column: 1 / -1;">
<h2>Teams</h2>
<div id="team-list" class="team-list">
<!-- Teams loaded dynamically -->
</div>
</div>
</div>
<div id="no-project" style="text-align: center; padding: 60px; color: #7f8c8d;">
<p>Select a project to view team assignments</p>
</div>
</div>
<script>
// Load projects from .teams directory
async function loadProjects() {
try {
const response = await fetch('/api/projects');
const projects = await response.json();
const select = document.getElementById('project');
select.innerHTML = '<option value="">-- Select a project --</option>';
projects.forEach(p => {
select.innerHTML += `<option value="${p}">${p}</option>`;
});
} catch (e) {
console.error('Failed to load projects:', e);
// Fallback: manual list
document.getElementById('project').innerHTML = `
<option value="">-- Select a project --</option>
<option value="example">example</option>
`;
}
}
// Load project data
async function loadProject() {
const project = document.getElementById('project').value;
if (!project) {
document.getElementById('dashboard').style.display = 'none';
document.getElementById('no-project').style.display = 'block';
return;
}
try {
const response = await fetch(`/api/projects/${project}`);
const data = await response.json();
renderDashboard(data);
} catch (e) {
console.error('Failed to load project:', e);
// Show sample data
renderDashboard({
total_teams: 12,
active_teams: 4,
completed_teams: 2,
teams: []
});
}
}
// Render dashboard
function renderDashboard(data) {
document.getElementById('dashboard').style.display = 'grid';
document.getElementById('no-project').style.display = 'none';
document.getElementById('total-teams').textContent = data.total_teams || 0;
document.getElementById('active-teams').textContent = data.active_teams || 0;
document.getElementById('completed-teams').textContent = data.completed_teams || 0;
const rate = data.total_teams > 0
? Math.round((data.completed_teams / data.total_teams) * 100)
: 0;
document.getElementById('completion-rate').textContent = rate + '%';
// Render team list
const teamList = document.getElementById('team-list');
if (data.teams && data.teams.length > 0) {
teamList.innerHTML = data.teams.map(team => `
<div class="team-item">
<div>
<div class="team-name">${team.name}</div>
<div class="team-phase">${team.phase}</div>
</div>
<span class="badge badge-${team.status}">${team.status}</span>
</div>
`).join('');
} else {
teamList.innerHTML = '<p style="text-align: center; color: #95a5a6;">No teams found</p>';
}
}
// Initialize
loadProjects();
</script>
</body>
</html>