setSortStorage(val as ProjectListSort)}
+ setValue={(val) => handleSortChange(val as ProjectListSort)}
/>
{isFetchingProjects && }
@@ -133,12 +202,12 @@ export const HomePageActions = ({ slug: _slug, hideNewProject = false }: HomePag
- {viewMode && setViewMode && (
+ {viewMode && (
value && setViewMode(value as 'grid' | 'table')}
+ onValueChange={(value) => value && handleViewModeChange(value as 'grid' | 'table')}
>
diff --git a/apps/studio/routes/_app/organizations.tsx b/apps/studio/routes/_app/organizations.tsx
index b74e69d28ae..0d2888b7100 100644
--- a/apps/studio/routes/_app/organizations.tsx
+++ b/apps/studio/routes/_app/organizations.tsx
@@ -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 (
<>
{pageTitle}
@@ -85,7 +99,8 @@ function OrganizationsPage() {
icon={}
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 && (
diff --git a/packages/common/telemetry-constants.ts b/packages/common/telemetry-constants.ts
index d4859faa0af..8ff1ec058e6 100644
--- a/packages/common/telemetry-constants.ts
+++ b/packages/common/telemetry-constants.ts
@@ -2843,6 +2843,89 @@ export interface OrganizationMfaEnforcementUpdatedEvent {
groups: Omit
}
+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
+}
+
+/**
+ * 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
+}
+
+/**
+ * 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
+}
+
+/**
+ * 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
+}
+
/**
* 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