From f907a725303283b2b498690029b93f2627371239 Mon Sep 17 00:00:00 2001 From: Christopher Mayor Date: Tue, 3 Mar 2026 16:25:12 -0800 Subject: [PATCH] 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 --- public/app.js | 29 +++++++++++++++++++++++++++++ public/index.html | 4 +++- public/styles.css | 27 +++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/public/app.js b/public/app.js index a9dbee0..fd111f6 100644 --- a/public/app.js +++ b/public/app.js @@ -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 = ''; + + // 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(); +}); diff --git a/public/index.html b/public/index.html index 54699ff..a44d276 100644 --- a/public/index.html +++ b/public/index.html @@ -30,7 +30,9 @@

Create Task

- +