Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
SelectValue,
} from '@ui/components/shadcn/ui/select'
import { LOCAL_STORAGE_KEYS } from 'common'
import { Code } from 'lucide-react'
import { Code, ExternalLink } from 'lucide-react'
import { useEffect, useRef, useState } from 'react'
import {
Button,
Expand Down Expand Up @@ -42,6 +42,7 @@ import type { Policy } from '@/components/interfaces/Auth/Policies/PolicyTableRo
import { SIDEBAR_KEYS } from '@/components/layouts/ProjectLayout/LayoutSidebar/LayoutSidebarProvider'
import { AiAssistantDropdown } from '@/components/ui/AiAssistantDropdown'
import { FeaturePreviewBadge } from '@/components/ui/FeaturePreviewBadge'
import { useTrack } from '@/lib/telemetry/track'
import { useAiAssistantStateSnapshot } from '@/state/ai-assistant-state'
import { useRoleImpersonationStateSnapshot } from '@/state/role-impersonation-state'
import { useSidebarManagerSnapshot } from '@/state/sidebar-manager-state'
Expand All @@ -51,6 +52,7 @@ interface RLSTesterSheetProps {
}

export const RLSTesterSheet = ({ handleSelectEditPolicy }: RLSTesterSheetProps) => {
const track = useTrack()
const aiSnap = useAiAssistantStateSnapshot()
const { openSidebar } = useSidebarManagerSnapshot()
const { setRole } = useRoleImpersonationStateSnapshot()
Expand Down Expand Up @@ -103,8 +105,10 @@ export const RLSTesterSheet = ({ handleSelectEditPolicy }: RLSTesterSheetProps)
if (format === 'lib') {
if (!inferredSQL) return
await testQuery({ value: acceptUntrustedSql(inferredSQL), ...executionCallbacks })
track('rls_tester_run_query_clicked', { type: 'inferred' })
} else {
await testQuery({ value, ...executionCallbacks })
track('rls_tester_run_query_clicked', { type: 'raw' })
}
}

Expand Down Expand Up @@ -272,11 +276,10 @@ export const RLSTesterSheet = ({ handleSelectEditPolicy }: RLSTesterSheetProps)
</div>

<SheetFooter className="sm:justify-between">
<Button asChild type="text">
<Button asChild type="default" icon={<ExternalLink />}>
<a
target="_blank"
rel="noopener noreferrer"
className="text-foreground-light hover:text-foreground"
href="https://github.com/orgs/supabase/discussions/45233"
>
Give feedback
Expand Down
13 changes: 13 additions & 0 deletions packages/common/telemetry-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3439,6 +3439,18 @@ export interface HeaderLocalVersionPopoverOpenedEvent {
groups: Partial<TelemetryGroups>
}

/**
* User ran a query in the RLS tester feature preview.
*
* @group Events
* @source studio
*/
export interface RLSTesterRunQueryClickedEvent {
action: 'rls_tester_run_query_clicked'
properties: { type: 'raw' | 'inferred' }
groups: Partial<TelemetryGroups>
}

/**
* @hidden
*/
Expand Down Expand Up @@ -3638,3 +3650,4 @@ export type TelemetryEvent =
| HeaderUserDropdownOpenedEvent
| HeaderLocalDropdownOpenedEvent
| HeaderLocalVersionPopoverOpenedEvent
| RLSTesterRunQueryClickedEvent
Loading