Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions messages/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@
"query_row_copied": "تم نسخ الصف كـ JSON",
"query_column_copied": "تم نسخ قيم العمود",
"query_error_copied": "تم نسخ الخطأ إلى الحافظة",
"query_copy_error": "نسخ الخطأ إلى الحافظة",
"query_first_page": "الانتقال إلى الصفحة الأولى",
"query_previous_page": "الانتقال إلى الصفحة السابقة",
"query_next_page": "الانتقال إلى الصفحة التالية",
"query_last_page": "الانتقال إلى الصفحة الأخيرة",
"query_copy_cell": "نسخ قيمة الخلية",
"query_copy_row": "نسخ الصف كـ JSON",
"query_copy_column": "نسخ قيم العمود",
Expand All @@ -254,6 +259,9 @@
"history_no_history": "لم يتم العثور على سجل استعلامات",
"history_no_saved": "لم يتم العثور على استعلامات محفوظة",
"history_save_hint": "احفظ الاستعلامات للوصول إليها لاحقاً",
"history_add_favorite": "إضافة إلى المفضلة",
"history_remove_favorite": "إزالة من المفضلة",
"history_delete_saved": "حذف الاستعلام المحفوظ",
"row_actions_delete": "حذف الصف",
"save_query_title": "حفظ الاستعلام",
"save_query_description": "أعطِ استعلامك اسماً لحفظه للاستخدام لاحقاً",
Expand Down
8 changes: 8 additions & 0 deletions messages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@
"query_row_copied": "Zeile als JSON kopiert",
"query_column_copied": "Spaltenwerte kopiert",
"query_error_copied": "Fehler in Zwischenablage kopiert",
"query_copy_error": "Fehler in Zwischenablage kopieren",
"query_first_page": "Zur ersten Seite gehen",
"query_previous_page": "Zur vorherigen Seite gehen",
"query_next_page": "Zur nächsten Seite gehen",
"query_last_page": "Zur letzten Seite gehen",
"query_copy_cell": "Zellwert kopieren",
"query_copy_row": "Zeile als JSON kopieren",
"query_copy_column": "Spaltenwerte kopieren",
Expand All @@ -254,6 +259,9 @@
"history_no_history": "Kein Abfrageverlauf gefunden",
"history_no_saved": "Keine gespeicherten Abfragen gefunden",
"history_save_hint": "Speichern Sie Abfragen, um später darauf zuzugreifen",
"history_add_favorite": "Zu Favoriten hinzufügen",
"history_remove_favorite": "Aus Favoriten entfernen",
"history_delete_saved": "Gespeicherte Abfrage löschen",
"row_actions_delete": "Zeile löschen",
"save_query_title": "Abfrage speichern",
"save_query_description": "Geben Sie Ihrer Abfrage einen Namen, um sie für später zu speichern",
Expand Down
8 changes: 8 additions & 0 deletions messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@
"query_row_copied": "Row copied as JSON",
"query_column_copied": "Column values copied",
"query_error_copied": "Error copied to clipboard",
"query_copy_error": "Copy error to clipboard",
"query_first_page": "Go to first page",
"query_previous_page": "Go to previous page",
"query_next_page": "Go to next page",
"query_last_page": "Go to last page",
"query_copy_cell": "Copy Cell Value",
"query_copy_row": "Copy Row as JSON",
"query_copy_column": "Copy Column Values",
Expand All @@ -254,6 +259,9 @@
"history_no_history": "No query history found",
"history_no_saved": "No saved queries found",
"history_save_hint": "Save queries to access them later",
"history_add_favorite": "Add to favorites",
"history_remove_favorite": "Remove from favorites",
"history_delete_saved": "Delete saved query",
"row_actions_delete": "Delete Row",
"save_query_title": "Save Query",
"save_query_description": "Give your query a name to save it for later use",
Expand Down
8 changes: 8 additions & 0 deletions messages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@
"query_row_copied": "Fila copiada como JSON",
"query_column_copied": "Valores de columna copiados",
"query_error_copied": "Error copiado al portapapeles",
"query_copy_error": "Copiar error al portapapeles",
"query_first_page": "Ir a la primera página",
"query_previous_page": "Ir a la página anterior",
"query_next_page": "Ir a la página siguiente",
"query_last_page": "Ir a la última página",
"query_copy_cell": "Copiar valor de celda",
"query_copy_row": "Copiar fila como JSON",
"query_copy_column": "Copiar valores de columna",
Expand All @@ -254,6 +259,9 @@
"history_no_history": "No se encontró historial de consultas",
"history_no_saved": "No se encontraron consultas guardadas",
"history_save_hint": "Guarda consultas para acceder a ellas más tarde",
"history_add_favorite": "Agregar a favoritos",
"history_remove_favorite": "Quitar de favoritos",
"history_delete_saved": "Eliminar consulta guardada",
"row_actions_delete": "Eliminar fila",
"save_query_title": "Guardar consulta",
"save_query_description": "Dale un nombre a tu consulta para guardarla para uso posterior",
Expand Down
8 changes: 8 additions & 0 deletions messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@
"query_row_copied": "Ligne copiée en JSON",
"query_column_copied": "Valeurs de la colonne copiées",
"query_error_copied": "Erreur copiée dans le presse-papiers",
"query_copy_error": "Copier l'erreur dans le presse-papiers",
"query_first_page": "Aller à la première page",
"query_previous_page": "Aller à la page précédente",
"query_next_page": "Aller à la page suivante",
"query_last_page": "Aller à la dernière page",
"query_copy_cell": "Copier la valeur de la cellule",
"query_copy_row": "Copier la ligne en JSON",
"query_copy_column": "Copier les valeurs de la colonne",
Expand All @@ -254,6 +259,9 @@
"history_no_history": "Aucun historique de requêtes trouvé",
"history_no_saved": "Aucune requête enregistrée trouvée",
"history_save_hint": "Enregistrez des requêtes pour y accéder plus tard",
"history_add_favorite": "Ajouter aux favoris",
"history_remove_favorite": "Retirer des favoris",
"history_delete_saved": "Supprimer la requête enregistrée",
"row_actions_delete": "Supprimer la ligne",
"save_query_title": "Enregistrer la requête",
"save_query_description": "Donnez un nom à votre requête pour l'enregistrer pour une utilisation ultérieure",
Expand Down
8 changes: 8 additions & 0 deletions messages/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@
"query_row_copied": "행이 JSON으로 복사되었습니다",
"query_column_copied": "열 값이 복사되었습니다",
"query_error_copied": "오류가 클립보드에 복사되었습니다",
"query_copy_error": "오류를 클립보드에 복사",
"query_first_page": "첫 페이지로 이동",
"query_previous_page": "이전 페이지로 이동",
"query_next_page": "다음 페이지로 이동",
"query_last_page": "마지막 페이지로 이동",
"query_copy_cell": "셀 값 복사",
"query_copy_row": "행을 JSON으로 복사",
"query_copy_column": "열 값 복사",
Expand All @@ -254,6 +259,9 @@
"history_no_history": "쿼리 기록이 없습니다",
"history_no_saved": "저장된 쿼리가 없습니다",
"history_save_hint": "나중에 접근하려면 쿼리를 저장하세요",
"history_add_favorite": "즐겨찾기에 추가",
"history_remove_favorite": "즐겨찾기에서 제거",
"history_delete_saved": "저장된 쿼리 삭제",
"row_actions_delete": "행 삭제",
"save_query_title": "쿼리 저장",
"save_query_description": "나중에 사용할 수 있도록 쿼리에 이름을 지정하세요",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/command-palette.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

// Derived state for dynamic commands
const tables = $derived(
db.state.activeConnectionId ? db.state.schemas.get(db.state.activeConnectionId) || [] : []
db.state.activeConnectionId ? db.state.schemas[db.state.activeConnectionId] ?? [] : []
);
const connections = $derived(db.state.connections);
const savedQueries = $derived(db.state.activeConnectionSavedQueries);
Expand Down
137 changes: 20 additions & 117 deletions src/lib/components/connection-dialog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
} from "$lib/components/ui/tabs";
import type { DatabaseType, SSHAuthMethod } from "$lib/types";
import { toast } from "svelte-sonner";
import { open as openFileDialog } from "@tauri-apps/plugin-dialog";
import CopyIcon from "@lucide/svelte/icons/copy";
import { SshTunnelConfig } from "$lib/components/connection-dialog/index.js";

let { open = $bindable(false), prefill = undefined }: Props = $props();
const db = useDatabase();
Expand Down Expand Up @@ -400,20 +400,6 @@
}
};

const selectSshKeyFile = async () => {
try {
const selected = await openFileDialog({
multiple: false,
title: "Select SSH Key File",
});
if (selected && typeof selected === "string") {
formData.sshKeyPath = selected;
}
} catch (error) {
console.error("Failed to select file:", error);
}
};

type Props = {
open?: boolean;
prefill?: {
Expand Down Expand Up @@ -641,108 +627,25 @@
{/if}

<!-- SSH Tunnel Section -->
<div class="border-t pt-4 mt-2">
<div class="flex items-center gap-3 mb-4">
<input
type="checkbox"
id="ssh-enabled"
bind:checked={formData.sshEnabled}
class="h-4 w-4 rounded border-gray-300"
/>
<Label for="ssh-enabled" class="cursor-pointer">{m.connection_dialog_label_ssh_tunnel()}</Label>
</div>

{#if formData.sshEnabled}
<div class="flex flex-col gap-4">
<div class="grid grid-cols-3 gap-2">
<div class="col-span-2 grid gap-2">
<Label for="ssh-host">{m.connection_dialog_label_ssh_host()}</Label>
<Input
id="ssh-host"
bind:value={formData.sshHost}
placeholder={m.connection_dialog_placeholder_ssh_host()}
/>
</div>
<div class="grid gap-2">
<Label for="ssh-port">{m.connection_dialog_label_ssh_port()}</Label>
<Input
id="ssh-port"
type="number"
bind:value={formData.sshPort}
/>
</div>
</div>

<div class="grid gap-2">
<Label for="ssh-username">{m.connection_dialog_label_ssh_username()}</Label>
<Input
id="ssh-username"
bind:value={formData.sshUsername}
placeholder={m.connection_dialog_placeholder_ssh_username()}
/>
</div>

<div class="grid gap-2">
<Label>{m.connection_dialog_label_auth_method()}</Label>
<Select
type="single"
value={formData.sshAuthMethod}
onValueChange={(value) => (formData.sshAuthMethod = value as SSHAuthMethod)}
>
<SelectTrigger class="w-full">
{formData.sshAuthMethod === "password" ? m.connection_dialog_auth_method_password() : m.connection_dialog_auth_method_ssh_key()}
</SelectTrigger>
<SelectContent>
<SelectItem value="password">{m.connection_dialog_auth_method_password()}</SelectItem>
<SelectItem value="key">{m.connection_dialog_auth_method_ssh_key()}</SelectItem>
</SelectContent>
</Select>
</div>

{#if formData.sshAuthMethod === "password"}
<div class="grid gap-2">
<Label for="ssh-password">{m.connection_dialog_label_ssh_password()}</Label>
<Input
id="ssh-password"
type="password"
bind:value={formData.sshPassword}
placeholder={m.connection_dialog_placeholder_ssh_password()}
/>
</div>
{:else}
<div class="grid gap-2">
<Label for="ssh-key-path">{m.connection_dialog_label_ssh_key_file()}</Label>
<div class="flex gap-2">
<Input
id="ssh-key-path"
bind:value={formData.sshKeyPath}
placeholder={m.connection_dialog_placeholder_ssh_key_path()}
class="flex-1"
/>
<Button variant="outline" type="button" onclick={selectSshKeyFile}>
{m.connection_dialog_button_browse()}
</Button>
</div>
</div>
<div class="grid gap-2">
<Label for="ssh-key-passphrase">{m.connection_dialog_label_key_passphrase()}</Label>
<Input
id="ssh-key-passphrase"
type="password"
bind:value={formData.sshKeyPassphrase}
placeholder={m.connection_dialog_placeholder_optional()}
/>
</div>
{/if}

{#if isReconnecting && formData.sshEnabled}
<p class="text-xs text-amber-600 dark:text-amber-500">
⚠ {m.connection_dialog_warning_ssh()}
</p>
{/if}
</div>
{/if}
</div>
<SshTunnelConfig
enabled={formData.sshEnabled}
host={formData.sshHost}
port={formData.sshPort}
username={formData.sshUsername}
authMethod={formData.sshAuthMethod}
password={formData.sshPassword}
keyPath={formData.sshKeyPath}
keyPassphrase={formData.sshKeyPassphrase}
{isReconnecting}
onEnabledChange={(v) => formData.sshEnabled = v}
onHostChange={(v) => formData.sshHost = v}
onPortChange={(v) => formData.sshPort = v}
onUsernameChange={(v) => formData.sshUsername = v}
onAuthMethodChange={(v) => formData.sshAuthMethod = v}
onPasswordChange={(v) => formData.sshPassword = v}
onKeyPathChange={(v) => formData.sshKeyPath = v}
onKeyPassphraseChange={(v) => formData.sshKeyPassphrase = v}
/>
{/if}
</TabsContent>
</Tabs>
Expand Down
1 change: 1 addition & 0 deletions src/lib/components/connection-dialog/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as SshTunnelConfig } from './ssh-tunnel-config.svelte';
Loading
Loading