Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(dashboards): compact dashboard tags (#104716)

Matt Pua609aa434f841
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index c784d497e688..9d99bfc22539 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -5725,9 +5725,9 @@ snapshots:
products-dashboards--dashboard-states--light:
hash: v1.k794b7964.c55a0dcbaa20af97089a736ec14d2c4afaf842e84dab0e0513724c83d98f397e.km1y2gzWWxk5gGoUNawY4PcOeNKTC4WGL5XBZEaO1qM
products-dashboards--list--dark:
- hash: v1.k794b7964.3d68918107c5c8cfa0abd6a423e2b1281b69eb3d742804b082203d761ecdfbe0.AtRNgQNXLCJgYv-Ig3hni4iK_kblu_uYEtyS1ovZGEs
+ hash: v1.k794b7964.ffb638c4c4828ece804a86e5e1b2e7dbb84b4289b1db66363b994f0bf8f8347e.b37W74QWipgtL1fKg12mtLrDc4R838hMhWlDlpPs2ac
products-dashboards--list--light:
- hash: v1.k794b7964.55fe2415752dce64fa908768afb22ce5b460336ec6ead4d25a8d8bdc6d24c79e.6zEaR6qghzsRNRQjDWd-1q7mL5avd6xDQZb5Z83aoDU
+ hash: v1.k794b7964.ea20735ab45fbb42c4ceb27cc284c0f98b4278ce8305fa39c288455a96160f0e.GixVBErjMYthDYK6PCBieb11jyIvYkAYWVpFQriCvhM
products-dashboards--new-dashboard-modal--dark:
hash: v1.k794b7964.523b9fd3b1a7d2c6386b7e02caf9c6a7dd3864abbc1e02f9c679addbdea27a4a.6SHr1yyvEntSP1P_2AmWjBZvhhIB3rnK_ZnLjqqPWbM
products-dashboards--new-dashboard-modal--light:
diff --git a/frontend/src/lib/components/ObjectTags/ObjectTags.tsx b/frontend/src/lib/components/ObjectTags/ObjectTags.tsx
index 9ccd8a3a6ebd..7fec76498884 100644
--- a/frontend/src/lib/components/ObjectTags/ObjectTags.tsx
+++ b/frontend/src/lib/components/ObjectTags/ObjectTags.tsx
@@ -28,6 +28,8 @@ interface ObjectTagsPropsBase {
onEdit?: () => void
/** Maximum number of tags to show before showing the rest in a popover. */
maxVisibleTags?: number
+ /** Adds "more" to the overflow tag count. */
+ showOverflowLabel?: boolean
/**
* Let a long tag wrap and shrink rather than overflow its container. For narrow containers like a
* sidebar column — off by default, since it lowers the min-content width and so shifts how much
@@ -77,6 +79,7 @@ export function ObjectTags({
inputPlaceholder = 'try "official"',
onTagClick,
maxVisibleTags,
+ showOverflowLabel = false,
wrap = false,
}: ObjectTagsProps): JSX.Element {
const objectTagId = useId()
@@ -159,6 +162,7 @@ export function ObjectTags({
aria-label={`Show ${overflowTags.length} more ${overflowTags.length === 1 ? 'tag' : 'tags'}`}
>
+{overflowTags.length}
+ {showOverflowLabel ? ' more' : ''}
</LemonButton>
</Popover>
)}
diff --git a/frontend/src/scenes/dashboard/dashboards/DashboardsTable.test.tsx b/frontend/src/scenes/dashboard/dashboards/DashboardsTable.test.tsx
index 8a12a854838f..edf3c5f17b78 100644
--- a/frontend/src/scenes/dashboard/dashboards/DashboardsTable.test.tsx
+++ b/frontend/src/scenes/dashboard/dashboards/DashboardsTable.test.tsx
@@ -50,7 +50,12 @@ describe('DashboardsTable move to folder', () => {
})
})
- const renderTable = (rows: number[], selectedKeys: number[] = [], filedRows: number[] = rows): void => {
+ const renderTable = (
+ rows: number[],
+ selectedKeys: number[] = [],
+ filedRows: number[] = rows,
+ tags?: string[]
+ ): void => {
;(useValues as jest.Mock).mockReturnValue({
tableSorting: null,
filters: { search: '' },
@@ -64,6 +69,7 @@ describe('DashboardsTable move to folder', () => {
rows.map((id) => ({
id,
name: `Dashboard ${id}`,
+ tags,
user_access_level: AccessControlLevel.Editor,
})) as any
}
@@ -143,7 +149,7 @@ describe('DashboardsTable move to folder', () => {
expect(setFilters).toHaveBeenCalledWith({ tags: ['finance'] })
})
- it('shows overflow tags in a popover and filters by them', () => {
+ it('shows all tags and filters by them', () => {
const setFilters = jest.fn()
;(useActions as jest.Mock).mockReturnValue({
unpinDashboard: jest.fn(),
@@ -168,7 +174,7 @@ describe('DashboardsTable move to folder', () => {
{
id: 1,
name: 'Dashboard 1',
- tags: ['alpha', 'beta', 'gamma', 'delta', 'epsilon', '', 'zeta'],
+ tags: ['analytics-platform', 'beta', 'gamma', 'delta', 'epsilon', '', 'zeta'],
user_access_level: AccessControlLevel.Editor,
},
] as any
@@ -177,8 +183,9 @@ describe('DashboardsTable move to folder', () => {
/>
)
- expect(screen.getByText('+1')).toBeInTheDocument()
- fireEvent.click(screen.getByText('+1'))
+ expect(document.querySelector('[data-attr="dashboard-tags"]')).toHaveClass('max-w-full')
+ expect(screen.getByText('analytics-platform')).toHaveClass('LemonTag--wrap')
+ expect(screen.getByText('beta')).toBeInTheDocument()
fireEvent.click(screen.getByText('zeta'))
expect(setFilters).toHaveBeenCalledWith({ tags: ['zeta'] })
diff --git a/frontend/src/scenes/dashboard/dashboards/DashboardsTable.tsx b/frontend/src/scenes/dashboard/dashboards/DashboardsTable.tsx
index f66404d5e7b1..62fd7f5a4107 100644
--- a/frontend/src/scenes/dashboard/dashboards/DashboardsTable.tsx
+++ b/frontend/src/scenes/dashboard/dashboards/DashboardsTable.tsx
@@ -113,7 +113,7 @@ export function DashboardsTable({
{
title: 'Name',
dataIndex: 'name',
- width: '40%',
+ width: 440,
render: function Render(_, { id, name, description, is_shared, user_access_level }) {
const isPrimary = id === currentTeam?.primary_dashboard
const canEditDashboard = accessLevelSatisfied(
@@ -170,12 +170,13 @@ export function DashboardsTable({
{
title: 'Tags',
dataIndex: 'tags' as keyof DashboardType,
+ width: 240,
render: function Render(tags: DashboardType['tags']) {
return tags ? (
<ObjectTags
tags={[...tags].sort()}
staticOnly
- maxVisibleTags={5}
+ wrap
data-attr="dashboard-tags"
onTagClick={(tag) => setFilters({ tags: [tag] })}
/>
@@ -335,6 +336,7 @@ export function DashboardsTable({
rowKey="id"
rowClassName={(record) => (record._highlight ? 'highlighted' : null)}
tableLayout="fixed"
+ tableStyle={{ minWidth: '1400px' }}
columns={columns}
loading={dashboardsLoading}
defaultSorting={effectiveTableSorting}