feat: add agent dropdown for task assignment (#1)
Co-authored-by: Christopher Mayor <toph.homelab@gmail.com> Co-committed-by: Christopher Mayor <toph.homelab@gmail.com>
This commit was merged in pull request #1.
This commit is contained in:
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user