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(search): drop match notes, replace misc with actions, list missing pages as cmd+k products (#128290)

Shy Alter12f4572d2a6c
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 89f201ed65bb..7462d0dc4830 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -2657,17 +2657,17 @@ snapshots:
components-sample-data-tag--default--light:
hash: v1.k794b7964.8ebad648dbf23b4ccf50c7b2543d02e9429c2f5c67446cee8823fc06fc98a97d.MSu4A4yz_nNpo8sN007sucqXSdbb7pJQExT5Z2ki0Ys
components-search--default--dark:
- hash: v1.k794b7964.dca87db2490271ab0f31e1b979c2c750b4f043aa08498e30c5369b1c83f3e850.9IyyaNG3y6r8tfQ_In6KmoBQAu6FlPFJwch9B89Iuac
+ hash: v1.k794b7964.a31e507e5100bda9cf79afe63ff56f09ae4b8bf87cf21262dc41aac4743d7bfb.bXeCWe9xu6E09y_REa_qrvoiXNd0oIAmeS47a6C0prQ
components-search--default--light:
- hash: v1.k794b7964.10627e8b69503bd6032015f2ad8c2e552e81867fdb62edb4b227db9161714699.3KhOPe07YqESm6ymnYqFsas51lcVitH0LkFikbyS_pI
+ hash: v1.k794b7964.dd6e176d613ede77b64c03c5b698c8d1552ba65edf3c7aa2678909ce1a55f77e.TVkA8RF5EfKRAQ4dH5HeKZekeVwzUWN8R7GFw29b0UE
components-search--no-recents--dark:
- hash: v1.k794b7964.8f8e67ab8165a5bb4aa3d509893f94ba58f7f8035914616cf8bcf7c534e66b26.mnAGjlTGX_zDvUYV4Dk8apN7oSJKHt1N44Kc_8QYNhE
+ hash: v1.k794b7964.0fd0f5d4767912eb77720bd4c629f886a998551875574392ee5ba4140cde90e9.W0slxaCCdN_quO_OA4mBH35mVBVVoWTbw5jMNLwb1HY
components-search--no-recents--light:
- hash: v1.k794b7964.d69ea663238ed0999dcd14571ae277687251aa334630b3633d74c797668259d3.-WbgKzJQ53wPPlS9fSRAPccrJxlr-5O4gnvxaj7wQS8
+ hash: v1.k794b7964.572677b54d24a313ffe88417f45523a1fc227842d8ba5641a379119462514c97.oYrP6VC6sQz50UkiafTiT1Fe87b4uYZKnBZ8zg_pMrg
components-search--product-recents-and-starred--dark:
- hash: v1.k794b7964.cf516b70563583f8fb7769dbcc5137148c0386e3b94425e0ccb69a56dc79f40a.VFbD1u7M3am4LhA_Vg6qeDRZPpleheJwcpfOsmF9YkA
+ hash: v1.k794b7964.29465f375be31fc69736e575ebe19da578ed65788f7859ac1ddb297bbd87055b.SOeHl2ORMMggoedJOfrBXk9xHEOB0FJddC0RVusv-B8
components-search--product-recents-and-starred--light:
- hash: v1.k794b7964.de38039f5c4dd76a9caf4c523b664147d93a5920443ff6afa6353227e58ef2e6.NsoucGXVlw4tPpndBq9jFa-71CN-nHMr1VhLxOoPNUM
+ hash: v1.k794b7964.b4341fc26c099d3e62aacbd6273249487b1a190273edae9c6e2d6448dbba5aff.IOJTS2PvP9IC17AmGQ4kVnbrTyYv4S-zOBFCyEheZYM
components-search--searching--dark:
hash: v1.k794b7964.ed4e2cf61e6843b34f6587a88d3a6d9528c63b3d38cc2d1e8ff4cb8a65d3f167.eWt0RKzJ0ys-GMJudG5IAKfZNgJ9fD_sxNZncIhLC3U
components-search--searching--light:
diff --git a/frontend/src/lib/components/CommandKSearch/COMMAND_K_SEARCH_UX.md b/frontend/src/lib/components/CommandKSearch/COMMAND_K_SEARCH_UX.md
index 45c960e3f438..1be17b32dd76 100644
--- a/frontend/src/lib/components/CommandKSearch/COMMAND_K_SEARCH_UX.md
+++ b/frontend/src/lib/components/CommandKSearch/COMMAND_K_SEARCH_UX.md
@@ -94,7 +94,7 @@ The input is always in exactly one mode, decided from the token under the cursor
- A search with words goes to the ranked search endpoint (`file_system/search/`). A search made only of filters goes to the list endpoint, because there are no words to rank.
- Sections, in this fixed order, covering everything the current palette finds:
1. **Results**: file system objects (insights, dashboards, feature flags, experiments, surveys, notebooks, cohorts, actions, early access features, replay playlists, data pipelines), and products. For a search with words, see [Ranked results](#ranked-results).
- 2. In-memory lists, filtered on every keystroke: **Data management**, **People**, **Health**, **Misc**, **Shortcuts** (with their key bindings), **Settings** (with a Dark mode / Light mode row for "dark", "light", "theme", "appearance"), **Create new**. For a search with words they keep only items that match every word with no typo. Products rank with the results instead. Settings that match every word with no typo also rank with the results, unless a product has the same name, and the **Settings** section lists only the ones that did not.
+ 2. In-memory lists, filtered on every keystroke: **Data management**, **People**, **Health**, **Actions** (Log out, and Toggle terminal when the terminal is on), **Shortcuts** (with their key bindings), **Settings** (with a Dark mode / Light mode row for "dark", "light", "theme", "appearance"), **Create new**. For a search with words they keep only items that match every word with no typo. Products rank with the results instead. Settings that match every word with no typo also rank with the results, unless a product has the same name, and the **Settings** section lists only the ones that did not.
3. Remote lists that the file system does not hold: **Events**, **Properties**, **Workflows** (one unified search request), **Accounts** (behind the customer analytics flag, excluding accounts already shown in ranked results), **Support tickets** (3+ characters or a ticket number).
4. **Ask PostHog AI**.
5. **Persons**, **Groups**. Person and group searches can take seconds, so they usually come last. The person search starts with the file system search, after 50 ms. A search that contains "@" waits for the person search and ranks the persons it finds with **Results** / **Best matches**. A person who matches every word comes first. Persons that do not rank stay in **Persons** below, with no duplicates. Other searches do not wait for persons or groups.
diff --git a/frontend/src/lib/components/CommandKSearch/CommandKSearchRankedItem.tsx b/frontend/src/lib/components/CommandKSearch/CommandKSearchRankedItem.tsx
index 0b9b88a3150f..f36ae946948d 100644
--- a/frontend/src/lib/components/CommandKSearch/CommandKSearchRankedItem.tsx
+++ b/frontend/src/lib/components/CommandKSearch/CommandKSearchRankedItem.tsx
@@ -20,7 +20,7 @@ function rankedContext(
if (item.category !== 'results') {
return {
detail: item.parentName ? `in ${item.parentName}` : null,
- tail: item.matchedSearchKeyword ? `Matches "${item.matchedSearchKeyword}"` : null,
+ tail: null,
}
}
const age = item.lastViewedAt ? (
diff --git a/frontend/src/lib/components/CommandKSearch/CommandKSearchRow.tsx b/frontend/src/lib/components/CommandKSearch/CommandKSearchRow.tsx
index f3160db058cb..4f7f91b62d31 100644
--- a/frontend/src/lib/components/CommandKSearch/CommandKSearchRow.tsx
+++ b/frontend/src/lib/components/CommandKSearch/CommandKSearchRow.tsx
@@ -89,18 +89,8 @@ function RowContent({ row }: { row: CommandKRow }): JSX.Element | null {
<span className="shrink-0 text-xs text-muted-foreground">{item.productCategory}</span>
)}
{item.keybinding && <span className="ml-auto shrink-0">{item.keybinding}</span>}
- {item.matchedSearchKeyword && (
- <span className="ml-auto truncate text-xxs text-muted-foreground">
- Matches "{item.matchedSearchKeyword}"
- </span>
- )}
{item.lastViewedAt && (
- <span
- className={cn(
- 'shrink-0 text-xs text-muted-foreground',
- item.matchedSearchKeyword ? 'ml-2' : 'ml-auto'
- )}
- >
+ <span className="ml-auto shrink-0 text-xs text-muted-foreground">
<CommandKSearchTime time={item.lastViewedAt} tooltipLabel="Last used" />
</span>
)}
diff --git a/frontend/src/lib/components/CommandKSearch/commandKSearchLogic.tsx b/frontend/src/lib/components/CommandKSearch/commandKSearchLogic.tsx
index 6e9bb5f7377f..454d62080e8a 100644
--- a/frontend/src/lib/components/CommandKSearch/commandKSearchLogic.tsx
+++ b/frontend/src/lib/components/CommandKSearch/commandKSearchLogic.tsx
@@ -100,9 +100,9 @@ export interface commandKSearchLogicValues {
meFirstMembers: OrganizationMemberType[] // membersLogic
members: OrganizationMemberType[] | null // membersLogic
recents: FileSystemEntry[] // recentItemsModel
+ actionItems: SearchItem[] // searchListsLogic
dataManagementItems: SearchItem[] // searchListsLogic
healthItems: SearchItem[] // searchListsLogic
- miscItems: SearchItem[] // searchListsLogic
newItems: SearchItem[] // searchListsLogic
peopleItems: SearchItem[] // searchListsLogic
productsItems: SearchItem[] // searchListsLogic
@@ -333,7 +333,7 @@ export interface commandKSearchLogicMeta {
dataManagementItems: SearchItem[],
peopleItems: SearchItem[],
healthItems: SearchItem[],
- miscItems: SearchItem[]
+ actionItems: SearchItem[]
) => LocalLists
themeItem: (localQuery: string, isDarkModeOn: boolean) => SearchItem | null
viewAll: (resolvedQuery: ResolvedQuery) => ViewAll | null
@@ -407,7 +407,7 @@ export const commandKSearchLogic = kea<commandKSearchLogicType>([
'dataManagementItems',
'peopleItems',
'healthItems',
- 'miscItems',
+ 'actionItems',
],
recentItemsModel,
['recents'],
@@ -688,7 +688,7 @@ export const commandKSearchLogic = kea<commandKSearchLogicType>([
s.dataManagementItems,
s.peopleItems,
s.healthItems,
- s.miscItems,
+ s.actionItems,
],
(
recents: SearchItem[],
@@ -700,7 +700,7 @@ export const commandKSearchLogic = kea<commandKSearchLogicType>([
dataManagement: SearchItem[],
people: SearchItem[],
health: SearchItem[],
- misc: SearchItem[]
+ actions: SearchItem[]
): LocalLists => ({
recents,
starred,
@@ -711,7 +711,7 @@ export const commandKSearchLogic = kea<commandKSearchLogicType>([
'data-management': dataManagement,
people,
health,
- misc,
+ actions,
}),
],
themeItem: [
diff --git a/frontend/src/lib/components/CommandKSearch/commandKSections.test.ts b/frontend/src/lib/components/CommandKSearch/commandKSections.test.ts
index da50845bfc30..1f20f3b5f05b 100644
--- a/frontend/src/lib/components/CommandKSearch/commandKSections.test.ts
+++ b/frontend/src/lib/components/CommandKSearch/commandKSections.test.ts
@@ -33,7 +33,7 @@ const emptyLocal = (): LocalLists => ({
'data-management': [],
people: [],
health: [],
- misc: [],
+ actions: [],
shortcuts: [],
settings: [],
create: [],
diff --git a/frontend/src/lib/components/CommandKSearch/commandKSections.ts b/frontend/src/lib/components/CommandKSearch/commandKSections.ts
index dce561abbd8c..6d4d4ada8565 100644
--- a/frontend/src/lib/components/CommandKSearch/commandKSections.ts
+++ b/frontend/src/lib/components/CommandKSearch/commandKSections.ts
@@ -19,7 +19,7 @@ const LOCAL_SOURCES = [
'data-management',
'people',
'health',
- 'misc',
+ 'actions',
'shortcuts',
'settings',
'create',
@@ -98,7 +98,7 @@ const SECTION_LABELS: Record<Exclude<CommandKSectionKey, `group-${string}`>, str
'data-management': 'Data management',
people: 'People',
health: 'Health',
- misc: 'Misc',
+ actions: 'Actions',
shortcuts: 'Shortcuts',
settings: 'Settings',
create: 'Create new',
diff --git a/frontend/src/lib/components/Search/Search.tsx b/frontend/src/lib/components/Search/Search.tsx
index ec4477b38f81..a9b56461d2bd 100644
--- a/frontend/src/lib/components/Search/Search.tsx
+++ b/frontend/src/lib/components/Search/Search.tsx
@@ -933,20 +933,8 @@ function SearchResults({
{item.keybinding}
</span>
)}
- {item.matchedSearchKeyword && (
- <span className="ml-auto text-xxs text-tertiary truncate mt-[2px]">
- {`Matches "${item.matchedSearchKeyword}"`}
- </span>
- )}
{item.lastViewedAt && (
- <span
- className={cn(
- 'text-xs text-tertiary whitespace-nowrap shrink-0 mt-[2px]',
- item.matchedSearchKeyword
- ? 'ml-2'
- : 'ml-auto'
- )}
- >
+ <span className="text-xs text-tertiary whitespace-nowrap shrink-0 mt-[2px] ml-auto">
{formatRelativeTimeShort(
item.lastViewedAt
)}
diff --git a/frontend/src/lib/components/Search/searchListItems.tsx b/frontend/src/lib/components/Search/searchListItems.tsx
index 8134020e0947..fa6db1e1e662 100644
--- a/frontend/src/lib/components/Search/searchListItems.tsx
+++ b/frontend/src/lib/components/Search/searchListItems.tsx
@@ -1,14 +1,6 @@
import { router } from 'kea-router'
-import {
- IconBell,
- IconClock,
- IconDownload,
- IconLeave,
- IconNotification,
- IconSupport,
- IconTerminal,
-} from '@posthog/icons'
+import { IconClock, IconDownload, IconLeave, IconNotification, IconSupport, IconTerminal } from '@posthog/icons'
import type { FeatureFlagsSet } from 'lib/logic/featureFlagLogic'
import { getProductAccessDisabledReason } from 'lib/utils/accessControlUtils'
@@ -174,12 +166,38 @@ const newItemDisplayName = (path: string): string => {
return suffix === 'data' ? `New ${rest.join(' ')}` : `New ${rest.join(' ')} ${suffix}`
}
-const ACTIVITY_ITEM = fixedItem('product-activity', 'Activity', 'tools', {
- href: urls.activity(ActivityTab.ExploreEvents),
- icon: <IconClock />,
- sceneKey: 'Activity',
- record: { type: 'activity' },
-})
+const APP_PRODUCT_ITEMS = [
+ fixedItem('product-activity', 'Activity', 'tools', {
+ href: urls.activity(ActivityTab.ExploreEvents),
+ icon: <IconClock />,
+ sceneKey: 'Activity',
+ record: { type: 'activity' },
+ }),
+ fixedItem('product-exports', 'Exports', 'tools', {
+ href: urls.exports(),
+ icon: <IconDownload />,
+ searchKeywords: ['downloads'],
+ sceneKey: 'Exports',
+ record: { type: 'exports' },
+ }),
+ fixedItem('product-subscriptions', 'Subscriptions', 'tools', {
+ href: urls.subscriptions(),
+ icon: <IconNotification />,
+ searchKeywords: ['subscribe'],
+ sceneKey: 'Subscriptions',
+ record: { type: 'subscriptions' },
+ }),
+ // The user's own tickets with PostHog. The Support product holds tickets from their customers.
+ fixedItem('misc-my-tickets', 'Your tickets', 'tools', {
+ productCategory: 'PostHog support',
+ href: urls.myTickets(),
+ icon: <IconSupport />,
+ itemType: 'my_tickets',
+ searchKeywords: ['my tickets', 'support tickets', 'posthog support', 'contact support', 'support', 'help'],
+ sceneKey: 'MyTickets',
+ record: { type: 'my_tickets' },
+ }),
+]
// Blank SQL query in a new browser tab (inheriting the active warehouse connection when
// triggered from within the SQL editor). Scoped to the command palette: it relies on
@@ -197,6 +215,12 @@ const NEW_SQL_QUERY_ITEM = fixedItem('new-sql-query-tab', 'New SQL query', 'crea
})
const HEALTH_ITEMS = [
+ fixedItem('health-overview', 'Health', 'health', {
+ href: urls.health(),
+ itemType: 'health',
+ sceneKey: 'Health',
+ record: { type: 'health', iconType: 'health' },
+ }),
fixedItem('health-pipeline-status', 'Pipeline status', 'health', {
href: urls.pipelineStatus(),
itemType: 'pipeline_status',
@@ -212,43 +236,15 @@ const HEALTH_ITEMS = [
]
const terminalItem = (toggleTerminal: () => void): FixedSearchItem =>
- fixedItem('misc-toggle-terminal', 'Toggle terminal', 'misc', {
+ fixedItem('misc-toggle-terminal', 'Toggle terminal', 'actions', {
icon: <IconTerminal />,
searchKeywords: ['terminal', 'shell', 'console'],
onSelect: toggleTerminal,
record: { type: 'terminal' },
})
-const MISC_ITEMS = [
- fixedItem('misc-exports', 'Exports', 'misc', {
- href: urls.exports(),
- icon: <IconDownload />,
- sceneKey: 'Exports',
- record: { type: 'exports' },
- }),
- fixedItem('misc-alerts', 'Alerts', 'misc', {
- href: urls.alerts(),
- icon: <IconBell />,
- sceneKey: 'SavedInsights',
- record: { type: 'alerts' },
- }),
- fixedItem('misc-subscriptions', 'Subscriptions', 'misc', {
- href: urls.subscriptions(),
- icon: <IconNotification />,
- sceneKey: 'Subscriptions',
- record: { type: 'subscriptions' },
- }),
- // The user's own tickets with PostHog. The Support product holds tickets from their customers.
- fixedItem('misc-my-tickets', 'Your tickets', 'misc', {
- productCategory: 'PostHog support',
- href: urls.myTickets(),
- icon: <IconSupport />,
- itemType: 'my_tickets',
- searchKeywords: ['my tickets', 'support tickets', 'posthog support', 'contact support', 'support', 'help'],
- sceneKey: 'MyTickets',
- record: { type: 'my_tickets' },
- }),
- fixedItem('misc-logout', 'Log out', 'misc', {
+const ACTION_ITEMS = [
+ fixedItem('misc-logout', 'Log out', 'actions', {
icon: <IconLeave />,
searchKeywords: ['logout', 'log out', 'sign out', 'signout', 'exit'],
onSelect: () => userLogic.actions.logout(),
@@ -285,7 +281,7 @@ export const productSearchItems = (
category: 'tools',
featureFlags,
sceneViews,
- extraItems: [withLastViewed(ACTIVITY_ITEM, sceneViews)],
+ extraItems: APP_PRODUCT_ITEMS.map((item) => withLastViewed(item, sceneViews)),
})
}
@@ -337,10 +333,10 @@ export const peopleSearchItems = (groupItems: FileSystemImport[], sceneViews: Sc
export const healthSearchItems = (sceneViews: SceneViews): SearchItem[] =>
HEALTH_ITEMS.map((item) => withLastViewed(item, sceneViews))
-export const miscSearchItems = (sceneViews: SceneViews, toggleTerminal: (() => void) | null): SearchItem[] =>
- [...(toggleTerminal ? [terminalItem(toggleTerminal)] : []), ...MISC_ITEMS].map((item) =>
- withLastViewed(item, sceneViews)
- )
+export const actionSearchItems = (toggleTerminal: (() => void) | null): SearchItem[] => [
+ ...(toggleTerminal ? [terminalItem(toggleTerminal)] : []),
+ ...ACTION_ITEMS,
+]
/**
* Lean projection of SETTINGS_MAP for search. The full map statically imports every
diff --git a/frontend/src/lib/components/Search/searchListsLogic.test.ts b/frontend/src/lib/components/Search/searchListsLogic.test.ts
index 89c3a08c7e39..11a0ffedcb84 100644
--- a/frontend/src/lib/components/Search/searchListsLogic.test.ts
+++ b/frontend/src/lib/components/Search/searchListsLogic.test.ts
@@ -4,10 +4,41 @@ import { terminalDockLogic } from 'scenes/terminal/terminalDockLogic'
import { urls } from 'scenes/urls'
import { initKeaTests } from '~/test/init'
+import { ActivityTab } from '~/types'
-import { searchListsLogic } from './searchListsLogic'
+import { searchListsLogic, searchListsLogicValues } from './searchListsLogic'
import { filterSearchItems } from './utils'
+type DestinationList = keyof Pick<
+ searchListsLogicValues,
+ 'productsItems' | 'dataManagementItems' | 'peopleItems' | 'healthItems'
+>
+
+const TOP_LEVEL_DESTINATIONS: [DestinationList, string, string][] = [
+ ['productsItems', 'Activity', urls.activity(ActivityTab.ExploreEvents)],
+ ['productsItems', 'Subscriptions', urls.subscriptions()],
+ ['productsItems', 'Exports', urls.exports()],
+ ['productsItems', 'Your tickets', urls.myTickets()],
+ ['productsItems', 'Product analytics', urls.insights()],
+ ['productsItems', 'Dashboards', urls.dashboards()],
+ ['productsItems', 'Notebooks', urls.notebooks()],
+ ['productsItems', 'SQL editor', urls.sqlEditor()],
+ ['productsItems', 'Toolbar', urls.toolbarLaunch()],
+ ['productsItems', 'Heatmaps', urls.heatmaps()],
+ ['productsItems', 'Early access features', urls.earlyAccessFeatures()],
+ ['productsItems', 'Endpoints', urls.endpoints()],
+ ['productsItems', 'Annotations', urls.annotations()],
+ ['productsItems', 'Actions', urls.actions()],
+ ['productsItems', 'Destinations', urls.destinations()],
+ ['productsItems', 'Transformations', urls.transformations()],
+ ['productsItems', 'Models', urls.models()],
+ ['dataManagementItems', 'Property definitions', urls.propertyDefinitions()],
+ ['peopleItems', 'Persons', urls.persons()],
+ ['peopleItems', 'Cohorts', urls.cohorts()],
+ ['healthItems', 'Health', urls.health()],
+ ['healthItems', 'Pipeline status', urls.pipelineStatus()],
+]
+
describe('searchListsLogic', () => {
let logic: ReturnType<typeof searchListsLogic.build>
@@ -35,6 +66,12 @@ describe('searchListsLogic', () => {
expect(logic.values.productsItems.some((item) => item.id === 'product-Data warehouse')).toBe(visible)
})
+ it.each(TOP_LEVEL_DESTINATIONS)('%s includes %s', (list, name, href) => {
+ const items = logic.values[list].filter((item) => !item.parentName)
+
+ expect(items.filter((item) => item.href === href).map((item) => item.displayName)).toEqual([name])
+ })
+
it('lists each product destination once', () => {
const hrefs = logic.values.productsItems.filter((item) => item.category === 'tools').map((item) => item.href)
@@ -49,11 +86,28 @@ describe('searchListsLogic', () => {
})
it.each(['support', 'tickets', 'contact support', 'help'])('finds Your tickets when searching "%s"', (query) => {
- const matches = filterSearchItems(logic.values.miscItems, query)
+ const matches = filterSearchItems(logic.values.productsItems, query)
expect(matches.find((item) => item.id === 'misc-my-tickets')?.href).toBe(urls.myTickets())
})
+ it('lists Alerts only as a Product analytics tab', () => {
+ const lists = [
+ logic.values.productsItems,
+ logic.values.dataManagementItems,
+ logic.values.peopleItems,
+ logic.values.healthItems,
+ logic.values.actionItems,
+ ]
+
+ expect(
+ lists
+ .flat()
+ .filter((item) => item.href === urls.alerts())
+ .map((item) => ({ displayName: item.displayName, parentName: item.parentName }))
+ ).toEqual([{ displayName: 'Alerts', parentName: 'Product analytics' }])
+ })
+
it('shows only the Inbox Scouts destination', () => {
featureFlagLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.PRODUCT_AUTONOMY]: true })
@@ -64,13 +118,20 @@ describe('searchListsLogic', () => {
).toEqual([{ href: urls.inbox('scouts'), parentName: 'Self-driving inbox' }])
})
- it.each([false, true])('gates the command-menu terminal toggle when enabled=%s', (enabled) => {
+ it.each([
+ [false, ['Log out']],
+ [true, ['Toggle terminal', 'Log out']],
+ ])('lists the Actions section with the terminal enabled=%s', (enabled, names) => {
logic.unmount()
logic = searchListsLogic({ commandPalette: true })
logic.mount()
featureFlagLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.POSTHOG_TERMINAL]: enabled })
- const toggle = logic.values.miscItems.find((item) => item.id === 'misc-toggle-terminal')
+ expect(logic.values.actionItems.map((item) => [item.displayName, item.category])).toEqual(
+ names.map((name) => [name, 'actions'])
+ )
+ expect(filterSearchItems(logic.values.actionItems, 'log out').map((item) => item.id)).toEqual(['misc-logout'])
+ const toggle = logic.values.actionItems.find((item) => item.id === 'misc-toggle-terminal')
expect(!!toggle).toBe(enabled)
expect(terminalDockLogic.values.dockOpen).toBe(false)
if (toggle) {
@@ -81,7 +142,7 @@ describe('searchListsLogic', () => {
toggle.onSelect?.()
featureFlagLogic.actions.setFeatureFlags([], {})
expect(terminalDockLogic.values.dockOpen).toBe(false)
- expect(logic.values.miscItems.some((item) => item.id === 'misc-toggle-terminal')).toBe(false)
+ expect(logic.values.actionItems.some((item) => item.id === 'misc-toggle-terminal')).toBe(false)
}
featureFlagLogic.actions.setFeatureFlags([], {})
terminalDockLogic.actions.toggleTerminal()
diff --git a/frontend/src/lib/components/Search/searchListsLogic.tsx b/frontend/src/lib/components/Search/searchListsLogic.tsx
index e37ab036e1d9..7ac295609a2e 100644
--- a/frontend/src/lib/components/Search/searchListsLogic.tsx
+++ b/frontend/src/lib/components/Search/searchListsLogic.tsx
@@ -20,9 +20,9 @@ import { IntegrationType, UserType } from '~/types'
import { SearchItem } from './searchItems'
import {
SettingsSectionSummary,
+ actionSearchItems,
dataManagementSearchItems,
healthSearchItems,
- miscSearchItems,
newSearchItems,
peopleSearchItems,
productSearchItems,
@@ -67,10 +67,10 @@ export interface searchListsLogicValues {
treeGroupItems: FileSystemImport[] // projectTreeDataLogic
sceneLogViewsByRef: Record<string, string> // recentItemsModel
user: UserType | null // userLogic
+ actionItems: SearchItem[]
dataManagementItems: SearchItem[]
hasOrganizationIntegrations: boolean
healthItems: SearchItem[]
- miscItems: SearchItem[]
newItems: SearchItem[]
peopleItems: SearchItem[]
productsItems: SearchItem[]
@@ -112,7 +112,7 @@ export interface searchListsLogicMeta {
newItems: (featureFlags: FeatureFlagsSet, showUnreleased: boolean, arg: boolean) => SearchItem[]
peopleItems: (treeGroupItems: FileSystemImport[], sceneLogViewsByRef: Record<string, string>) => SearchItem[]
healthItems: (sceneLogViewsByRef: Record<string, string>) => SearchItem[]
- miscItems: (sceneLogViewsByRef: Record<string, string>, showTerminal: boolean) => SearchItem[]
+ actionItems: (showTerminal: boolean) => SearchItem[]
settingsItems: (
settingsSections: SettingsSectionSummary[],
featureFlags: FeatureFlagsSet,
@@ -216,13 +216,10 @@ export const searchListsLogic = kea<searchListsLogicType>([
(s) => [s.sceneLogViewsByRef],
(sceneLogViewsByRef: Record<string, string>): SearchItem[] => healthSearchItems(sceneLogViewsByRef),
],
- miscItems: [
- (s) => [s.sceneLogViewsByRef, s.showTerminal],
- (sceneLogViewsByRef: Record<string, string>, showTerminal: boolean): SearchItem[] =>
- miscSearchItems(
- sceneLogViewsByRef,
- showTerminal ? () => terminalDockLogic.actions.toggleTerminal() : null
- ),
+ actionItems: [
+ (s) => [s.showTerminal],
+ (showTerminal: boolean): SearchItem[] =>
+ actionSearchItems(showTerminal ? () => terminalDockLogic.actions.toggleTerminal() : null),
],
settingsItems: [
(s) => [s.settingsSections, s.featureFlags, s.hasOrganizationIntegrations, s.billingEntryUrl],
diff --git a/frontend/src/lib/components/Search/searchLogic.test.ts b/frontend/src/lib/components/Search/searchLogic.test.ts
index 8b554df33280..e9a9f5b3aa6d 100644
--- a/frontend/src/lib/components/Search/searchLogic.test.ts
+++ b/frontend/src/lib/components/Search/searchLogic.test.ts
@@ -165,11 +165,16 @@ describe('searchLogic', () => {
expect(rows.map((item) => item.href)).not.toContain('/metrics?activeTab=sql')
})
- it('lists Error tracking first in Products for "errors"', async () => {
- await searchOnceProductsLoad('errors')
+ it.each([
+ ['errors', 'tools', 'Error tracking'],
+ ['support', 'tools', 'Support'],
+ ['my tickets', 'tools', 'Your tickets'],
+ ['log out', 'actions', 'Log out'],
+ ])('for "%s" lists first in %s: %s', async (search, key, name) => {
+ await searchOnceProductsLoad(search)
- const products = logic.values.allCategories.find((category) => category.key === 'tools')
- expect(products?.items[0]?.name).toBe('Error tracking')
+ const category = logic.values.allCategories.find((category) => category.key === key)
+ expect(category?.items[0]?.name).toBe(name)
})
it('lists the Tabs group above Settings', async () => {
diff --git a/frontend/src/lib/components/Search/searchLogic.tsx b/frontend/src/lib/components/Search/searchLogic.tsx
index 81b146448b86..9bcbeb9ff18d 100644
--- a/frontend/src/lib/components/Search/searchLogic.tsx
+++ b/frontend/src/lib/components/Search/searchLogic.tsx
@@ -75,9 +75,9 @@ export interface searchLogicValues {
cachedRecents: FileSystemEntry[] // recentItemsModel
recentsHasLoaded: boolean // recentItemsModel
sceneLogViewsHasLoaded: boolean // recentItemsModel
+ actionItems: SearchItem[] // searchListsLogic
dataManagementItems: SearchItem[] // searchListsLogic
healthItems: SearchItem[] // searchListsLogic
- miscItems: SearchItem[] // searchListsLogic
newItems: SearchItem[] // searchListsLogic
peopleItems: SearchItem[] // searchListsLogic
productsItems: SearchItem[] // searchListsLogic
@@ -121,7 +121,7 @@ export interface searchLogicValues {
searchPending: boolean
searchedRecents: FileSystemEntry[] | null
searchedRecentsLoading: boolean
- shortcutAndMiscItems: SearchItem[]
+ shortcutAndActionItems: SearchItem[]
ticketItems: SearchItem[]
ticketSearchResults: TicketApi[]
ticketSearchResultsLoading: boolean
@@ -343,7 +343,7 @@ export interface searchLogicMeta {
ticketSearchResultsLoading: boolean
unifiedSearchResultsLoading: boolean
}
- shortcutAndMiscItems: (shortcutItems: SearchItem[], miscItems: SearchItem[]) => SearchItem[]
+ shortcutAndActionItems: (shortcutItems: SearchItem[], actionItems: SearchItem[]) => SearchItem[]
allCategories: (
recentItems: SearchItem[],
starredItems: SearchItem[],
@@ -351,7 +351,7 @@ export interface searchLogicMeta {
dataManagementItems: SearchItem[],
peopleItems: SearchItem[],
healthItems: SearchItem[],
- shortcutAndMiscItems: SearchItem[],
+ shortcutAndActionItems: SearchItem[],
settingsItems: SearchItem[],
newItems: SearchItem[],
personItems: SearchItem[],
@@ -396,7 +396,7 @@ export const searchLogic = kea<searchLogicType>([
'newItems',
'peopleItems',
'healthItems',
- 'miscItems',
+ 'actionItems',
'settingsItems',
],
groupsModel,
@@ -817,9 +817,12 @@ export const searchLogic = kea<searchLogicType>([
playlistSearchResultsLoading,
}),
],
- shortcutAndMiscItems: [
- (s) => [s.shortcutItems, s.miscItems],
- (shortcutItems: SearchItem[], miscItems: SearchItem[]): SearchItem[] => [...shortcutItems, ...miscItems],
+ shortcutAndActionItems: [
+ (s) => [s.shortcutItems, s.actionItems],
+ (shortcutItems: SearchItem[], actionItems: SearchItem[]): SearchItem[] => [
+ ...shortcutItems,
+ ...actionItems,
+ ],
],
allCategories: [
(s) => [
@@ -829,7 +832,7 @@ export const searchLogic = kea<searchLogicType>([
s.dataManagementItems,
s.peopleItems,
s.healthItems,
- s.shortcutAndMiscItems,
+ s.shortcutAndActionItems,
s.settingsItems,
s.newItems,
s.personItems,
@@ -847,7 +850,7 @@ export const searchLogic = kea<searchLogicType>([
dataManagementItems: SearchItem[],
peopleItems: SearchItem[],
healthItems: SearchItem[],
- shortcutAndMiscItems: SearchItem[],
+ shortcutAndActionItems: SearchItem[],
settingsItems: SearchItem[],
newItems: SearchItem[],
personItems: SearchItem[],
@@ -968,12 +971,14 @@ export const searchLogic = kea<searchLogicType>([
})
}
- // Show misc items if searching with matching results
- const filteredMisc = filterBySearch(shortcutAndMiscItems.filter((item) => item.category === 'misc'))
- if (hasSearch && filteredMisc.length > 0) {
+ // Show action items if searching with matching results
+ const filteredActions = filterBySearch(
+ shortcutAndActionItems.filter((item) => item.category === 'actions')
+ )
+ if (hasSearch && filteredActions.length > 0) {
categories.push({
- key: 'misc',
- items: filteredMisc,
+ key: 'actions',
+ items: filteredActions,
isLoading: false,
})
}
@@ -1081,7 +1086,7 @@ export const searchLogic = kea<searchLogicType>([
}
const filteredShortcuts = filterBySearch(
- shortcutAndMiscItems.filter((item) => item.category === 'shortcuts')
+ shortcutAndActionItems.filter((item) => item.category === 'shortcuts')
)
if (filteredShortcuts.length > 0) {
categories.push({
diff --git a/frontend/src/lib/components/Search/utils.ts b/frontend/src/lib/components/Search/utils.ts
index 9b7299d74da6..46c93fa4617e 100644
--- a/frontend/src/lib/components/Search/utils.ts
+++ b/frontend/src/lib/components/Search/utils.ts
@@ -148,7 +148,7 @@ export const getCategoryDisplayName = (category: string): string => {
session_recording_playlist: 'Session recording filter',
hog_flow: 'Workflows',
health: 'Health',
- misc: 'Misc',
+ actions: 'Actions',
}
return displayNames[category] || category