feat(kube): implement delete_port_forward command
Some checks failed
Test / frontend-tests (pull_request) Successful in 1m26s
Test / frontend-typecheck (pull_request) Successful in 1m31s
PR Review Automation / review (pull_request) Successful in 3m27s
Test / rust-clippy (pull_request) Has been cancelled
Test / rust-fmt-check (pull_request) Has been cancelled
Test / rust-tests (pull_request) Has been cancelled

- Add delete_port_forward Rust command to remove port forwards from state
- Update tauriCommands.ts to use delete_port_forward command
- Register delete_port_forward in lib.rs invoke handler
This commit is contained in:
Shaun Arman 2026-06-06 13:09:14 -05:00
parent 44c631961d
commit a7a0f01674
3 changed files with 13 additions and 1 deletions

View File

@ -159,6 +159,17 @@ pub async fn list_port_forwards(
Ok(forwards)
}
#[tauri::command]
pub async fn delete_port_forward(id: String, state: State<'_, AppState>) -> Result<(), String> {
let mut port_forwards = state.port_forwards.lock().await;
if port_forwards.remove(&id).is_none() {
return Err(format!("Port forward session {id} not found"));
}
Ok(())
}
fn extract_context(_content: &str) -> Result<String, String> {
Ok("default".to_string())
}

View File

@ -181,6 +181,7 @@ pub fn run() {
commands::kube::start_port_forward,
commands::kube::stop_port_forward,
commands::kube::list_port_forwards,
commands::kube::delete_port_forward,
])
.run(tauri::generate_context!())
.expect("Error running Troubleshooting and RCA Assistant application");

View File

@ -783,7 +783,7 @@ export const stopPortForwardCmd = (id: string) =>
invoke<void>("stop_port_forward", { id });
export const deletePortForwardCmd = (id: string) =>
invoke<void>("stop_port_forward", { id });
invoke<void>("delete_port_forward", { id });
export const listPortForwardsCmd = () =>
invoke<PortForwardResponse[]>("list_port_forwards");