Skip to content

Commit

Permalink
truncate json preview in tasks table
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheraff committed Jul 7, 2024
1 parent 897d7fb commit 8151534
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion admin/client/jobs/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,13 @@ export const columns: ColumnDef<Task>[] = [
),
cell: ({ getValue }) => {
const raw = JSON.parse(getValue() as string)
const lines = JSON.stringify(raw, null, 2).split('\n')
let lines = JSON.stringify(raw, null, 2).split('\n')
lines.pop()
lines.shift()
if (lines.length > 5) {
lines = lines.slice(0, 5)
lines.push(' ...')
}
const str = lines.map(l => l.slice(2)).join('\n')


Expand Down

0 comments on commit 8151534

Please sign in to comment.