Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

AddEnvironmentDialog.tsx

662 lines24.1 KB

1import { pipe } from "effect/Function";
2import { ChevronsLeftRightEllipsisIcon, PlusIcon, TerminalIcon } from "lucide-react";
3import { useAtomValue } from "@effect/atom-react";
4import { type KeyboardEvent, type ReactNode, useEffect, useRef, useState } from "react";
5import {
6 type DesktopDiscoveredSshHost,
7 type DesktopSshEnvironmentTarget,
8} from "@t3tools/contracts";
9import {
10 RelayConnectionRegistration,
11 RelayConnectionTarget,
12} from "@t3tools/client-runtime/connection";
13import {
14 isAtomCommandInterrupted,
15 squashAtomCommandFailure,
16} from "@t3tools/client-runtime/state/runtime";
17import * as Option from "effect/Option";
18​
19import { cn } from "../../lib/utils";
20import { formatDesktopSshTarget } from "./EnvironmentRow";
21import { Input } from "../ui/input";
22import { CommandShortcut } from "../ui/command";
23import {
24 Autocomplete,
25 AutocompleteEmpty,
26 AutocompleteInput,
27 AutocompleteItem,
28 AutocompleteList,
29 AutocompletePopup,
30} from "../ui/autocomplete";
31import {
32 Dialog,
33 DialogDescription,
34 DialogHeader,
35 DialogPanel,
36 DialogPopup,
37 DialogTitle,
38 DialogTrigger,
39} from "../ui/dialog";
40import { stackedThreadToast, toastManager } from "../ui/toast";
41import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
42import { Alert, AlertDescription } from "../ui/alert";
43import { Button } from "../ui/button";
44import { AnimatedHeight } from "../AnimatedHeight";
45import { environmentCatalog } from "~/connection/catalog";
46import {
47 connectPairing as connectPairingAtom,
48 connectSshEnvironment as connectSshEnvironmentAtom,
49} from "~/connection/onboarding";
50import { useEnvironmentQuery } from "~/state/query";
51import { desktopSshHostsStateAtom, filterDiscoveredSshHosts } from "~/state/desktopSshHosts";
52import { type EnvironmentPresentation, useRelayEnvironmentDiscovery } from "~/state/environments";
53import { useAtomCommand } from "../../state/use-atom-command";
54import { primaryServerKeybindingsAtom } from "~/state/server";
55import {
56 resolveShortcutCommand,
57 shortcutLabelForCommand,
58 threadJumpCommandForIndex,
59 threadJumpIndexFromCommand,
60} from "../../keybindings";
61import {
62 parseManualDesktopSshTarget,
63 parsePairingUrlFields,
64 parseRemotePairingFields,
65 formatDesktopSshConnectionError,
66} from "./ConnectionsSettings.logic";
67​
68const EMPTY_DISCOVERED_SSH_HOSTS: ReadonlyArray<DesktopDiscoveredSshHost> = [];
69​
70export function AddEnvironmentDialog({
71 open,
72 routeTarget,
73 error,
74 savedEnvironments,
75 onOpenChange,
76 onErrorChange,
77}: {
78 readonly open: boolean;
79 readonly routeTarget: EnvironmentPresentation | null;
80 readonly error: string | null;
81 readonly savedEnvironments: ReadonlyArray<EnvironmentPresentation>;
82 readonly onOpenChange: (open: boolean) => void;
83 readonly onErrorChange: (error: string | null) => void;
84}) {
85 const desktopBridge = window.desktopBridge;
86 const keybindings = useAtomValue(primaryServerKeybindingsAtom);
87 const connectPairing = useAtomCommand(connectPairingAtom, { reportFailure: false });
88 const connectSshEnvironment = useAtomCommand(connectSshEnvironmentAtom, {
89 reportFailure: false,
90 });
91 const registerEnvironment = useAtomCommand(environmentCatalog.register, {
92 reportFailure: false,
93 });
94 const relayDiscoveryState = useRelayEnvironmentDiscovery();
95 const savedDesktopSshEnvironmentKeys = (() => {
96 const keys = new Set<string>();
97 for (const environment of savedEnvironments) {
98 const profile = environment.entry.profile;
99 if (
100 environment.entry.target._tag !== "SshConnectionTarget" ||
101 Option.isNone(profile) ||
102 profile.value._tag !== "SshConnectionProfile"
103 ) {
104 continue;
105 }
106 const target = profile.value.target;
107 keys.add(target.alias);
108 keys.add(formatDesktopSshTarget(target));
109 }
110 return keys;
111 })();
112 const [savedBackendMode, setSavedBackendMode] = useState<"remote" | "ssh">("remote");
113 const [savedBackendHost, setSavedBackendHost] = useState("");
114 const [savedBackendPairingCode, setSavedBackendPairingCode] = useState("");
115 const [savedBackendSshHost, setSavedBackendSshHost] = useState("");
116 const [savedBackendSshUsername, setSavedBackendSshUsername] = useState("");
117 const [savedBackendSshPort, setSavedBackendSshPort] = useState("");
118 const [sshHostSuggestionsOpen, setSshHostSuggestionsOpen] = useState(false);
119 const highlightedSshHostRef = useRef<DesktopDiscoveredSshHost | undefined>(undefined);
120 const [isAddingSavedBackend, setIsAddingSavedBackend] = useState(false);
121 const savedBackendSessionRef = useRef(0);
122 const isSshDiscoveryActive = desktopBridge !== undefined && open && savedBackendMode === "ssh";
123 const desktopSshHosts = useEnvironmentQuery(
124 isSshDiscoveryActive ? desktopSshHostsStateAtom : null,
125 );
126 // The discovery atom is kept alive across dialog opens, so re-read SSH config
127 // each time the SSH tab is shown; stale hosts stay visible while it refreshes.
128 const refreshDesktopSshHosts = desktopSshHosts.refresh;
129 // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- rereads desktop SSH config through the bridge each time the SSH tab is shown
130 useEffect(() => {
131 if (isSshDiscoveryActive) refreshDesktopSshHosts();
132 }, [isSshDiscoveryActive, refreshDesktopSshHosts]);
133 const discoveredSshHosts = desktopSshHosts.data ?? EMPTY_DISCOVERED_SSH_HOSTS;
134 const unsavedDiscoveredSshHosts = discoveredSshHosts.filter((target) => {
135 const address = formatDesktopSshTarget(target);
136 return (
137 !savedDesktopSshEnvironmentKeys.has(target.alias) &&
138 (target.source === "ssh-config" || !savedDesktopSshEnvironmentKeys.has(address))
139 );
140 });
141 const filteredDiscoveredSshHosts = filterDiscoveredSshHosts(
142 unsavedDiscoveredSshHosts,
143 savedBackendSshHost,
144 );
145 const isLoadingDiscoveredSshHosts = desktopSshHosts.isPending && desktopSshHosts.data === null;
146 const discoveredSshHostsError = desktopSshHosts.error;
147 const hasSshHostSuggestionContent =
148 desktopBridge !== undefined &&
149 (isLoadingDiscoveredSshHosts || unsavedDiscoveredSshHosts.length > 0);
150 const handleOpenChange = (nextOpen: boolean) => {
151 if (!nextOpen) {
152 savedBackendSessionRef.current += 1;
153 setSavedBackendMode("remote");
154 setSavedBackendHost("");
155 setSavedBackendPairingCode("");
156 setSavedBackendSshHost("");
157 setSavedBackendSshUsername("");
158 setSavedBackendSshPort("");
159 }
160 onOpenChange(nextOpen);
161 };
162 const connectSavedBackendSshTarget = async (target: DesktopSshEnvironmentTarget) => {
163 const session = savedBackendSessionRef.current;
164 setIsAddingSavedBackend(true);
165 onErrorChange(null);
166 const result = await connectSshEnvironment({
167 target,
168 label: "",
169 ...(routeTarget ? { expectedEnvironmentId: routeTarget.environmentId } : {}),
170 });
171 if (result._tag === "Failure") {
172 if (session === savedBackendSessionRef.current && !isAtomCommandInterrupted(result)) {
173 pipe(squashAtomCommandFailure(result), formatDesktopSshConnectionError, onErrorChange);
174 }
175 setIsAddingSavedBackend(false);
176 return;
177 }
178​
179 handleOpenChange(false);
180 toastManager.add({
181 type: "success",
182 title: routeTarget ? "Route added" : "Environment connected",
183 description: routeTarget
184 ? `${routeTarget.label} can now be reached over SSH ${target.alias}.`
185 : `${target.alias} is ready over an SSH-managed tunnel.`,
186 });
187 setIsAddingSavedBackend(false);
188 };
189​
190 const handleAddSavedBackend = async () => {
191 if (savedBackendMode === "ssh") {
192 let target: DesktopSshEnvironmentTarget;
193 try {
194 target = parseManualDesktopSshTarget({
195 host: savedBackendSshHost,
196 username: savedBackendSshUsername,
197 port: savedBackendSshPort,
198 });
199 } catch (error) {
200 onErrorChange(formatDesktopSshConnectionError(error));
201 return;
202 }
203​
204 await connectSavedBackendSshTarget(target);
205 return;
206 }
207​
208 setIsAddingSavedBackend(true);
209 onErrorChange(null);
210 let remotePairingInput: ReturnType<typeof parseRemotePairingFields>;
211 try {
212 remotePairingInput = parseRemotePairingFields({
213 host: savedBackendHost,
214 pairingCode: savedBackendPairingCode,
215 });
216 } catch (error) {
217 const message = error instanceof Error ? error.message : "Failed to add backend.";
218 onErrorChange(message);
219 toastManager.add(
220 stackedThreadToast({
221 type: "error",
222 title: "Could not add backend",
223 description: message,
224 }),
225 );
226 setIsAddingSavedBackend(false);
227 return;
228 }
229​
230 const result = await connectPairing({
231 ...remotePairingInput,
232 ...(routeTarget ? { expectedEnvironmentId: routeTarget.environmentId } : {}),
233 });
234 if (result._tag === "Failure") {
235 if (!isAtomCommandInterrupted(result)) {
236 const error = squashAtomCommandFailure(result);
237 const message = error instanceof Error ? error.message : "Failed to add backend.";
238 onErrorChange(message);
239 toastManager.add(
240 stackedThreadToast({
241 type: "error",
242 title: "Could not add backend",
243 description: message,
244 }),
245 );
246 }
247 setIsAddingSavedBackend(false);
248 return;
249 }
250​
251 handleOpenChange(false);
252 toastManager.add(
253 routeTarget
254 ? {
255 type: "success",
256 title: "Route added",
257 description: `${routeTarget.label} now has another way to connect.`,
258 }
259 : {
260 type: "success",
261 title: "Backend added",
262 description: "The environment is saved and will reconnect on app startup.",
263 },
264 );
265 setIsAddingSavedBackend(false);
266 };
267​
268 const handleSavedBackendSshFieldKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
269 if (event.nativeEvent.isComposing || event.keyCode === 229) return;
270 if (event.key === "Enter" && savedBackendSshHost.trim().length > 0) {
271 event.preventDefault();
272 void handleAddSavedBackend();
273 }
274 };
275​
276 const handleSelectSshHostSuggestion = async (target: DesktopDiscoveredSshHost) => {
277 if (isAddingSavedBackend || !desktopBridge) return;
278​
279 const session = savedBackendSessionRef.current;
280 setIsAddingSavedBackend(true);
281 onErrorChange(null);
282 setSavedBackendSshHost(target.alias);
283 let resolved: DesktopSshEnvironmentTarget;
284 try {
285 resolved = await desktopBridge.resolveSshHost(target.alias);
286 } catch (error) {
287 if (session === savedBackendSessionRef.current) {
288 onErrorChange(formatDesktopSshConnectionError(error));
289 }
290 setIsAddingSavedBackend(false);
291 return;
292 }
293 if (session !== savedBackendSessionRef.current) {
294 setIsAddingSavedBackend(false);
295 return;
296 }
297 setSavedBackendSshUsername(resolved.username ?? "");
298 setSavedBackendSshPort(resolved.port === null ? "" : String(resolved.port));
299 await connectSavedBackendSshTarget(resolved);
300 };
301​
302 const handleSavedBackendSshHostKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
303 if (event.nativeEvent.isComposing || event.keyCode === 229) return;
304​
305 const isSshHostPopupVisible = sshHostSuggestionsOpen && hasSshHostSuggestionContent;
306 if (isSshHostPopupVisible) {
307 const command = resolveShortcutCommand(event, keybindings, {
308 platform: navigator.platform,
309 context: { modelPickerOpen: false },
310 });
311 const index = threadJumpIndexFromCommand(command ?? "");
312 const target = index === null ? undefined : filteredDiscoveredSshHosts[index];
313 if (target) {
314 event.preventDefault();
315 event.stopPropagation();
316 setSshHostSuggestionsOpen(false);
317 void handleSelectSshHostSuggestion(target);
318 return;
319 }
320​
321 if (event.key === "Escape") {
322 event.preventDefault();
323 event.stopPropagation();
324 return;
325 }
326 }
327​
328 const hasHighlightedSshHost =
329 isSshHostPopupVisible && highlightedSshHostRef.current !== undefined;
330 if (
331 !event.defaultPrevented &&
332 !hasHighlightedSshHost &&
333 event.key === "Enter" &&
334 savedBackendSshHost.trim().length > 0
335 ) {
336 event.preventDefault();
337 void handleAddSavedBackend();
338 }
339 };
340​
341 const handleSavedBackendHostChange = (value: string) => {
342 const parsedPairingUrl = parsePairingUrlFields(value);
343 if (parsedPairingUrl) {
344 setSavedBackendHost(parsedPairingUrl.host);
345 setSavedBackendPairingCode(parsedPairingUrl.pairingCode);
346 return;
347 }
348 setSavedBackendHost(value);
349 };
350 const renderConnectionModeCard = (input: {
351 readonly mode: "remote" | "ssh";
352 readonly title: string;
353 readonly description: string;
354 readonly icon?: ReactNode;
355 }) => {
356 const selected = savedBackendMode === input.mode;
357 return (
358 <button
359 type="button"
360 aria-pressed={selected}
361 className={cn(
362 "group flex min-h-24 items-start gap-3 rounded-lg border p-4 text-left",
363 selected ? "border-primary/50 bg-primary/5" : "border-border/60 hover:bg-muted/40",
364 )}
365 disabled={isAddingSavedBackend}
366 onClick={() => {
367 setSavedBackendMode(input.mode);
368 }}
369 >
370 {input.icon ? (
371 <span
372 className={cn(
373 "mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-md border",
374 selected
375 ? "border-primary/30 bg-primary/10 text-primary"
376 : "border-border/70 bg-background text-muted-foreground group-hover:text-foreground",
377 )}
378 >
379 {input.icon}
380 </span>
381 ) : null}
382 <span className="min-w-0">
383 <span className="block text-sm font-medium text-foreground">{input.title}</span>
384 <span className="mt-1 block text-xs leading-relaxed text-muted-foreground">
385 {input.description}
386 </span>
387 </span>
388 </button>
389 );
390 };
391​
392 const renderRemoteFields = () => (
393 <div className="space-y-3">
394 <div className="grid gap-3 sm:grid-cols-[minmax(0,1fr)_10rem]">
395 <label className="block">
396 <span className="mb-1.5 block text-xs font-medium text-foreground">Host</span>
397 <Input
398 value={savedBackendHost}
399 onChange={(event) => handleSavedBackendHostChange(event.target.value)}
400 placeholder="backend.example.com"
401 disabled={isAddingSavedBackend}
402 spellCheck={false}
403 />
404 </label>
405 <label className="block">
406 <span className="mb-1.5 block text-xs font-medium text-foreground">Pairing code</span>
407 <Input
408 value={savedBackendPairingCode}
409 onChange={(event) => setSavedBackendPairingCode(event.target.value)}
410 placeholder="PAIRCODE"
411 disabled={isAddingSavedBackend}
412 spellCheck={false}
413 />
414 </label>
415 </div>
416 <div>
417 <span className="mt-1 block text-2xs text-muted-foreground">
418 Paste a full pairing URL here to fill both fields automatically.
419 </span>
420 </div>
421 </div>
422 );
423 const relayRouteOffer =
424 routeTarget !== null &&
425 !routeTarget.relayManaged &&
426 relayDiscoveryState.environments.has(routeTarget.environmentId)
427 ? relayDiscoveryState.environments.get(routeTarget.environmentId)!.environment
428 : null;
429 const addRelayRoute = async () => {
430 if (relayRouteOffer === null || routeTarget === null) return;
431 setIsAddingSavedBackend(true);
432 const result = await registerEnvironment(
433 new RelayConnectionRegistration({
434 target: new RelayConnectionTarget({
435 environmentId: relayRouteOffer.environmentId,
436 label: routeTarget.label,
437 }),
438 }),
439 );
440 setIsAddingSavedBackend(false);
441 if (result._tag === "Failure") {
442 if (!isAtomCommandInterrupted(result)) {
443 const error = squashAtomCommandFailure(result);
444 onErrorChange(error instanceof Error ? error.message : "Could not add the route.");
445 }
446 return;
447 }
448 handleOpenChange(false);
449 toastManager.add({
450 type: "success",
451 title: "Route added",
452 description: `${routeTarget.label} falls back to T3 Connect when its other routes are unreachable.`,
453 });
454 };
455 const renderRemoteModeBody = () => (
456 <div className="space-y-4">
457 {relayRouteOffer !== null ? (
458 <div className="flex items-center justify-between gap-3 rounded-md border border-border px-3 py-2">
459 <p className="text-xs text-muted-foreground">
460 This machine is on your T3 Connect account. Use it as a fallback route.
461 </p>
462 <Button
463 size="xs"
464 variant="outline"
465 disabled={isAddingSavedBackend}
466 onClick={() => void addRelayRoute()}
467 >
468 Add T3 Connect
469 </Button>
470 </div>
471 ) : null}
472 {renderRemoteFields()}
473 {error ? <p className="text-xs text-destructive">{error}</p> : null}
474 <Button
475 variant="outline"
476 className="w-full"
477 disabled={isAddingSavedBackend}
478 onClick={() => void handleAddSavedBackend()}
479 >
480 <PlusIcon className="size-3.5" />
481 {isAddingSavedBackend ? "Adding…" : routeTarget ? "Add route" : "Add environment"}
482 </Button>
483 </div>
484 );
485 const renderSshFields = () => (
486 <div className="space-y-4">
487 <div className="space-y-3">
488 <div className="block">
489 <label
490 htmlFor="saved-backend-ssh-host"
491 className="mb-1.5 block text-xs font-medium text-foreground"
492 >
493 SSH host or alias
494 </label>
495 <Autocomplete
496 items={filteredDiscoveredSshHosts}
497 itemToStringValue={(target) => target.alias}
498 mode="none"
499 openOnInputClick
500 open={sshHostSuggestionsOpen}
501 onOpenChange={setSshHostSuggestionsOpen}
502 onItemHighlighted={(target) => {
503 highlightedSshHostRef.current = target;
504 }}
505 value={savedBackendSshHost}
506 onValueChange={(value, eventDetails) => {
507 setSavedBackendSshHost(value);
508 if (eventDetails.reason !== "item-press") return;
509​
510 const target = filteredDiscoveredSshHosts.find((host) => host.alias === value);
511 if (target) void handleSelectSshHostSuggestion(target);
512 }}
513 >
514 <AutocompleteInput
515 id="saved-backend-ssh-host"
516 onKeyDown={handleSavedBackendSshHostKeyDown}
517 placeholder="Search hosts or type devbox"
518 disabled={isAddingSavedBackend}
519 spellCheck={false}
520 />
521 {hasSshHostSuggestionContent ? (
522 <AutocompletePopup>
523 {isLoadingDiscoveredSshHosts ? (
524 <div className="px-3 py-2 text-xs text-muted-foreground">Loading hosts…</div>
525 ) : filteredDiscoveredSshHosts.length > 0 ? (
526 <AutocompleteList className="max-h-72">
527 {filteredDiscoveredSshHosts.map((target, index) => {
528 const address = formatDesktopSshTarget(target);
529 const shortcutCommand = index < 9 ? threadJumpCommandForIndex(index) : null;
530 const shortcutLabel = shortcutCommand
531 ? shortcutLabelForCommand(keybindings, shortcutCommand, navigator.platform)
532 : null;
533 return (
534 <AutocompleteItem
535 key={`${target.alias}:${target.hostname}:${target.port ?? ""}`}
536 value={target}
537 className="h-8 min-h-8 whitespace-nowrap"
538 >
539 <span className="min-w-0 truncate text-sm font-medium">
540 {target.alias}
541 </span>
542 {address !== target.alias ? (
543 <span className="min-w-0 flex-1 truncate text-xs text-muted-foreground">
544 {address}
545 </span>
546 ) : (
547 <span className="flex-1" />
548 )}
549 {shortcutLabel ? (
550 <CommandShortcut className="shrink-0">{shortcutLabel}</CommandShortcut>
551 ) : null}
552 </AutocompleteItem>
553 );
554 })}
555 </AutocompleteList>
556 ) : (
557 <AutocompleteEmpty className="break-all">
558 No hosts match "{savedBackendSshHost.trim()}".
559 </AutocompleteEmpty>
560 )}
561 </AutocompletePopup>
562 ) : null}
563 </Autocomplete>
564 </div>
565 <div className="grid gap-3 sm:grid-cols-[minmax(0,1fr)_7rem]">
566 <label className="block">
567 <span className="mb-1.5 block text-xs font-medium text-foreground">Username</span>
568 <Input
569 value={savedBackendSshUsername}
570 onChange={(event) => setSavedBackendSshUsername(event.target.value)}
571 onKeyDown={handleSavedBackendSshFieldKeyDown}
572 placeholder="root"
573 disabled={isAddingSavedBackend}
574 spellCheck={false}
575 />
576 </label>
577 <label className="block">
578 <span className="mb-1.5 block text-xs font-medium text-foreground">Port</span>
579 <Input
580 value={savedBackendSshPort}
581 onChange={(event) => setSavedBackendSshPort(event.target.value)}
582 onKeyDown={handleSavedBackendSshFieldKeyDown}
583 placeholder="22"
584 inputMode="numeric"
585 disabled={isAddingSavedBackend}
586 spellCheck={false}
587 />
588 </label>
589 </div>
590 {error || discoveredSshHostsError ? (
591 <Alert variant="error">
592 <AlertDescription>{error ?? discoveredSshHostsError}</AlertDescription>
593 </Alert>
594 ) : null}
595 <Button
596 variant="outline"
597 className="w-full"
598 disabled={isAddingSavedBackend}
599 onClick={() => void handleAddSavedBackend()}
600 >
601 <PlusIcon className="size-3.5" />
602 {isAddingSavedBackend ? "Adding…" : routeTarget ? "Add route" : "Add environment"}
603 </Button>
604 </div>
605 </div>
606 );
607​
608 return (
609 <Dialog open={open} onOpenChange={handleOpenChange}>
610 <Tooltip>
611 <TooltipTrigger
612 render={
613 <DialogTrigger
614 render={
615 <Button size="xs" variant="ghost-muted" aria-label="Add environment">
616 <PlusIcon className="size-3" />
617 <span>Add environment</span>
618 </Button>
619 }
620 />
621 }
622 />
623 <TooltipPopup side="top">Add environment</TooltipPopup>
624 </Tooltip>
625 <DialogPopup className="max-h-[80dvh] sm:max-w-3xl">
626 <DialogHeader>
627 <DialogTitle>
628 {routeTarget ? `Add a route to ${routeTarget.label}` : "Add Environment"}
629 </DialogTitle>
630 <DialogDescription>
631 {routeTarget
632 ? "Pair this machine again over another address, such as its Tailscale name. It joins the existing routes instead of adding a second machine."
633 : "Pair another environment to this client."}
634 </DialogDescription>
635 </DialogHeader>
636 <DialogPanel>
637 <div className="space-y-4">
638 <div className="grid gap-3 sm:grid-cols-2">
639 {renderConnectionModeCard({
640 mode: "remote",
641 title: "Remote link",
642 description: "Enter a backend host and pairing code.",
643 icon: <ChevronsLeftRightEllipsisIcon aria-hidden className="size-4" />,
644 })}
645 {desktopBridge
646 ? renderConnectionModeCard({
647 mode: "ssh",
648 title: "SSH",
649 description: "Use local SSH config, agent, and tunnels for the backend.",
650 icon: <TerminalIcon aria-hidden className="size-4" />,
651 })
652 : null}
653 </div>
654 <AnimatedHeight>
655 {savedBackendMode === "ssh" ? renderSshFields() : renderRemoteModeBody()}
656 </AnimatedHeight>
657 </div>
658 </DialogPanel>
659 </DialogPopup>
660 </Dialog>
661 );