Skip to content

Commit 0deef18

Browse files
author
serhii.zahuba
committed
fix lint 3
1 parent a70dffa commit 0deef18

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

frontend/src/features/sqlquery/SqlQueryComponent.tsx

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ function toCsv(resp: ExecuteResponse): string {
2929
return [header, ...rows].join('\n');
3030
}
3131

32-
3332
function friendlyError(msg: string): string {
3433
const m = msg || 'Unexpected error';
3534
if (/SQLSTATE\s*42P01/i.test(m) || /relation .* does not exist/i.test(m)) {
@@ -60,14 +59,16 @@ export const SqlQueryComponent = ({ databaseId }: Props) => {
6059
}));
6160
}, [resp]);
6261

63-
const dataSource = useMemo(() => {
64-
if (!resp) return [];
65-
return resp.rows.map((row, i) => {
66-
const record: Record<string, unknown> = { key: i };
67-
row.forEach((v, idx) => { record[`c${idx}`] = v; });
68-
return record;
69-
});
70-
}, [resp]);
62+
const dataSource = useMemo(() => {
63+
if (!resp) return [];
64+
return resp.rows.map((row, i) => {
65+
const record: Record<string, unknown> = { key: i };
66+
row.forEach((v, idx) => {
67+
record[`c${idx}`] = v;
68+
});
69+
return record;
70+
});
71+
}, [resp]);
7172

7273
const run = async () => {
7374
if (!sql.trim()) {
@@ -116,23 +117,23 @@ const dataSource = useMemo(() => {
116117
URL.revokeObjectURL(url);
117118
};
118119

119-
const downloadJson = () => {
120-
if (!resp) return;
121-
const items = resp.rows.map((row) => {
122-
const obj: Record<string, unknown> = {};
123-
resp.columns.forEach((name, i) => {
124-
obj[name || `col_${i + 1}`] = row[i];
120+
const downloadJson = () => {
121+
if (!resp) return;
122+
const items = resp.rows.map((row) => {
123+
const obj: Record<string, unknown> = {};
124+
resp.columns.forEach((name, i) => {
125+
obj[name || `col_${i + 1}`] = row[i];
126+
});
127+
return obj;
125128
});
126-
return obj;
127-
});
128-
const blob = new Blob([JSON.stringify(items, null, 2)], { type: 'application/json' });
129-
const url = URL.createObjectURL(blob);
130-
const a = document.createElement('a');
131-
a.href = url;
132-
a.download = 'result.json';
133-
a.click();
134-
URL.revokeObjectURL(url);
135-
};
129+
const blob = new Blob([JSON.stringify(items, null, 2)], { type: 'application/json' });
130+
const url = URL.createObjectURL(blob);
131+
const a = document.createElement('a');
132+
a.href = url;
133+
a.download = 'result.json';
134+
a.click();
135+
URL.revokeObjectURL(url);
136+
};
136137

137138
return (
138139
<div className="mt-2 rounded border border-gray-200 bg-white p-3">

frontend/src/features/sqlquery/api.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@ export interface ExecuteRequest {
1111
type SqlValue = string | number | boolean | null;
1212

1313
export interface ExecuteResponse {
14-
columns: string[];
15-
rows: SqlValue[][];
16-
row_count: number;
17-
truncated: boolean;
18-
execution_ms: number;
14+
columns: string[];
15+
rows: SqlValue[][];
16+
row_count: number;
17+
truncated: boolean;
18+
execution_ms: number;
1919
}
2020

21-
2221
export const sqlqueryApi = {
2322
execute: async (payload: ExecuteRequest): Promise<ExecuteResponse> => {
2423
const opts = new RequestOptions().setBody(JSON.stringify(payload));

0 commit comments

Comments
 (0)