research canvas: collapsible sidebar + live topology-run logs (#6)
This commit was merged in pull request #6.
This commit is contained in:
@@ -39,6 +39,38 @@ pub struct PipelineState {
|
||||
pub stages: Vec<PipelineStage>,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct ActiveRun {
|
||||
pub id: Uuid,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct ActiveRuns {
|
||||
pub topic_id: Uuid,
|
||||
pub runs: Vec<ActiveRun>,
|
||||
}
|
||||
|
||||
/// `GET /api/research/:id/active-runs` — queued + running topology_run
|
||||
/// ids for this topic, newest first. Feeds the wizard's live-log panel
|
||||
/// (SSE per run at `/api/topology-runs/:id/events`).
|
||||
pub async fn active_runs(
|
||||
State(state): State<AppState>,
|
||||
Authed(user): Authed,
|
||||
Path(id): Path<Uuid>,
|
||||
) -> Result<Json<ActiveRuns>, ApiError> {
|
||||
// Workspace-scope: 404 rather than leak run ids for a topic the
|
||||
// caller can't see.
|
||||
let _topic = cm_db::repo::research_topics::get(&state.pool, id, user.workspace_id.as_uuid())
|
||||
.await?
|
||||
.ok_or(ApiError::NotFound)?;
|
||||
let ids =
|
||||
cm_db::repo::topology_runs::active_run_ids_for_research_topic(&state.pool, id).await?;
|
||||
Ok(Json(ActiveRuns {
|
||||
topic_id: id,
|
||||
runs: ids.into_iter().map(|id| ActiveRun { id }).collect(),
|
||||
}))
|
||||
}
|
||||
|
||||
/// `GET /api/research/:id/pipeline-state`.
|
||||
pub async fn pipeline_state(
|
||||
State(state): State<AppState>,
|
||||
|
||||
Reference in New Issue
Block a user