fix: empty project dropdown in pending-deployment classify modal
The classify modal's _loadProjects() fetched /api/projects/list and called .json() on it, but that endpoint returns HTML project cards (used by the projects overview via htmx). Parsing HTML as JSON threw, the catch swallowed it, and the Project dropdown came up empty — so deployments couldn't be assigned to a project. - Add GET /api/projects/list-json returning assignable projects (id, name, status) as JSON, excluding deleted/archived/completed to match the default /list view. - Point the modal's _loadProjects() at the JSON endpoint. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -295,9 +295,10 @@ function closeClassifyModal() {
|
||||
|
||||
async function _loadProjects() {
|
||||
try {
|
||||
const r = await fetch('/api/projects/list');
|
||||
// Must be the JSON endpoint — /api/projects/list returns HTML cards.
|
||||
const r = await fetch('/api/projects/list-json');
|
||||
const data = r.ok ? await r.json() : { projects: [] };
|
||||
// Endpoint shape varies; tolerate either { projects: [...] } or a flat array.
|
||||
// Tolerate either { projects: [...] } or a flat array.
|
||||
_pdState.projectsCache = Array.isArray(data) ? data : (data.projects || []);
|
||||
} catch (e) {
|
||||
_pdState.projectsCache = [];
|
||||
|
||||
Reference in New Issue
Block a user