mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-24 09:14:46 +01:00
Remove wrap on plugin logs table (#4246)
* remove wrap on plugin logs table * Implement a real fix by checking if ResizableTableProps.expandable is set Co-authored-by: Michael Matloka <dev@twixes.com>
This commit is contained in:
parent
da040fc024
commit
c4f8abbdfc
@ -15,6 +15,7 @@ interface VirtualTableHeaderProps<RecordType> {
|
||||
handleResize: (index: number) => ResizeHandler
|
||||
layoutEffect?: CallableFunction
|
||||
minColumnWidth: number
|
||||
expandable?: boolean
|
||||
}
|
||||
|
||||
function ResizableTitle({
|
||||
@ -66,13 +67,14 @@ function VirtualTableHeader<RecordType>({
|
||||
handleResize,
|
||||
layoutEffect,
|
||||
minColumnWidth,
|
||||
expandable,
|
||||
}: VirtualTableHeaderProps<RecordType>): JSX.Element {
|
||||
const maxColumnWidth = minColumnWidth * 12
|
||||
const height = 60
|
||||
useLayoutEffect(() => (typeof layoutEffect === 'function' ? layoutEffect() : undefined))
|
||||
return (
|
||||
<div className="resizable-virtual-table-header">
|
||||
<div className="left-spacer" style={{ width: ANTD_EXPAND_BUTTON_WIDTH }} />
|
||||
{expandable && <div className="left-spacer" style={{ width: ANTD_EXPAND_BUTTON_WIDTH }} />}
|
||||
{columns.map(({ title, width }, index) => (
|
||||
<ResizableTitle
|
||||
key={index}
|
||||
|
@ -83,7 +83,7 @@ export function ResizableTable<RecordType extends Record<any, any> = any>({
|
||||
function updateColumnWidth(index: number, width: number): void {
|
||||
const col = scrollWrapperRef.current?.querySelector(
|
||||
// nth-child is 1-indexed. first column is fixed. last column width must be uncontrolled.
|
||||
`.ant-table-content colgroup col:nth-child(${index + 2}):not(:last-child)`
|
||||
`.ant-table-content colgroup col:nth-child(${index + 1 + Number(!!props.expandable)}):not(:last-child)`
|
||||
)
|
||||
col?.setAttribute('style', `width: ${width}px;`)
|
||||
}
|
||||
@ -141,7 +141,10 @@ export function ResizableTable<RecordType extends Record<any, any> = any>({
|
||||
? column
|
||||
: {
|
||||
...column,
|
||||
width: Math.max((columnWidths[index + 1] ?? 0) * resizeRatio, minColumnWidth),
|
||||
width: Math.max(
|
||||
(columnWidths[index + Number(!!props.expandable)] ?? 0) * resizeRatio,
|
||||
minColumnWidth
|
||||
),
|
||||
}
|
||||
)
|
||||
nextColumns.slice(0, lastIndex).forEach((col, index) => {
|
||||
@ -208,6 +211,7 @@ export function ResizableTable<RecordType extends Record<any, any> = any>({
|
||||
handleResize={handleColumnResize}
|
||||
layoutEffect={updateTableWidth}
|
||||
minColumnWidth={minColumnWidth}
|
||||
expandable={!!props.expandable}
|
||||
/>
|
||||
)}
|
||||
<Table
|
||||
|
@ -64,3 +64,10 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.plugin-logs {
|
||||
td.ant-table-cell {
|
||||
white-space: normal;
|
||||
text-overflow: unset;
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ export function PluginLogs({ teamId, pluginConfigId }: PluginLogsProps): JSX.Ele
|
||||
const { revealBackground, loadPluginLogsMore, loadPluginLogsSearch } = useActions(logic)
|
||||
|
||||
return (
|
||||
<Space direction="vertical" style={{ flexGrow: 1 }} className="ph-no-capture">
|
||||
<Space direction="vertical" style={{ flexGrow: 1 }} className="ph-no-capture plugin-logs">
|
||||
<Row>
|
||||
<Search
|
||||
loading={pluginLogsLoading}
|
||||
|
Loading…
Reference in New Issue
Block a user