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
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:
parent
44c631961d
commit
a7a0f01674
@ -159,6 +159,17 @@ pub async fn list_port_forwards(
|
|||||||
Ok(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> {
|
fn extract_context(_content: &str) -> Result<String, String> {
|
||||||
Ok("default".to_string())
|
Ok("default".to_string())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -181,6 +181,7 @@ pub fn run() {
|
|||||||
commands::kube::start_port_forward,
|
commands::kube::start_port_forward,
|
||||||
commands::kube::stop_port_forward,
|
commands::kube::stop_port_forward,
|
||||||
commands::kube::list_port_forwards,
|
commands::kube::list_port_forwards,
|
||||||
|
commands::kube::delete_port_forward,
|
||||||
])
|
])
|
||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.expect("Error running Troubleshooting and RCA Assistant application");
|
.expect("Error running Troubleshooting and RCA Assistant application");
|
||||||
|
|||||||
@ -783,7 +783,7 @@ export const stopPortForwardCmd = (id: string) =>
|
|||||||
invoke<void>("stop_port_forward", { id });
|
invoke<void>("stop_port_forward", { id });
|
||||||
|
|
||||||
export const deletePortForwardCmd = (id: string) =>
|
export const deletePortForwardCmd = (id: string) =>
|
||||||
invoke<void>("stop_port_forward", { id });
|
invoke<void>("delete_port_forward", { id });
|
||||||
|
|
||||||
export const listPortForwardsCmd = () =>
|
export const listPortForwardsCmd = () =>
|
||||||
invoke<PortForwardResponse[]>("list_port_forwards");
|
invoke<PortForwardResponse[]>("list_port_forwards");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user