Files
openidea/src/features/deployment/Dialogs.tsx
Mariano Dupontandmarianomd b31938db00 feat(deployment): add standalone comparison and selected-file sync (#1070)
Sync with Deployed opens in its own window, one per project window. It lists local files next to the server's copies, with filters, content and binary comparison, and an embedded side-by-side diff whose local side can be edited. The selected file can be synchronized (Enter) without closing the window.

The window is the `deployment` kind of the auxiliary windows that Settings and comparisons use. A cancelled close in it stops its project window from closing. The preview uses the vcs diff viewer through its `diff` editor kind. Also covers #811 (compare with the deployed versions).

Co-authored-by: marianomd <274989+marianomd@users.noreply.github.com>
2026-11-04 12:40:45 +08:00

59 lines
1.6 KiB
TypeScript

/** Deployment comparison and SSH password prompt. */
import { useState } from "react";
import { Checkbox, Dialog, Input } from "@/ui";
import { useDeployment } from "./store";
import { SyncDialog } from "./SyncDialog";
import styles from "./Deployment.module.css";
export function SecretDialog() {
const prompt = useDeployment((s) => s.secret);
const [secret, setSecret] = useState("");
const [save, setSave] = useState(false);
if (!prompt) return null;
const finish = (answer: { secret: string; save: boolean } | null) => {
prompt.resolve(answer);
setSecret("");
setSave(false);
};
return (
<Dialog
open
title="SSH Password"
onClose={() => finish(null)}
width={420}
buttons={[
{ label: "Cancel", role: "cancel" },
{ label: "OK", role: "default", disabled: !secret, onClick: () => finish({ secret, save }) },
]}
>
<form
className={styles.secret}
onSubmit={(e) => {
e.preventDefault();
if (secret) finish({ secret, save });
}}
>
<div className={styles.note}>{prompt.message}</div>
<Input
type="password"
autoFocus
value={secret}
aria-label="Password or passphrase"
placeholder="Password or passphrase"
onChange={(e) => setSecret(e.target.value)}
/>
<Checkbox checked={save} onChange={setSave} label="Save password" />
</form>
</Dialog>
);
}
export function DeploymentDialogs() {
return (
<>
<SyncDialog />
<SecretDialog />
</>
);
}