huskies: merge 771

This commit is contained in:
dave
2026-04-28 12:08:44 +00:00
parent e879d6f602
commit e9ed58502a
5 changed files with 38 additions and 33 deletions
+1 -24
View File
@@ -1,4 +1,4 @@
//! REST HTTP handlers for the gateway: agents, projects, bot configuration, and pipeline.
//! REST HTTP handlers for the gateway: agents, projects, and bot configuration.
use crate::service::gateway::{self, GatewayState};
use poem::handler;
@@ -8,7 +8,6 @@ use poem::web::{Data, Json};
use poem::{Body, Response};
use serde::{Deserialize, Serialize};
use serde_json::{Value, json};
use std::collections::BTreeMap;
use std::sync::Arc;
// ── Agent REST handlers ───────────────────────────────────────────────────────
@@ -257,28 +256,6 @@ pub async fn gateway_bot_config_save_handler(
}
}
/// `GET /api/gateway/pipeline` — fetch pipeline status from all registered projects.
#[handler]
pub async fn gateway_all_pipeline_handler(state: Data<&Arc<GatewayState>>) -> Response {
let project_urls: BTreeMap<String, String> = state
.projects
.read()
.await
.iter()
.map(|(n, e)| (n.clone(), e.url.clone()))
.collect();
let results =
gateway::io::fetch_all_project_pipeline_statuses(&project_urls, &state.client).await;
let active = state.active_project.read().await.clone();
let body = json!({ "active": active, "projects": results });
Response::builder()
.status(StatusCode::OK)
.header("Content-Type", "application/json")
.body(Body::from(serde_json::to_vec(&body).unwrap_or_default()))
}
// ── Bot config page ───────────────────────────────────────────────────────────
/// Self-contained HTML page for bot configuration.