Skip to content

Commit

Permalink
feat: add export rows as json (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
rin-yato authored Jul 25, 2024
1 parent 2e1fd81 commit c1ccd0f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/components/gui/query-result-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import OptimizeTableState from "@/components/gui/table-optimized/OptimizeTableSt
import {
exportRowsToExcel,
exportRowsToSqlInsert,
exportRowsToJson,
} from "@/components/lib/export-helper";
import { KEY_BINDING } from "@/lib/key-matcher";
import {
Expand Down Expand Up @@ -434,6 +435,20 @@ export default function ResultTable({
}
},
},
{
title: "Copy as Json",
onClick: () => {
const headers = state
.getHeaders()
.map((column) => column?.name ?? "");

if (state.getSelectedRowCount() > 0) {
window.navigator.clipboard.writeText(
exportRowsToJson(headers, state.getSelectedRowsArray())
);
}
},
},
{
title: "Copy as INSERT SQL",
onClick: () => {
Expand Down

0 comments on commit c1ccd0f

Please sign in to comment.