feat: optional worker selection when creating workflow (API + frontend dropdown)
This commit is contained in:
@@ -6,6 +6,7 @@ use crate::worker::WorkerInfo;
|
||||
|
||||
async fn list_workers(State(state): State<Arc<AppState>>) -> Json<Vec<WorkerInfo>> {
|
||||
let workers = state.agent_mgr.worker_mgr.list().await;
|
||||
// WorkerInfo already contains `name` field from registration
|
||||
let entries: Vec<WorkerInfo> = workers.into_iter().map(|(_, info)| info).collect();
|
||||
Json(entries)
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ pub struct CreateWorkflow {
|
||||
pub requirement: String,
|
||||
#[serde(default)]
|
||||
pub template_id: Option<String>,
|
||||
#[serde(default)]
|
||||
pub worker: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@@ -78,6 +80,7 @@ async fn create_workflow(
|
||||
workflow_id: workflow.id.clone(),
|
||||
requirement: workflow.requirement.clone(),
|
||||
template_id: input.template_id,
|
||||
worker: input.worker,
|
||||
}).await;
|
||||
|
||||
Ok(Json(workflow))
|
||||
|
||||
Reference in New Issue
Block a user