-
-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix errors when re-using tabs with different cols (#1074)
- Loading branch information
Showing
3 changed files
with
31 additions
and
25 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
...ns/connection-manager/webview/ui/screens/Results/components/Table/computeColumnWidths.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import get from 'lodash/get'; | ||
import _ from 'lodash'; | ||
const computeColumnWidths = (colNames: string[], rows: object[]) => { | ||
const firstRows = rows.slice(0, 5); | ||
const values = colNames.map(columnName => { | ||
const maxCharacters = Math.max(...firstRows.map(row => JSON.stringify(get(row, [columnName], '')).length - 2)); | ||
return Math.min(Math.max(20, maxCharacters) * 7.5, 600); | ||
}); | ||
return _.zipObject(colNames, values); | ||
} | ||
export default computeColumnWidths; |
8 changes: 0 additions & 8 deletions
8
...nnection-manager/webview/ui/screens/Results/components/Table/generateColumnExtensions.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters