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
2 changes: 1 addition & 1 deletion e2e/questdb
Submodule questdb updated 5033 files
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"@styled-icons/remix-line": "10.46.0",
"allotment": "^1.19.3",
"animate.css": "3.7.2",
"bowser": "^2.14.1",
"compare-versions": "^5.0.1",
"core-js": "^3.22.8",
"date-fns": "4.1.0",
Expand Down Expand Up @@ -146,6 +147,7 @@
"eslint-plugin-prettier": "^5.2.3",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.1.0",
"fake-indexeddb": "^6.2.5",
"globals": "^15.0.0",
"husky": "^9.1.7",
"jiti": "^2.6.1",
Expand Down
3 changes: 3 additions & 0 deletions src/components/CopyButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ export const CopyButton = ({
text,
iconOnly,
size = "md",
onCopy,
...props
}: {
text: string
iconOnly?: boolean
size?: ButtonProps["size"]
onCopy?: () => void
} & ButtonProps) => {
const [copied, setCopied] = useState(false)
const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)
Expand All @@ -47,6 +49,7 @@ export const CopyButton = ({
e.stopPropagation()
setCopied(true)
timeoutRef.current = setTimeout(() => setCopied(false), 2000)
onCopy?.()
}}
{...(!iconOnly && {
prefixIcon: <FileCopy size={size === "sm" ? "12px" : "16px"} />,
Expand Down
4 changes: 4 additions & 0 deletions src/components/Drawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { Button } from "../Button"
import { ContentWrapper } from "./content-wrapper"
import { Panel } from "../../components/Panel"
import { XIcon, ArrowLeftIcon, ArrowRightIcon } from "@phosphor-icons/react"
import { trackEvent } from "../../modules/ConsoleEventTracker"
import { ConsoleEvent } from "../../modules/ConsoleEventTracker/events"

type DrawerProps = {
mode?: "modal" | "side"
Expand Down Expand Up @@ -143,10 +145,12 @@ export const Drawer = ({
const canGoForward = useSelector(selectors.console.canGoForwardInSidebar)

const handleNavigateBack = () => {
void trackEvent(ConsoleEvent.SIDEBAR_NAVIGATE)
dispatch(actions.console.goBackInSidebar())
}

const handleNavigateForward = () => {
void trackEvent(ConsoleEvent.SIDEBAR_NAVIGATE)
dispatch(actions.console.goForwardInSidebar())
}

Expand Down
3 changes: 3 additions & 0 deletions src/components/ExplainQueryButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
executeAIFlow,
createExplainFlowConfig,
} from "../../utils/executeAIFlow"
import { trackEvent } from "../../modules/ConsoleEventTracker"
import { ConsoleEvent } from "../../modules/ConsoleEventTracker/events"

const KeyBinding = styled(Box).attrs({ alignItems: "center", gap: "0" })`
color: ${({ theme }) => theme.color.pinkPrimary};
Expand Down Expand Up @@ -54,6 +56,7 @@ export const ExplainQueryButton = ({
} = useAIConversation()

const handleExplainQuery = () => {
void trackEvent(ConsoleEvent.AI_EXPLAIN_QUERY)
const currentModel = currentModelValue!
const apiKey = apiKeyValue!

Expand Down
3 changes: 3 additions & 0 deletions src/components/FixQueryButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { useAIConversation } from "../../providers/AIConversationProvider"
import { extractErrorByQueryKey } from "../../scenes/Editor/utils"
import type { ExecutionRefs } from "../../scenes/Editor/index"
import { executeAIFlow, createFixFlowConfig } from "../../utils/executeAIFlow"
import { trackEvent } from "../../modules/ConsoleEventTracker"
import { ConsoleEvent } from "../../modules/ConsoleEventTracker/events"

const FixButton = styled(Button)`
gap: 1rem;
Expand All @@ -34,6 +36,7 @@ export const FixQueryButton = () => {
} = useAIConversation()

const handleFixQuery = () => {
void trackEvent(ConsoleEvent.AI_FIX_QUERY)
const conversationId = chatWindowState.activeConversationId!
const conversation = getConversationMeta(conversationId)!

Expand Down
7 changes: 7 additions & 0 deletions src/components/SetupAIAssistant/ConfigurationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import { OpenAIIcon } from "./OpenAIIcon"
import { AnthropicIcon } from "./AnthropicIcon"
import { BrainIcon } from "./BrainIcon"
import { theme } from "../../theme"
import { trackEvent } from "../../modules/ConsoleEventTracker"
import { ConsoleEvent } from "../../modules/ConsoleEventTracker/events"

const ModalContent = styled.div`
display: flex;
Expand Down Expand Up @@ -753,6 +755,10 @@ export const ConfigurationModal = ({
const handleComplete = () => {
if (!selectedProvider || enabledModels.length === 0) return

void trackEvent(ConsoleEvent.AI_PROVIDER_CONFIGURE, {
type: selectedProvider,
})

const selectedModel =
enabledModels.find(
(m) => MODEL_OPTIONS.find((mo) => mo.value === m)?.default,
Expand Down Expand Up @@ -812,6 +818,7 @@ export const ConfigurationModal = ({
setEnabledModels(defaultModels)
}
setError(null)
void trackEvent(ConsoleEvent.AI_CONFIGURATION_VALIDATE)
return true
} catch (err) {
const errorMessage =
Expand Down
3 changes: 3 additions & 0 deletions src/components/SetupAIAssistant/ModelDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { OpenAIIcon } from "./OpenAIIcon"
import { AnthropicIcon } from "./AnthropicIcon"
import { BrainIcon } from "./BrainIcon"
import { Tooltip } from "../Tooltip"
import { trackEvent } from "../../modules/ConsoleEventTracker"
import { ConsoleEvent } from "../../modules/ConsoleEventTracker/events"

const ExpandUpDown = () => (
<svg
Expand Down Expand Up @@ -170,6 +172,7 @@ export const ModelDropdown = () => {
}, [enabledModelValues])

const handleModelSelect = (modelValue: string) => {
void trackEvent(ConsoleEvent.AI_MODEL_CHANGE)
updateSettings(StoreKey.AI_ASSISTANT_SETTINGS, {
...aiAssistantSettings,
selectedModel: modelValue,
Expand Down
10 changes: 10 additions & 0 deletions src/components/SetupAIAssistant/SettingsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import type { AiAssistantSettings } from "../../providers/LocalStorageProvider/t
import { ForwardRef } from "../ForwardRef"
import { Badge, BadgeType } from "../../components/Badge"
import { CheckboxCircle } from "@styled-icons/remix-fill"
import { trackEvent } from "../../modules/ConsoleEventTracker"
import { ConsoleEvent } from "../../modules/ConsoleEventTracker/events"

const ModalContent = styled.div`
display: flex;
Expand Down Expand Up @@ -657,6 +659,7 @@ export const SettingsModal = ({ open, onOpenChange }: SettingsModalProps) => {
)

const handleRemoveApiKey = useCallback((provider: Provider) => {
void trackEvent(ConsoleEvent.AI_SETTINGS_API_KEY_REMOVE)
// Remove API key from local state only
// Settings will be persisted when Save Settings is clicked
setApiKeys((prev) => ({ ...prev, [provider]: "" }))
Expand All @@ -668,6 +671,7 @@ export const SettingsModal = ({ open, onOpenChange }: SettingsModalProps) => {

const handleModelToggle = useCallback(
(provider: Provider, modelValue: string) => {
void trackEvent(ConsoleEvent.AI_SETTINGS_MODEL_TOGGLE)
setEnabledModels((prev) => {
const current = prev[provider]
const isEnabled = current.includes(modelValue)
Expand All @@ -684,6 +688,9 @@ export const SettingsModal = ({ open, onOpenChange }: SettingsModalProps) => {

const handleSchemaAccessChange = useCallback(
(provider: Provider, checked: boolean) => {
if (!checked) {
void trackEvent(ConsoleEvent.AI_SETTINGS_SCHEMA_ACCESS_REMOVE)
}
setGrantSchemaAccess((prev) => ({ ...prev, [provider]: checked }))
},
[],
Expand Down Expand Up @@ -908,6 +915,9 @@ export const SettingsModal = ({ open, onOpenChange }: SettingsModalProps) => {
<EditButton
type="button"
onClick={() => {
void trackEvent(
ConsoleEvent.AI_SETTINGS_API_KEY_EDIT,
)
inputRef.current?.focus()
}}
title="Edit API key"
Expand Down
4 changes: 4 additions & 0 deletions src/components/SetupAIAssistant/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { ConfigurationModal } from "./ConfigurationModal"
import { SettingsModal } from "./SettingsModal"
import { ModelDropdown } from "./ModelDropdown"
import { useAIStatus } from "../../providers/AIStatusProvider"
import { trackEvent } from "../../modules/ConsoleEventTracker"
import { ConsoleEvent } from "../../modules/ConsoleEventTracker/events"

const SettingsButton = styled(Button)`
padding: 0.6rem;
Expand All @@ -26,6 +28,7 @@ export const SetupAIAssistant = () => {

const handleSettingsClick = () => {
if (isConfigured) {
void trackEvent(ConsoleEvent.AI_SETTINGS_OPEN)
setSettingsModalOpen(true)
} else {
if (showPromo) {
Expand Down Expand Up @@ -60,6 +63,7 @@ export const SetupAIAssistant = () => {
showPromo={showPromo}
setShowPromo={setShowPromo}
onSetupClick={() => {
void trackEvent(ConsoleEvent.AI_CONFIGURATION_OPEN)
setShowPromo(false)
setConfigModalOpen(true)
}}
Expand Down
3 changes: 3 additions & 0 deletions src/js/console/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import { copyToClipboard } from "../../utils/copyToClipboard"
import { unescapeHtml } from "../../utils/escapeHtml"
import { toast } from "../../components"
import { trackEvent } from "../../modules/ConsoleEventTracker"
import { ConsoleEvent } from "../../modules/ConsoleEventTracker/events"

const hashString = (str) => {
let hash = 0
Expand Down Expand Up @@ -1755,6 +1757,7 @@ export function grid(rootElement, _paginationFn, id) {

function copyActiveCellToClipboard() {
if (focusedCell) {
void trackEvent(ConsoleEvent.GRID_CELL_COPY)
if (activeCellPulseClearTimer) {
clearTimeout(activeCellPulseClearTimer)
}
Expand Down
Loading
Loading