Skip to content

Commit fd8f848

Browse files
committed
feat: support multi-line output in query results
1 parent 7611c07 commit fd8f848

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

ui/src/routes/query.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,29 @@ function Query() {
7171
<Card className="p-2 overflow-auto">
7272
<DataGrid
7373
defaultColumnOptions={{ resizable: true }}
74-
columns={data.columns.map((col) => ({ key: col, name: col }))}
74+
columns={data.columns.map((col) => ({
75+
key: col,
76+
name: col,
77+
renderCell: ({ row }: { row: Record<string, unknown> }) => (
78+
<div style={{ whiteSpace: "pre-wrap" }}>
79+
{String(row[col] ?? "")}
80+
</div>
81+
),
82+
}))}
7583
rows={data.rows.map((row) =>
7684
row.reduce((acc, curr, i) => {
7785
acc[data.columns[i]] = curr;
7886
return acc;
7987
}, {}),
8088
)}
89+
rowHeight={(row) => {
90+
const maxLines = data.columns.reduce((max, col) => {
91+
const val = String(row[col] ?? "");
92+
const lines = val.split(/\r?\n/).length;
93+
return Math.max(max, lines);
94+
}, 1);
95+
return Math.max(35, maxLines * 20 + 15);
96+
}}
8197
className={cn(currentTheme === "light" ? "rdg-light" : "rdg-dark")}
8298
/>
8399
</Card>

0 commit comments

Comments
 (0)