fix: address PR review findings
Some checks failed
PR Review Automation / review (pull_request) Successful in 4m35s
Test / frontend-tests (pull_request) Has been cancelled
Test / frontend-typecheck (pull_request) Has been cancelled
Test / rust-fmt-check (pull_request) Has been cancelled
Test / rust-tests (pull_request) Has been cancelled
Test / rust-clippy (pull_request) Has been cancelled
Some checks failed
PR Review Automation / review (pull_request) Successful in 4m35s
Test / frontend-tests (pull_request) Has been cancelled
Test / frontend-typecheck (pull_request) Has been cancelled
Test / rust-fmt-check (pull_request) Has been cancelled
Test / rust-tests (pull_request) Has been cancelled
Test / rust-clippy (pull_request) Has been cancelled
- Add separate deletePortForwardCmd wrapper (currently calls stop_port_forward - backend limitation) - Add explicit empty string check for containerPort validation - Improve status badge handling for empty/unknown status - Update PortForwardList to use distinct handleDeletePortForward handler
This commit is contained in:
parent
aefe935de5
commit
44c631961d
@ -46,6 +46,11 @@ export function PortForwardForm({ isOpen, onClose, onStart }: PortForwardFormPro
|
||||
return;
|
||||
}
|
||||
|
||||
if (containerPort.trim() === "") {
|
||||
setError("Container port is required");
|
||||
return;
|
||||
}
|
||||
|
||||
const port = parseInt(containerPort, 10);
|
||||
if (isNaN(port) || port < 1 || port > 65535) {
|
||||
setError("Container port must be a valid port number (1-65535)");
|
||||
|
||||
@ -25,7 +25,11 @@ export function PortForwardList({ portForwards, onStart, onStop, onDelete }: Por
|
||||
};
|
||||
|
||||
const getStatusColor = (status: string) => {
|
||||
switch (status.toLowerCase()) {
|
||||
const statusLower = status.toLowerCase().trim();
|
||||
if (statusLower === "") {
|
||||
return "bg-muted text-muted-foreground";
|
||||
}
|
||||
switch (statusLower) {
|
||||
case "active":
|
||||
return "bg-green-500/15 text-green-600 dark:text-green-400 border-green-500/20";
|
||||
case "stopped":
|
||||
|
||||
@ -782,5 +782,8 @@ export const startPortForwardCmd = (request: PortForwardRequest) =>
|
||||
export const stopPortForwardCmd = (id: string) =>
|
||||
invoke<void>("stop_port_forward", { id });
|
||||
|
||||
export const deletePortForwardCmd = (id: string) =>
|
||||
invoke<void>("stop_port_forward", { id });
|
||||
|
||||
export const listPortForwardsCmd = () =>
|
||||
invoke<PortForwardResponse[]>("list_port_forwards");
|
||||
|
||||
@ -10,12 +10,9 @@ import {
|
||||
removeClusterCmd,
|
||||
listPortForwardsCmd,
|
||||
stopPortForwardCmd,
|
||||
deletePortForwardCmd,
|
||||
} from "@/lib/tauriCommands";
|
||||
|
||||
const deletePortForwardCmd = async (id: string): Promise<void> => {
|
||||
await stopPortForwardCmd(id);
|
||||
};
|
||||
|
||||
export function KubernetesPage() {
|
||||
const [clusters, setClusters] = useState<ClusterInfo[]>([]);
|
||||
const [portForwards, setPortForwards] = useState<PortForwardResponse[]>([]);
|
||||
@ -65,7 +62,7 @@ export function KubernetesPage() {
|
||||
|
||||
const handleDeletePortForward = async (id: string) => {
|
||||
try {
|
||||
await stopPortForwardCmd(id);
|
||||
await deletePortForwardCmd(id);
|
||||
setPortForwards((prev) => prev.filter((pf) => pf.id !== id));
|
||||
} catch (err) {
|
||||
console.error("Failed to delete port forward:", err);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user