Merge pull request 'fix(proxmox): use camelCase clusterType for Tauri v2 IPC' (#123) from fix/proxmox-add-remote into beta
Some checks failed
Release Beta / autotag (push) Successful in 11s
Release Beta / changelog (push) Successful in 1m35s
Test / frontend-tests (push) Successful in 1m47s
Test / frontend-typecheck (push) Successful in 1m57s
Release Beta / build-macos-arm64 (push) Successful in 9m29s
Release Beta / build-linux-amd64 (push) Successful in 11m26s
Release Beta / build-windows-amd64 (push) Successful in 12m18s
Release Beta / build-linux-arm64 (push) Successful in 13m42s
Test / rust-fmt-check (push) Successful in 23m29s
Test / rust-clippy (push) Successful in 25m15s
Test / rust-tests (push) Successful in 27m20s
Renovate / renovate (push) Failing after 21s
Some checks failed
Release Beta / autotag (push) Successful in 11s
Release Beta / changelog (push) Successful in 1m35s
Test / frontend-tests (push) Successful in 1m47s
Test / frontend-typecheck (push) Successful in 1m57s
Release Beta / build-macos-arm64 (push) Successful in 9m29s
Release Beta / build-linux-amd64 (push) Successful in 11m26s
Release Beta / build-windows-amd64 (push) Successful in 12m18s
Release Beta / build-linux-arm64 (push) Successful in 13m42s
Test / rust-fmt-check (push) Successful in 23m29s
Test / rust-clippy (push) Successful in 25m15s
Test / rust-tests (push) Successful in 27m20s
Renovate / renovate (push) Failing after 21s
Reviewed-on: #123
This commit is contained in:
commit
466a57c549
38
TICKET-proxmox-add-remote.md
Normal file
38
TICKET-proxmox-add-remote.md
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# Ticket: Fix Proxmox Add Remote Failure
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
Clicking "Add Remote" in the Proxmox Remotes page always produces the error dialog **"Add New Remote / Error / Failed to add remote"** regardless of what credentials are entered. The root cause is a chain of three bugs:
|
||||||
|
|
||||||
|
1. **`password: &str` in async Tauri v2 command** (`src-tauri/src/commands/proxmox.rs`): Tauri v2 requires command parameters to implement `DeserializeOwned + Send`. `&str` is lifetime-bound and does not implement `DeserializeOwned`, so the IPC layer fails to deserialize the payload at runtime — the command body never runs.
|
||||||
|
|
||||||
|
2. **Generic error fallback in frontend** (`src/components/Proxmox/AddRemoteForm.tsx`): The catch block uses `err instanceof Error ? err.message : 'Failed to add remote'`. Tauri errors arrive as plain strings, not `Error` objects, so the fallback branch always fires and the real error is hidden.
|
||||||
|
|
||||||
|
3. **Missing protocol/port in `ProxmoxClient` URL builder** (`src-tauri/src/proxmox/client.rs`): The frontend strips the protocol via `parseRemoteUrl` before sending just the bare hostname. `get_api_url()` and `authenticate()` were constructing URLs like `"172.0.0.18/api2/json/..."` — no scheme, no port — meaning all subsequent Proxmox API calls (VMs, containers, etc.) would silently fail even after a successful add.
|
||||||
|
|
||||||
|
## Acceptance Criteria
|
||||||
|
|
||||||
|
- [ ] Submitting the Add Remote form with valid credentials stores the remote and closes the dialog.
|
||||||
|
- [ ] Submitting with invalid credentials shows the actual backend error string, not the generic fallback.
|
||||||
|
- [ ] All existing Rust tests pass (416).
|
||||||
|
- [ ] `cargo clippy -- -D warnings`, `tsc --noEmit`, `eslint --max-warnings 0` all pass.
|
||||||
|
- [ ] Proxmox API calls (VMs, containers) use correctly formed `https://{host}:{port}/api2/json/...` URLs.
|
||||||
|
|
||||||
|
## Work Implemented
|
||||||
|
|
||||||
|
**Branch**: `fix/proxmox-add-remote` → `beta` | **PR**: https://gogs.tftsr.com/sarman/tftsr-devops_investigation/pulls/122
|
||||||
|
|
||||||
|
| File | Change |
|
||||||
|
|------|--------|
|
||||||
|
| `src-tauri/src/commands/proxmox.rs` | `password: &str` → `password: String` (line 41) |
|
||||||
|
| `src-tauri/src/proxmox/client.rs` | `get_api_url()` now produces `https://{host}:{port}/api2/json/...`; same for `authenticate()`; tests updated to reflect bare-hostname input |
|
||||||
|
| `src/components/Proxmox/AddRemoteForm.tsx` | `err instanceof Error ? err.message : 'Failed to add remote'` → `String(err)` |
|
||||||
|
|
||||||
|
## Testing Needed
|
||||||
|
|
||||||
|
1. Build and run the app (`cargo tauri dev` or install release binary).
|
||||||
|
2. Navigate to **Proxmox → Remotes**.
|
||||||
|
3. Click **Add Remote**, fill in a valid hostname (e.g., `https://172.0.1.42:8006`), username `root@pam`, password, type PVE.
|
||||||
|
4. Confirm the dialog closes and the remote appears in the list.
|
||||||
|
5. Repeat with a wrong password — confirm the actual Tauri error message is shown in the dialog (not the generic fallback).
|
||||||
|
6. Navigate to a cluster's VM or container list to confirm Proxmox API calls form correct URLs.
|
||||||
@ -25,7 +25,7 @@ export async function addProxmoxCluster(
|
|||||||
return await invoke<ClusterInfo>("add_proxmox_cluster", {
|
return await invoke<ClusterInfo>("add_proxmox_cluster", {
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
cluster_type: clusterType,
|
clusterType,
|
||||||
connection,
|
connection,
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user