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: 6 additions & 2 deletions e2e/pages/results-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class ResultsPage {
}

// ── Export ───────────────────────────────────────────────────────────────
/** The "Export as" options dialog (note: "Save to file" itself uses a native dialog). */
/** The export options dialog (note: "Save to file" itself uses a native dialog). */
get exportDialog(): Locator {
return this.page.locator('.modal').filter({ has: this.page.locator('#export-format') });
}
Expand All @@ -130,12 +130,16 @@ export class ResultsPage {
return this.page.locator('#export-rows-group');
}

get exportColumnsGroup(): Locator {
return this.page.locator('#export-cols-group');
}

get exportSummary(): Locator {
return this.page.locator('.export-results-summary');
}

async openExportDialog(): Promise<void> {
await this.activeSet.getByRole('button', { name: 'Export as' }).click();
await this.activeSet.getByRole('button', { name: 'Export', exact: true }).click();
await expect(this.exportDialog).toBeVisible();
}

Expand Down
7 changes: 6 additions & 1 deletion e2e/specs/results/export.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { POSTGRES } from '@support/databases';
import { expect, test } from '@support/fixtures';

// Covers the "Export as" dialog UI only. "Save to file" (native OS dialog) and
// Covers the export dialog UI only. "Save to file" (native OS dialog) and
// "Copy to clipboard" (Wails clipboard) aren't driven here.
test.describe('Export', () => {
test('switches format and scope and reflects them in the summary', async ({ connections, editor, results }) => {
Expand All @@ -16,6 +16,11 @@ test.describe('Export', () => {
const selectedRows = results.exportRowsGroup.getByRole('button', { name: /Selected/ });
await expect(selectedRows).toBeDisabled();

// With no column hidden, "Visible" would duplicate "All", so only "All" is offered.
const colsGroup = results.exportColumnsGroup;
await expect(colsGroup.getByRole('button', { name: 'All (2)' })).toHaveClass(/active/);
await expect(colsGroup.getByRole('button', { name: /Visible/ })).toHaveCount(0);

await results.setExportFormat('json');
await expect(results.exportSummary).toContainText('JSON');

Expand Down
2 changes: 1 addition & 1 deletion e2e/specs/table-view/columns.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test.describe('Table view - column visibility', () => {
await expect(tableView.columnsButton).toContainText('(1/2)');

// The export dialog defaults to the visible-column scope.
await tableView.pane.getByRole('button', { name: 'Export as' }).click();
await tableView.pane.getByRole('button', { name: 'Export', exact: true }).click();
const colsGroup = page.locator('#export-cols-group');
await expect(colsGroup.getByRole('button', { name: 'All (2)' })).toBeVisible();
await expect(colsGroup.getByRole('button', { name: 'Visible (1)' })).toHaveClass(/active/);
Expand Down
8 changes: 8 additions & 0 deletions frontend/bindings/xensql/internal/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ import * as storage$0 from "../storage/models.js";
// @ts-ignore: Unused imports
import * as $models from "./models.js";

/**
* AppendTextFile writes one chunk, emptying the file first when truncate is set. Each chunk opens and
* closes the file, so nothing leaks if the caller stops part-way.
*/
export function AppendTextFile(path: string, chunk: string, truncate: boolean): $CancellablePromise<void> {
return $Call.ByID(403815492, path, chunk, truncate);
}

/**
* BeginTransaction pins a dedicated connection to the tab and opens a transaction.
* Subsequent ExecuteQueryStream calls for tabID will run on that connection until
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/features/results/ResultsGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ function ResultsGridImpl({
selectionRef,
focusRef,
});
const { copyFormat, setCopyFormat, exportBusy, copyToClipboard, exportToFile } = copyExport;
const { copyFormat, setCopyFormat, copyToClipboard } = copyExport;
const copySelectionToClipboard = useCallback(() => copyToClipboard(true), [copyToClipboard]);
const copyButtonToClipboard = useCallback(() => copyToClipboard(false), [copyToClipboard]);

Expand Down Expand Up @@ -428,10 +428,8 @@ function ResultsGridImpl({
}
copyFormat={copyFormat}
onFormatChange={setCopyFormat}
exportBusy={exportBusy}
onCopy={copyButtonToClipboard}
onExportToFile={exportToFile}
onExportAs={() => setExportOpen(true)}
onExport={() => setExportOpen(true)}
/>

<GridTable
Expand Down
16 changes: 2 additions & 14 deletions frontend/src/features/table-view/TableViewGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,20 +292,10 @@ export const TableViewGrid = memo(function TableViewGrid({
lastCopyRef.current = copied;
},
});
const { copyFormat, setCopyFormat, exportBusy, copyToClipboard, exportToFile } = copyExport;
const { copyFormat, setCopyFormat, copyToClipboard } = copyExport;
const copyButtonToClipboard = useCallback(() => copyToClipboard(false), [copyToClipboard]);
const copySelectionToClipboard = useCallback(() => copyToClipboard(true), [copyToClipboard]);

const exportAllLoaded = useCallback(async () => {
const saved = selectionRef.current;
selectionRef.current = { rows: new Set(), cols: new Set() };
try {
await exportToFile();
} finally {
selectionRef.current = saved;
}
}, [exportToFile, selectionRef]);

const { selectionRowsCount, selectionColsCount, selectedSortedRows, selectedColPositions } = useGridSelectionView({
cellRange,
selectedRows,
Expand Down Expand Up @@ -467,10 +457,8 @@ export const TableViewGrid = memo(function TableViewGrid({
}
copyFormat={copyFormat}
onFormatChange={setCopyFormat}
exportBusy={exportBusy}
onCopy={copyButtonToClipboard}
onExportToFile={exportAllLoaded}
onExportAs={() => setExportOpen(true)}
onExport={() => setExportOpen(true)}
/>

<GridTable
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/i18n/locales/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@
"savedFile": "Запазено като {{fileName}}",
"exportCopied": "Експортът е копиран в клипборда",
"connectionSuccess": "Връзката е успешна!",
"savedQuery": "Заявката е запазена"
"savedQuery": "Заявката е запазена",
"exportStopped": "Експортирането е спряно - {{fileName}} съдържа само първите {{count}} ред(а)"
},
"tooltip": {
"runStatement": "Изпълни тази заявка",
Expand All @@ -123,7 +124,6 @@
"copyFormat": "Формат за копиране и експорт",
"cellViewerKind": "Преглед на съдържанието като",
"copyResults": "Копирай резултатите в клипборда",
"exportFile": "Запази резултатите във файл",
"exportOptions": "Експорт с опции за редове, колони и формат",
"showHideColumns": "Покажи или скрий колони",
"resultsColumnHeader": "Клик за сортиране · Ctrl+клик за колона · Shift+клик за диапазон",
Expand Down Expand Up @@ -230,7 +230,6 @@
"txnCommit": "Транзакцията е потвърдена",
"txnRollback": "Транзакцията е отменена",
"fitColumns": "Оразмери колоните",
"exportAs": "Експорт като",
"export": "Експорт",
"deleteRows": "Изтрий ({{count}})",
"contextExportAs": "Експорт като",
Expand Down Expand Up @@ -266,7 +265,9 @@
"formatCsv": "CSV",
"formatJson": "JSON",
"formatMarkdown": "Markdown",
"formatSql": "SQL INSERT"
"formatSql": "SQL INSERT",
"progress": "Експортиране… {{done}} от {{total}} реда записани",
"stop": "Спиране"
},
"sidebar": {
"connect": "Свържи",
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@
"savedFile": "Gespeichert als {{fileName}}",
"exportCopied": "Export in Zwischenablage kopiert",
"connectionSuccess": "Verbindung erfolgreich!",
"savedQuery": "Abfrage gespeichert"
"savedQuery": "Abfrage gespeichert",
"exportStopped": "Export abgebrochen - {{fileName}} enthält nur die ersten {{count}} Zeile(n)"
},
"tooltip": {
"runStatement": "Diese Anweisung ausführen",
Expand All @@ -123,7 +124,6 @@
"copyFormat": "Format für Kopieren und Export",
"cellViewerKind": "Inhalt anzeigen als",
"copyResults": "Ergebnisse in Zwischenablage kopieren",
"exportFile": "Ergebnisse in Datei speichern",
"exportOptions": "Export mit Zeilen-, Spalten- und Formatoptionen",
"showHideColumns": "Spalten ein- oder ausblenden",
"resultsColumnHeader": "Klicken zum Sortieren · Strg+Klick Spalte wählen · Umschalt+Klick Bereich",
Expand Down Expand Up @@ -230,7 +230,6 @@
"txnCommit": "Transaktion bestätigt",
"txnRollback": "Transaktion zurückgerollt",
"fitColumns": "Spalten anpassen",
"exportAs": "Exportieren als",
"export": "Exportieren",
"deleteRows": "Löschen ({{count}})",
"contextExportAs": "Exportieren als",
Expand Down Expand Up @@ -266,7 +265,9 @@
"formatCsv": "CSV",
"formatJson": "JSON",
"formatMarkdown": "Markdown",
"formatSql": "SQL INSERT"
"formatSql": "SQL INSERT",
"progress": "Exportiert… {{done}} von {{total}} Zeilen geschrieben",
"stop": "Stoppen"
},
"sidebar": {
"connect": "Verbinden",
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@
"savedFile": "Saved as {{fileName}}",
"exportCopied": "Export copied to clipboard",
"connectionSuccess": "Connection successful!",
"savedQuery": "Query saved"
"savedQuery": "Query saved",
"exportStopped": "Export stopped - {{fileName}} holds only the first {{count}} row(s)"
},
"tooltip": {
"runStatement": "Run this statement",
Expand All @@ -123,7 +124,6 @@
"copyFormat": "Format used for copy and export",
"cellViewerKind": "View content as",
"copyResults": "Copy results to clipboard",
"exportFile": "Save results to file",
"exportOptions": "Export with row, column and format options",
"showHideColumns": "Show or hide columns",
"resultsColumnHeader": "Click to sort · Ctrl+click to select column · Shift+click for range",
Expand Down Expand Up @@ -230,7 +230,6 @@
"txnCommit": "Transaction committed",
"txnRollback": "Transaction rolled back",
"fitColumns": "Fit columns",
"exportAs": "Export as",
"export": "Export",
"deleteRows": "Delete ({{count}})",
"contextExportAs": "Export as",
Expand Down Expand Up @@ -266,7 +265,9 @@
"formatCsv": "CSV",
"formatJson": "JSON",
"formatMarkdown": "Markdown",
"formatSql": "SQL INSERT"
"formatSql": "SQL INSERT",
"progress": "Exporting… {{done}} of {{total}} rows written",
"stop": "Stop"
},
"sidebar": {
"connect": "Connect",
Expand Down
Loading
Loading