mirror of
https://github.com/supabase/supabase.git
synced 2026-12-03 23:18:57 +00:00
feat(studio): track usage on the org projects list (FE-5025) (#54417)
## Problem We don't have visibility into how people use the org projects list (`/org/[slug]`) or the organizations list (`/organizations`): whether they search, filter, sort or switch views, and which project card actions they use. Resolves FE-5025. ## Solution Adds four events, defined in `packages/common/telemetry-constants.ts` with org-level groups (no project group): - `org_projects_filter_applied` with `filterType: 'search' | 'status' | 'sort'`. Search sends only the result count, status sends the saved statuses (`active`/`paused`), and sort sends the sort value. - `org_projects_view_mode_updated` with `viewMode`. - `org_project_card_action_clicked` with `action: 'copy_id' | 'settings'` and `viewMode`, from the grid card menu and the table row menu and inline ref button. - `org_list_search_submitted` with `orgCount`. Notes for review: - Every event fires from its handler, not an effect, so restoring filters from local storage doesn't fire anything. - Search events use the same 500ms debounce as the query, skip empty input, and never include the search text. The project search count is read from the list query's cache entry via `fetchInfiniteQuery` on the same key, which reuses the in-flight request. - Status, sort and view events don't fire when the value didn't change. - `HomePageActions` and `ProjectList` also render on the `/project` picker, so `@page` lists both routes. - I didn't add the `data-attr` attributes from the ticket: autocapture is off, so they would send nothing, and the telemetry standards ask for explicit `track()` calls. ## How to test - `pnpm --filter studio exec vitest run components/interfaces/HomePageActions.test.tsx` covers view mode, status filter, search and clearing before the debounce settles. - In the browser network tab on `/org/[slug]`, each action sends one `telemetry/event` request with the properties above. Checking the events in PostHog staging is still to do.
This commit is contained in:
1 parent
26daef1bb4
commit
d4ef834d4d
6 files changed
+352
-11
No files matched your search
@@ -24,6 +24,7 @@ import { getComputeSize, OrgProject } from '@/data/projects/org-projects-infinit
|
||||
import type { ResourceWarning } from '@/data/usage/resource-warnings-query'
|
||||
import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
|
||||
import { BASE_PATH } from '@/lib/constants'
|
||||
import { useTrack } from '@/lib/telemetry/track'
|
||||
import type { Organization } from '@/types'
|
||||
|
||||
export interface ProjectCardProps {
|
||||
@@ -45,6 +46,7 @@ export const ProjectCard = ({
|
||||
resourceWarnings,
|
||||
}: ProjectCardProps) => {
|
||||
const navigate = useNavigate()
|
||||
const track = useTrack()
|
||||
const { name, ref: projectRef } = project
|
||||
|
||||
const { projectHomepageShowInstanceSize } = useIsFeatureEnabled([
|
||||
@@ -95,6 +97,10 @@ export const ProjectCard = ({
|
||||
e.stopPropagation()
|
||||
copyToClipboard(projectRef)
|
||||
toast.success('Copied project ID to clipboard')
|
||||
track('org_project_card_action_clicked', {
|
||||
action: 'copy_id',
|
||||
viewMode: 'grid',
|
||||
})
|
||||
}}
|
||||
>
|
||||
<CopyIcon size={14} />
|
||||
@@ -104,6 +110,10 @@ export const ProjectCard = ({
|
||||
className="gap-x-2"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
track('org_project_card_action_clicked', {
|
||||
action: 'settings',
|
||||
viewMode: 'grid',
|
||||
})
|
||||
navigate({
|
||||
to: '/project/$ref/settings/general',
|
||||
params: { ref: projectRef },
|
||||
|
||||
@@ -30,6 +30,7 @@ import type { ResourceWarning } from '@/data/usage/resource-warnings-query'
|
||||
import { BASE_PATH } from '@/lib/constants'
|
||||
import { MANAGED_BY } from '@/lib/constants/infrastructure'
|
||||
import { createNavigationHandler } from '@/lib/navigation'
|
||||
import { useTrack } from '@/lib/telemetry/track'
|
||||
import type { Organization } from '@/types'
|
||||
|
||||
export interface ProjectTableRowProps {
|
||||
@@ -50,6 +51,7 @@ export const ProjectTableRow = ({
|
||||
resourceWarnings,
|
||||
}: ProjectTableRowProps) => {
|
||||
const navigate = useNavigate()
|
||||
const track = useTrack()
|
||||
const { name, ref: projectRef } = project
|
||||
const projectStatus = inferProjectStatus(project.status)
|
||||
const [isCopied, setIsCopied] = useState(false)
|
||||
@@ -70,6 +72,7 @@ export const ProjectTableRow = ({
|
||||
copyToClipboard(projectRef)
|
||||
setIsCopied(true)
|
||||
toast.success('Copied project ID to clipboard')
|
||||
track('org_project_card_action_clicked', { action: 'copy_id', viewMode: 'table' })
|
||||
setTimeout(() => setIsCopied(false), 2000)
|
||||
}
|
||||
|
||||
@@ -190,6 +193,10 @@ export const ProjectTableRow = ({
|
||||
className="gap-x-2"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
track('org_project_card_action_clicked', {
|
||||
action: 'settings',
|
||||
viewMode: 'table',
|
||||
})
|
||||
navigate({
|
||||
to: '/project/$ref/settings/general',
|
||||
params: { ref: projectRef },
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
import { screen, waitFor } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import { platformComponents as components } from 'api-types'
|
||||
import { LOCAL_STORAGE_KEYS } from 'common'
|
||||
import { mockIntersectionObserver } from 'jsdom-testing-mocks'
|
||||
import { HttpResponse } from 'msw'
|
||||
import { beforeEach, describe, expect, test, vi } from 'vitest'
|
||||
|
||||
import { HomePageActions } from './HomePageActions'
|
||||
import { customRender } from '@/tests/lib/custom-render'
|
||||
import { addAPIMock } from '@/tests/lib/msw'
|
||||
import { createMockProfileContext } from '@/tests/lib/profile-helpers'
|
||||
|
||||
type OrganizationProjectsResponse = components['schemas']['OrganizationProjectsResponse_Output']
|
||||
|
||||
mockIntersectionObserver()
|
||||
|
||||
const ORG_SLUG = 'test-org'
|
||||
const { track, params } = vi.hoisted(() => ({
|
||||
track: vi.fn(),
|
||||
params: { slug: undefined as string | undefined },
|
||||
}))
|
||||
|
||||
vi.mock('@/lib/telemetry/track', () => ({ useTrack: () => track }))
|
||||
|
||||
vi.mock('common', async (importOriginal) => {
|
||||
const actual = (await importOriginal()) as typeof import('common')
|
||||
return { ...actual, useParams: () => params, useIsLoggedIn: () => true }
|
||||
})
|
||||
|
||||
vi.mock('@/lib/constants', async (importOriginal) => {
|
||||
const actual = await importOriginal<Record<string, unknown>>()
|
||||
return { ...actual, IS_PLATFORM: true }
|
||||
})
|
||||
|
||||
const MATCHING_PROJECT_COUNT = 3
|
||||
|
||||
const renderActions = () => {
|
||||
addAPIMock({
|
||||
method: 'get',
|
||||
path: '/platform/organizations/:slug/projects',
|
||||
response: () =>
|
||||
HttpResponse.json<OrganizationProjectsResponse>({
|
||||
projects: [],
|
||||
pagination: { count: MATCHING_PROJECT_COUNT, limit: 96, offset: 0 },
|
||||
}),
|
||||
})
|
||||
|
||||
return customRender(<HomePageActions />, { profileContext: createMockProfileContext() })
|
||||
}
|
||||
|
||||
describe('HomePageActions tracking', () => {
|
||||
beforeEach(() => {
|
||||
track.mockClear()
|
||||
params.slug = ORG_SLUG
|
||||
window.localStorage.clear()
|
||||
})
|
||||
|
||||
test('switching view mode tracks once, and picking the current view tracks nothing', async () => {
|
||||
const user = userEvent.setup()
|
||||
renderActions()
|
||||
|
||||
await user.click(await screen.findByRole('radio', { name: 'Toggle grid view' }))
|
||||
expect(track).not.toHaveBeenCalled()
|
||||
|
||||
await user.click(screen.getByRole('radio', { name: 'Toggle list view' }))
|
||||
|
||||
expect(track).toHaveBeenCalledTimes(1)
|
||||
expect(track).toHaveBeenCalledWith('org_projects_view_mode_updated', { viewMode: 'table' })
|
||||
})
|
||||
|
||||
test('saving a status filter tracks the saved statuses, and saving it unchanged tracks nothing', async () => {
|
||||
const user = userEvent.setup()
|
||||
renderActions()
|
||||
|
||||
await user.click(await screen.findByRole('button', { name: /Status/ }))
|
||||
await user.click(screen.getByRole('checkbox', { name: 'Paused' }))
|
||||
await user.click(screen.getByRole('button', { name: 'Save' }))
|
||||
|
||||
expect(track).toHaveBeenCalledTimes(1)
|
||||
expect(track).toHaveBeenCalledWith('org_projects_filter_applied', {
|
||||
filterType: 'status',
|
||||
statuses: ['paused'],
|
||||
})
|
||||
|
||||
track.mockClear()
|
||||
await user.click(screen.getByRole('button', { name: /Status/ }))
|
||||
await user.click(screen.getByRole('button', { name: 'Save' }))
|
||||
|
||||
expect(track).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
test('saving the same statuses in a different order tracks nothing', async () => {
|
||||
window.localStorage.setItem(
|
||||
LOCAL_STORAGE_KEYS.PROJECTS_FILTER,
|
||||
JSON.stringify(['INACTIVE', 'ACTIVE_HEALTHY'])
|
||||
)
|
||||
const user = userEvent.setup()
|
||||
renderActions()
|
||||
|
||||
await user.click(await screen.findByRole('button', { name: /Status/ }))
|
||||
await waitFor(() => expect(screen.getByRole('checkbox', { name: 'Paused' })).toBeChecked())
|
||||
expect(screen.getByRole('checkbox', { name: 'Active' })).toBeChecked()
|
||||
await user.click(screen.getByRole('button', { name: 'Save' }))
|
||||
|
||||
expect(track).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
test('without a slug (the project picker), filter events are skipped but view mode still tracks', async () => {
|
||||
params.slug = undefined
|
||||
const user = userEvent.setup()
|
||||
renderActions()
|
||||
|
||||
await user.click(await screen.findByRole('button', { name: /Status/ }))
|
||||
await user.click(screen.getByRole('checkbox', { name: 'Paused' }))
|
||||
await user.click(screen.getByRole('button', { name: 'Save' }))
|
||||
await user.type(screen.getByPlaceholderText('Search for a project'), 'abc')
|
||||
await new Promise((resolve) => setTimeout(resolve, 900))
|
||||
|
||||
expect(track).not.toHaveBeenCalled()
|
||||
|
||||
await user.click(screen.getByRole('radio', { name: 'Toggle list view' }))
|
||||
|
||||
expect(track).toHaveBeenCalledTimes(1)
|
||||
expect(track).toHaveBeenCalledWith('org_projects_view_mode_updated', { viewMode: 'table' })
|
||||
})
|
||||
|
||||
test('searching tracks once after typing settles, with the result count and no search text', async () => {
|
||||
const user = userEvent.setup()
|
||||
renderActions()
|
||||
|
||||
await user.type(await screen.findByPlaceholderText('Search for a project'), 'secret-name')
|
||||
|
||||
await waitFor(() => expect(track).toHaveBeenCalledTimes(1), { timeout: 3000 })
|
||||
expect(track).toHaveBeenCalledWith('org_projects_filter_applied', {
|
||||
filterType: 'search',
|
||||
projectCount: MATCHING_PROJECT_COUNT,
|
||||
})
|
||||
expect(JSON.stringify(track.mock.calls)).not.toContain('secret-name')
|
||||
})
|
||||
|
||||
test('clearing the search before it settles tracks nothing', async () => {
|
||||
const user = userEvent.setup()
|
||||
renderActions()
|
||||
|
||||
const input = await screen.findByPlaceholderText('Search for a project')
|
||||
await user.type(input, 'abc')
|
||||
await user.clear(input)
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 900))
|
||||
expect(track).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
@@ -1,4 +1,4 @@
|
||||
import { keepPreviousData } from '@tanstack/react-query'
|
||||
import { keepPreviousData, useQueryClient } from '@tanstack/react-query'
|
||||
import { Link, useNavigate } from '@tanstack/react-router'
|
||||
import { useDebounce } from '@uidotdev/usehooks'
|
||||
import { LOCAL_STORAGE_KEYS, useParams } from 'common'
|
||||
@@ -7,6 +7,7 @@ import { parseAsArrayOf, parseAsString, parseAsStringLiteral, useQueryState } fr
|
||||
import { useEffect, useRef } from 'react'
|
||||
import { Button, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipTrigger } from 'ui'
|
||||
import { Input } from 'ui-patterns/DataInputs/Input'
|
||||
import { useDebouncedCallback } from 'use-debounce'
|
||||
|
||||
import { FilterPopover } from '../ui/FilterPopover'
|
||||
import { SortDropdown } from '../ui/SortDropdown'
|
||||
@@ -15,14 +16,26 @@ import {
|
||||
type ProjectListSort,
|
||||
} from '@/components/interfaces/Home/ProjectList/ProjectListSort.utils'
|
||||
import { Shortcut } from '@/components/ui/Shortcut'
|
||||
import { useOrgProjectsInfiniteQuery } from '@/data/projects/org-projects-infinite-query'
|
||||
import { projectKeys } from '@/data/projects/keys'
|
||||
import {
|
||||
getOrganizationProjects,
|
||||
useOrgProjectsInfiniteQuery,
|
||||
} from '@/data/projects/org-projects-infinite-query'
|
||||
import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
|
||||
import { useLocalStorageQuery } from '@/hooks/misc/useLocalStorage'
|
||||
import { PROJECT_STATUS } from '@/lib/constants'
|
||||
import { onSearchInputEscape } from '@/lib/keyboard'
|
||||
import { useTrack } from '@/lib/telemetry/track'
|
||||
import { SHORTCUT_IDS } from '@/state/shortcuts/registry'
|
||||
import { useShortcut } from '@/state/shortcuts/useShortcut'
|
||||
|
||||
const SEARCH_DEBOUNCE_MS = 500
|
||||
|
||||
const STATUS_TRACKING_VALUES: Record<string, 'active' | 'paused'> = {
|
||||
[PROJECT_STATUS.ACTIVE_HEALTHY]: 'active',
|
||||
[PROJECT_STATUS.INACTIVE]: 'paused',
|
||||
}
|
||||
|
||||
interface HomePageActionsProps {
|
||||
slug?: string
|
||||
hideNewProject?: boolean
|
||||
@@ -31,11 +44,13 @@ interface HomePageActionsProps {
|
||||
export const HomePageActions = ({ slug: _slug, hideNewProject = false }: HomePageActionsProps) => {
|
||||
const { slug: urlSlug } = useParams()
|
||||
const navigate = useNavigate()
|
||||
const track = useTrack()
|
||||
const queryClient = useQueryClient()
|
||||
const projectCreationEnabled = useIsFeatureEnabled('projects:create')
|
||||
|
||||
const slug = _slug ?? urlSlug
|
||||
const [search, setSearch] = useQueryState('search', parseAsString.withDefault(''))
|
||||
const debouncedSearch = useDebounce(search, 500)
|
||||
const debouncedSearch = useDebounce(search, SEARCH_DEBOUNCE_MS)
|
||||
const [filterStatus, setFilterStatus] = useQueryState(
|
||||
'status',
|
||||
parseAsArrayOf(parseAsString, ',').withDefault([])
|
||||
@@ -64,6 +79,60 @@ export const HomePageActions = ({ slug: _slug, hideNewProject = false }: HomePag
|
||||
|
||||
const searchInputRef = useRef<HTMLInputElement>(null)
|
||||
|
||||
// Filter, sort and search only take effect when there is a slug (the project picker mounts this
|
||||
// without one, where saves never reach the URL), so there is nothing to track without it.
|
||||
//
|
||||
// Waits for the same debounce as the query, then reads the result count from that query's cache
|
||||
// entry. It uses the list query's key, so it shares the list query's in-flight request, and an
|
||||
// existing entry is returned as is. Skips empty searches and never sends the search text.
|
||||
const trackSearch = useDebouncedCallback(async (value: string) => {
|
||||
if (!slug || value.length === 0) return
|
||||
try {
|
||||
const statuses = filterStatus
|
||||
const data = await queryClient.ensureInfiniteQueryData({
|
||||
queryKey: projectKeys.infiniteListByOrg(slug, { sort, search: value, statuses, refs: [] }),
|
||||
queryFn: ({ signal, pageParam }) =>
|
||||
getOrganizationProjects({ slug, page: pageParam, sort, search: value, statuses }, signal),
|
||||
initialPageParam: 0,
|
||||
})
|
||||
const projectCount = data.pages[0]?.pagination?.count
|
||||
if (projectCount !== undefined) {
|
||||
track('org_projects_filter_applied', { filterType: 'search', projectCount })
|
||||
}
|
||||
} catch {
|
||||
// No result count to report when the search request failed
|
||||
}
|
||||
}, SEARCH_DEBOUNCE_MS)
|
||||
|
||||
const handleSearchChange = (value: string) => {
|
||||
setSearch(value)
|
||||
if (value.length === 0) trackSearch.cancel()
|
||||
else trackSearch(value)
|
||||
}
|
||||
|
||||
const handleSaveStatusFilter = (options: string[]) => {
|
||||
setFilterStatusStorage(options)
|
||||
if (!slug) return
|
||||
const hasChanged =
|
||||
options.length !== filterStatus.length || options.some((x) => !filterStatus.includes(x))
|
||||
if (!hasChanged) return
|
||||
track('org_projects_filter_applied', {
|
||||
filterType: 'status',
|
||||
statuses: options.flatMap((x) => STATUS_TRACKING_VALUES[x] ?? []),
|
||||
})
|
||||
}
|
||||
|
||||
const handleSortChange = (value: ProjectListSort) => {
|
||||
setSortStorage(value)
|
||||
if (slug && value !== sort)
|
||||
track('org_projects_filter_applied', { filterType: 'sort', sort: value })
|
||||
}
|
||||
|
||||
const handleViewModeChange = (value: 'grid' | 'table') => {
|
||||
setViewMode(value)
|
||||
if (value !== viewMode) track('org_projects_view_mode_updated', { viewMode: value })
|
||||
}
|
||||
|
||||
useShortcut(SHORTCUT_IDS.ORG_PROJECTS_SEARCH, () => {
|
||||
searchInputRef.current?.focus()
|
||||
})
|
||||
@@ -86,8 +155,8 @@ export const HomePageActions = ({ slug: _slug, hideNewProject = false }: HomePag
|
||||
size="tiny"
|
||||
className="w-full sm:w-32 md:w-64"
|
||||
value={search}
|
||||
onChange={(event) => setSearch(event.target.value)}
|
||||
onKeyDown={onSearchInputEscape(search, (v) => setSearch(v))}
|
||||
onChange={(event) => handleSearchChange(event.target.value)}
|
||||
onKeyDown={onSearchInputEscape(search, handleSearchChange)}
|
||||
actions={[
|
||||
search && (
|
||||
<Button
|
||||
@@ -95,7 +164,7 @@ export const HomePageActions = ({ slug: _slug, hideNewProject = false }: HomePag
|
||||
size="tiny"
|
||||
variant="text"
|
||||
icon={<XIcon />}
|
||||
onClick={() => setSearch('')}
|
||||
onClick={() => handleSearchChange('')}
|
||||
className="p-0 h-5 w-5"
|
||||
aria-label="Clear"
|
||||
/>
|
||||
@@ -116,7 +185,7 @@ export const HomePageActions = ({ slug: _slug, hideNewProject = false }: HomePag
|
||||
activeOptions={filterStatus}
|
||||
valueKey="key"
|
||||
labelKey="label"
|
||||
onSaveFilters={(options) => setFilterStatusStorage(options)}
|
||||
onSaveFilters={handleSaveStatusFilter}
|
||||
/>
|
||||
|
||||
<SortDropdown
|
||||
@@ -125,7 +194,7 @@ export const HomePageActions = ({ slug: _slug, hideNewProject = false }: HomePag
|
||||
{ label: 'creation date', value: 'created' },
|
||||
]}
|
||||
value={sort}
|
||||
setValue={(val) => setSortStorage(val as ProjectListSort)}
|
||||
setValue={(val) => handleSortChange(val as ProjectListSort)}
|
||||
/>
|
||||
|
||||
{isFetchingProjects && <Loader2Icon className="animate-spin" size={14} />}
|
||||
@@ -133,12 +202,12 @@ export const HomePageActions = ({ slug: _slug, hideNewProject = false }: HomePag
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2 shrink-0">
|
||||
{viewMode && setViewMode && (
|
||||
{viewMode && (
|
||||
<ToggleGroup
|
||||
type="single"
|
||||
size="sm"
|
||||
value={viewMode}
|
||||
onValueChange={(value) => value && setViewMode(value as 'grid' | 'table')}
|
||||
onValueChange={(value) => value && handleViewModeChange(value as 'grid' | 'table')}
|
||||
>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
PageHeaderTitle,
|
||||
} from 'ui-patterns/PageHeader'
|
||||
import { PageSection } from 'ui-patterns/PageSection'
|
||||
import { useDebouncedCallback } from 'use-debounce'
|
||||
|
||||
import { NoOrganizationsState } from '@/components/interfaces/Home/ProjectList/EmptyStates'
|
||||
import { OrganizationCard } from '@/components/interfaces/Organization/OrganizationCard'
|
||||
@@ -20,7 +21,9 @@ import { useOrganizationsQuery } from '@/data/organizations/organizations-query'
|
||||
import { useCustomContent } from '@/hooks/custom-content/useCustomContent'
|
||||
import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
|
||||
import { withAuth } from '@/hooks/misc/withAuth'
|
||||
import { onSearchInputEscape } from '@/lib/keyboard'
|
||||
import { buildStudioPageTitle } from '@/lib/page-title'
|
||||
import { useTrack } from '@/lib/telemetry/track'
|
||||
|
||||
export const Route = createFileRoute('/_app/organizations')({
|
||||
component: Organizations,
|
||||
@@ -47,6 +50,7 @@ function Organizations() {
|
||||
|
||||
function OrganizationsPage() {
|
||||
const { appTitle } = useCustomContent(['app:title'])
|
||||
const track = useTrack()
|
||||
const [search, setSearch] = useState('')
|
||||
const pageTitle = buildStudioPageTitle({
|
||||
section: 'Organizations',
|
||||
@@ -71,6 +75,16 @@ function OrganizationsPage() {
|
||||
x.name.toLowerCase().includes(searchTerm) || x.slug.toLowerCase().includes(searchTerm)
|
||||
)
|
||||
|
||||
const trackSearch = useDebouncedCallback((value: string) => {
|
||||
if (value.trim().length === 0) return
|
||||
track('org_list_search_submitted', { orgCount: filteredOrganizations.length })
|
||||
}, 500)
|
||||
|
||||
const handleSearchChange = (value: string) => {
|
||||
setSearch(value)
|
||||
trackSearch(value)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<title>{pageTitle}</title>
|
||||
@@ -85,7 +99,8 @@ function OrganizationsPage() {
|
||||
icon={<SearchIcon />}
|
||||
className="w-full flex-1 md:w-64"
|
||||
value={search}
|
||||
onChange={(event) => setSearch(event.target.value)}
|
||||
onChange={(event) => handleSearchChange(event.target.value)}
|
||||
onKeyDown={onSearchInputEscape(search, handleSearchChange)}
|
||||
/>
|
||||
|
||||
{organizationCreationEnabled && (
|
||||
|
||||
@@ -2843,6 +2843,89 @@ export interface OrganizationMfaEnforcementUpdatedEvent {
|
||||
groups: Omit<TelemetryGroups, 'project'>
|
||||
}
|
||||
|
||||
type OrgProjectsViewMode = 'grid' | 'table'
|
||||
|
||||
/**
|
||||
* Triggered when a search, status filter or sort is applied to the projects list. Search fires once
|
||||
* the input settles (debounced), never for an empty search.
|
||||
*
|
||||
* Not sent from the project picker (/project): its filters don't apply without an organization.
|
||||
*
|
||||
* @group Events
|
||||
* @source studio
|
||||
* @page /dashboard/org/{slug}
|
||||
*/
|
||||
export interface OrgProjectsFilterAppliedEvent {
|
||||
action: 'org_projects_filter_applied'
|
||||
properties:
|
||||
| {
|
||||
filterType: 'search'
|
||||
/** Number of projects matching the search. The search text is never sent. */
|
||||
projectCount: number
|
||||
}
|
||||
| {
|
||||
filterType: 'status'
|
||||
/** The statuses saved in the filter. Empty when the filter was cleared. */
|
||||
statuses: Array<'active' | 'paused'>
|
||||
}
|
||||
| {
|
||||
filterType: 'sort'
|
||||
sort: 'name_asc' | 'name_desc' | 'created_asc' | 'created_desc'
|
||||
}
|
||||
groups: Omit<TelemetryGroups, 'project'>
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggered when the projects list is switched between grid and table view.
|
||||
*
|
||||
* @group Events
|
||||
* @source studio
|
||||
* @page /dashboard/org/{slug}, /dashboard/project
|
||||
*/
|
||||
export interface OrgProjectsViewModeUpdatedEvent {
|
||||
action: 'org_projects_view_mode_updated'
|
||||
properties: {
|
||||
/** The view the list was switched to. */
|
||||
viewMode: OrgProjectsViewMode
|
||||
}
|
||||
groups: Omit<TelemetryGroups, 'project'>
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggered when an action is chosen from a project's menu in the projects list: the card menu in
|
||||
* grid view, the row menu or the inline project reference button in table view.
|
||||
*
|
||||
* @group Events
|
||||
* @source studio
|
||||
* @page /dashboard/org/{slug}, /dashboard/project
|
||||
*/
|
||||
export interface OrgProjectCardActionClickedEvent {
|
||||
action: 'org_project_card_action_clicked'
|
||||
properties: {
|
||||
action: 'copy_id' | 'settings'
|
||||
/** The view the list was in when the action was chosen. */
|
||||
viewMode: OrgProjectsViewMode
|
||||
}
|
||||
groups: Omit<TelemetryGroups, 'project'>
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggered when a search is entered on the organizations list. Fires once the input settles
|
||||
* (debounced), never for an empty search.
|
||||
*
|
||||
* @group Events
|
||||
* @source studio
|
||||
* @page /dashboard/organizations
|
||||
*/
|
||||
export interface OrgListSearchSubmittedEvent {
|
||||
action: 'org_list_search_submitted'
|
||||
properties: {
|
||||
/** Number of organizations matching the search. The search text is never sent. */
|
||||
orgCount: number
|
||||
}
|
||||
groups: Omit<TelemetryGroups, 'project'>
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggered when a new foreign data wrapper is created in a project.
|
||||
*
|
||||
@@ -5872,6 +5955,10 @@ export type TelemetryEvent =
|
||||
| AiAssistantInSupportFormClickedEvent
|
||||
| SupportAssistantFollowUpCardClickedEvent
|
||||
| OrganizationMfaEnforcementUpdatedEvent
|
||||
| OrgProjectsFilterAppliedEvent
|
||||
| OrgProjectsViewModeUpdatedEvent
|
||||
| OrgProjectCardActionClickedEvent
|
||||
| OrgListSearchSubmittedEvent
|
||||
| ForeignDataWrapperCreatedEvent
|
||||
| StorageBucketCreatedEvent
|
||||
| StorageBucketVersioningEnabledEvent
|
||||
|
||||
Reference in new issue
Block a user