feat(onboarding): PLC/blob file upload (multipart) + single-file ingest fix (#163)
CI / Check (push) Has been skipped
CI / Detect Changes (push) Successful in 3s
CI / Deploy Agent (push) Successful in 5m39s
CI / Deploy Dashboard (push) Successful in 4m7s
CI / Deploy Docs (push) Has been skipped
CI / Deploy MCP (push) Successful in 2m38s
CI / Check (push) Has been skipped
CI / Detect Changes (push) Successful in 3s
CI / Deploy Agent (push) Successful in 5m39s
CI / Deploy Dashboard (push) Successful in 4m7s
CI / Deploy Docs (push) Has been skipped
CI / Deploy MCP (push) Successful in 2m38s
This commit was merged in pull request #163.
This commit is contained in:
@@ -130,6 +130,37 @@ pub async fn create_target(
|
||||
.map_err(|e| ServerFnError::new(e.to_string()))
|
||||
}
|
||||
|
||||
/// Upload a file artifact (PLC project, firmware image, source archive, mobile
|
||||
/// package) to a target — proxied to the agent as multipart.
|
||||
#[server]
|
||||
pub async fn upload_target_artifact(
|
||||
id: String,
|
||||
kind: String,
|
||||
plc_format: Option<String>,
|
||||
filename: String,
|
||||
bytes: Vec<u8>,
|
||||
) -> Result<TargetResponse, ServerFnError> {
|
||||
let mut form = reqwest::multipart::Form::new().text("kind", kind).part(
|
||||
"file",
|
||||
reqwest::multipart::Part::bytes(bytes).file_name(filename),
|
||||
);
|
||||
if let Some(pf) = plc_format {
|
||||
form = form.text("plc_format", pf);
|
||||
}
|
||||
let resp = super::agent_client::agent_request(
|
||||
reqwest::Method::POST,
|
||||
&format!("/api/v1/targets/{id}/artifacts/upload"),
|
||||
)
|
||||
.await?
|
||||
.multipart(form)
|
||||
.send()
|
||||
.await
|
||||
.map_err(|e| ServerFnError::new(e.to_string()))?;
|
||||
resp.json()
|
||||
.await
|
||||
.map_err(|e| ServerFnError::new(e.to_string()))
|
||||
}
|
||||
|
||||
/// Update a target's name / type / artifacts (dashboard editor).
|
||||
#[server]
|
||||
pub async fn update_target(
|
||||
|
||||
Reference in New Issue
Block a user