mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-04-21 13:37:15 +00:00
## Summary
Closes HDX-2701
Enables horizontal scrolling on the search results table so that column content is no longer clipped when the viewport is narrower than the total column widths, and improves table header styling, resize interactions, and scrollbar aesthetics.
### Changes
- **Dynamic `minWidth` on the table element** — Computes the sum of all column widths from TanStack Table's sizing state (substituting a 200px minimum for the flexible last column) and sets it as an inline `min-width` on the `<table>`. When the container is narrower than this threshold, the table overflows and the wrapper scrolls horizontally. When wider, `width: 100%` ensures the table fills the container normally.
- **Dynamic last column width** — Uses a `ResizeObserver` to track container width and computes the last column size as the remaining space after all other columns, instead of using the `UNDEFINED_WIDTH` sentinel. This ensures the last column fills remaining space responsively while respecting a 200px minimum.
- **Minimum column width** — Added `MIN_COLUMN_WIDTH` (50px) via TanStack Table's `defaultColumn.minSize` to prevent columns from being resized below a usable size. Explicitly set `minSize: 32` on the expand button column to prevent it from inheriting the 50px default.
- **Last column resizing** — Removed the `!isLast` guard so the last column now has a resize handle, making all columns consistently resizable.
- **Resize handle redesign** — Replaced the `IconGripVertical` drag icon with a minimal 1px vertical line using a CSS `::after` pseudo-element, styled with the new `--color-border-emphasis` token.
- **`min-width: 0` on flex containers** — Added `miw={0}` to the `DBSearchPage` results and pattern containers so flex children can shrink below their content size, allowing overflow to trigger scrolling.
- **Consolidate utility classes into SCSS module** — Moved `overflow: auto`, `height: 100%`, and `font-size` from inline Bootstrap utility classes into `.tableWrapper`, and moved `width: 100%` into `.table` in `LogTable.module.scss`.
- **Replace `Button` with `UnstyledButton` for sort headers** — Replaced Mantine `Button` with `UnstyledButton` for column sort headers, with custom SCSS that only darkens text on hover (no background).
- **Consolidate header styles into `TableHeader.module.scss`** — Moved `.cursorColResize` from `Table.module.scss` and `.headerCellWithAction`/`.headerRemoveButton` from `LogTable.module.scss` into a new `TableHeader.module.scss`, co-located with `TableHeader.tsx`.
- **Refactor `CsvExportButton`** — Removed the `UnstyledButton` wrapper around `CSVDownloader` to eliminate invalid `<a>` inside `<button>` markup. The `CSVDownloader` is now the root element with inline flex styling.
- **New `--color-border-emphasis` design token** — Added a slightly more prominent border color token for UI elements like resize handles, defined across HyperDX and ClickStack themes in both light and dark modes.
- **Global thin scrollbar styling** — Added app-wide custom scrollbar styles in `globals.css` for both WebKit and Firefox, providing thin (6px), rounded, semi-transparent scrollbars using theme color tokens.
### Files changed
- `packages/app/src/components/DBRowTable.tsx` — Added `containerWidth` tracking via `ResizeObserver`; added `tableMinWidth` and `lastColumnWidth` computations; set inline `minWidth` on table; added `defaultColumn.minSize`; moved utility classes to SCSS
- `packages/app/src/DBSearchPage.tsx` — Added `miw={0}` to results and pattern container Flex wrappers
- `packages/app/src/components/DBTable/TableHeader.tsx` — Replaced `Button` with `UnstyledButton`; removed `IconGripVertical`; enabled last column resizing; consolidated all style imports to `TableHeader.module.scss`
- `packages/app/src/components/DBTable/TableHeader.module.scss` *(new)* — Styles for `.sortButton`, `.resizer` (with `::after` pseudo-element line), `.headerCellWithAction`, and `.headerRemoveButton`
- `packages/app/src/components/CsvExportButton.tsx` — Removed `UnstyledButton` wrapper; `CSVDownloader` is now the root element with flex layout
- `packages/app/src/components/ExpandableRowTable.tsx` — Added `minSize: 32` to expand button column to prevent inheriting 50px default
- `packages/app/src/components/Table.module.scss` — Removed `.cursorColResize` (moved to `TableHeader.module.scss`)
- `packages/app/src/tableUtils.tsx` — Added `MIN_LAST_COLUMN_WIDTH` and `MIN_COLUMN_WIDTH` constants
- `packages/app/src/theme/themes/hyperdx/_tokens.scss` — Added `--color-border-emphasis` token
- `packages/app/src/theme/themes/clickstack/_tokens.scss` — Added `--color-border-emphasis` token
- `packages/app/src/theme/semanticColorsGrouped.ts` — Registered `color-border-emphasis` in borders group
- `packages/app/styles/LogTable.module.scss` — Added `overflow`, `height`, `font-size` to `.tableWrapper`; added `width: 100%` to `.table`; removed header styles (moved to `TableHeader.module.scss`)
- `packages/app/styles/globals.css` — Added global thin scrollbar styles for WebKit and Firefox
## Test plan
- [x] Open the Search page with multiple columns selected (e.g. Timestamp, ServiceName, SeverityText, Body, ScopeName)
- [x] Narrow the browser window — verify a horizontal scrollbar appears and columns are not cut off
- [x] Scroll horizontally — verify all column content is accessible
- [x] Widen the browser window — verify the table fills the container and no unnecessary scrollbar appears
- [x] Verify the last column still expands to fill remaining space on wide viewports
- [x] Resize columns via drag handles — verify horizontal scroll adjusts dynamically and columns cannot be resized below ~50px
- [x] Resize the **last** column — verify it now has a resize handle and works correctly
- [x] Verify the resize handle appears as a thin vertical line (not the old grip icon)
- [x] Hover over column sort headers — verify text darkens with no background change
- [x] Hover over column headers with remove button — verify remove button appears on hover
- [x] Click "Download table as CSV" — verify it works without layout issues
- [x] Verify scrollbars across the app are thin, rounded, and semi-transparent
- [x] Verify wrap lines toggle still works correctly
- [x] Switch to Event Patterns analysis mode — verify no layout regressions
- [x] Check the table in other contexts (Dashboard tiles, Pattern side panel) to confirm no layout regressions
236 lines
4.1 KiB
SCSS
236 lines
4.1 KiB
SCSS
$button-height: 18px;
|
|
|
|
.tableWrapper {
|
|
overflow: auto;
|
|
height: 100%;
|
|
font-size: var(--mantine-font-size-xs);
|
|
|
|
/* CSS custom properties for variant support */
|
|
--log-table-bg: var(--color-bg-body);
|
|
--log-table-muted-bg: var(--color-bg-muted);
|
|
|
|
&.muted {
|
|
--log-table-bg: var(--color-bg-muted);
|
|
--log-table-muted-bg: var(--color-bg-highlighted);
|
|
}
|
|
}
|
|
|
|
.table {
|
|
width: 100%;
|
|
table-layout: fixed;
|
|
border-spacing: 0;
|
|
border-collapse: separate;
|
|
background: var(--log-table-bg);
|
|
font-family: var(--font-ibm-plex-mono);
|
|
}
|
|
|
|
.tableHead {
|
|
background: var(--log-table-bg);
|
|
position: sticky;
|
|
top: 0;
|
|
z-index: 1;
|
|
height: 24px;
|
|
}
|
|
|
|
.tableRow {
|
|
position: relative;
|
|
|
|
&__selected {
|
|
background-color: var(--log-table-muted-bg);
|
|
font-weight: bold;
|
|
}
|
|
|
|
&:hover .rowButtons {
|
|
opacity: 1;
|
|
}
|
|
|
|
&:hover .rowContentButton {
|
|
background-color: var(--log-table-muted-bg);
|
|
}
|
|
|
|
&:has(.expandButton:hover) .rowButtons {
|
|
opacity: 0 !important;
|
|
}
|
|
|
|
&:has(.expandButton:hover) .rowContentButton {
|
|
background-color: transparent !important;
|
|
}
|
|
}
|
|
|
|
.expandedRowContent {
|
|
max-height: 400px;
|
|
overflow: auto;
|
|
background-color: var(--log-table-muted-bg);
|
|
}
|
|
|
|
.expandButton {
|
|
background: transparent;
|
|
border: none;
|
|
padding: 0 2px;
|
|
color: inherit;
|
|
cursor: pointer;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
transition: background-color 0.15s ease-in-out;
|
|
border-radius: 4px;
|
|
min-height: $button-height;
|
|
|
|
&:hover {
|
|
background-color: var(--log-table-muted-bg);
|
|
}
|
|
|
|
&:focus,
|
|
&:focus-visible {
|
|
background-color: var(--log-table-muted-bg);
|
|
outline: none;
|
|
}
|
|
|
|
&:active {
|
|
outline: none;
|
|
box-shadow: none;
|
|
background-color: var(--log-table-muted-bg);
|
|
}
|
|
|
|
svg {
|
|
transition: transform 0.2s ease-in-out;
|
|
transform-origin: center;
|
|
}
|
|
|
|
&.expanded svg {
|
|
transform: rotate(90deg);
|
|
}
|
|
}
|
|
|
|
.expandButtonSeparator {
|
|
width: 1px;
|
|
height: calc($button-height - 8px);
|
|
border-right: 1px solid var(--color-border);
|
|
margin-left: 2px;
|
|
margin-right: 2px;
|
|
display: inline-block;
|
|
vertical-align: middle;
|
|
}
|
|
|
|
.rowContentButton {
|
|
background: transparent;
|
|
border: none;
|
|
padding: 0;
|
|
margin: 0;
|
|
width: 100%;
|
|
cursor: pointer;
|
|
text-align: left;
|
|
color: inherit;
|
|
transition: background-color 0.15s ease-in-out;
|
|
border-radius: 4px;
|
|
min-height: $button-height;
|
|
display: flex;
|
|
align-items: center;
|
|
position: relative;
|
|
|
|
&:hover .rowButtons {
|
|
opacity: 1;
|
|
}
|
|
|
|
&:focus,
|
|
&:focus-visible {
|
|
background-color: var(--log-table-muted-bg);
|
|
outline: none;
|
|
}
|
|
|
|
&:active {
|
|
outline: none;
|
|
box-shadow: none;
|
|
background-color: var(--log-table-muted-bg);
|
|
}
|
|
|
|
&.isWrapped {
|
|
align-items: flex-start;
|
|
}
|
|
|
|
&.isTruncated {
|
|
align-items: flex-start;
|
|
}
|
|
}
|
|
|
|
.rowButtons {
|
|
position: absolute;
|
|
top: 2px;
|
|
right: 0;
|
|
padding-left: 10px;
|
|
padding-right: 4px;
|
|
display: flex;
|
|
gap: 4px;
|
|
opacity: 0;
|
|
transition: opacity 0.2s ease-in-out;
|
|
z-index: 0;
|
|
align-items: flex-start;
|
|
|
|
&:hover {
|
|
opacity: 1;
|
|
}
|
|
}
|
|
|
|
.iconActionButton {
|
|
padding: 4px;
|
|
border-radius: 4px;
|
|
background-color: var(--color-bg-surface);
|
|
border: 1px solid var(--color-border);
|
|
width: 20px;
|
|
height: 20px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
transition: transform 0.2s ease-in-out;
|
|
pointer-events: auto;
|
|
|
|
&:hover {
|
|
transform: scale(1.05);
|
|
}
|
|
|
|
&.copied {
|
|
color: var(--color-bg-success);
|
|
}
|
|
}
|
|
|
|
.fieldTextContainer {
|
|
position: relative;
|
|
display: block;
|
|
width: 100%;
|
|
}
|
|
|
|
.fieldText {
|
|
overflow: hidden;
|
|
padding: 2px 4px;
|
|
cursor: pointer;
|
|
transition: background-color 0.2s ease-in-out;
|
|
|
|
> span:hover {
|
|
border-radius: 4px;
|
|
background-color: var(--color-bg-highlighted);
|
|
}
|
|
|
|
&.chart {
|
|
overflow: visible;
|
|
min-height: 50px;
|
|
}
|
|
}
|
|
|
|
.fieldText.truncated {
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
min-height: $button-height;
|
|
}
|
|
|
|
.fieldText.wrapped {
|
|
word-break: break-word;
|
|
white-space: normal;
|
|
display: flex;
|
|
}
|
|
|
|
.fieldTextPopover {
|
|
background-color: transparent;
|
|
border: none;
|
|
box-shadow: none;
|
|
padding: 0;
|
|
}
|