feat: add agent dropdown for task assignment

- Replace assignee text input with select dropdown
- Populate dropdown with agents from /api/agents endpoint
- Add styling to match existing form elements
- Improves UX by preventing typos and showing available agents
This commit is contained in:
2026-03-03 16:25:12 -08:00
parent 1804aa664b
commit f907a72530
3 changed files with 59 additions and 1 deletions

View File

@@ -270,3 +270,32 @@ ws.onmessage = (event) => {
loadTasks();
}
};
// Populate agent dropdown
async function populateAgentDropdown() {
try {
const res = await fetch('/api/agents');
const agents = await res.json();
const select = document.getElementById('assignee');
if (!select) return;
// Clear existing options except the first placeholder
select.innerHTML = '<option value="">Select agent...</option>';
// Add agent options
agents.forEach(agent => {
const option = document.createElement('option');
option.value = agent.name;
option.textContent = agent.name;
select.appendChild(option);
});
} catch (err) {
console.error('Failed to load agents for dropdown:', err);
}
}
// Populate dropdown on page load
document.addEventListener('DOMContentLoaded', () => {
populateAgentDropdown();
});