-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(experiments): Use a HogQL expression data warehouse setup (#26650)
- Loading branch information
1 parent
6ffe264
commit 8a11a18
Showing
3 changed files
with
88 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
frontend/src/lib/components/HogQLDropdown/HogQLDropdown.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { LemonButton, LemonDropdown } from '@posthog/lemon-ui' | ||
import clsx from 'clsx' | ||
import { useState } from 'react' | ||
|
||
import { NodeKind } from '~/queries/schema' | ||
|
||
import { HogQLEditor } from '../HogQLEditor/HogQLEditor' | ||
|
||
export const HogQLDropdown = ({ | ||
hogQLValue, | ||
onHogQLValueChange, | ||
tableName, | ||
className = '', | ||
}: { | ||
hogQLValue: string | ||
tableName: string | ||
className?: string | ||
onHogQLValueChange: (hogQLValue: string) => void | ||
}): JSX.Element => { | ||
const [isHogQLDropdownVisible, setIsHogQLDropdownVisible] = useState(false) | ||
|
||
return ( | ||
<div className={clsx('flex-auto overflow-hidden', className)}> | ||
<LemonDropdown | ||
visible={isHogQLDropdownVisible} | ||
closeOnClickInside={false} | ||
onClickOutside={() => setIsHogQLDropdownVisible(false)} | ||
overlay={ | ||
// eslint-disable-next-line react/forbid-dom-props | ||
<div className="w-120" style={{ maxWidth: 'max(60vw, 20rem)' }}> | ||
<HogQLEditor | ||
value={hogQLValue} | ||
metadataSource={{ kind: NodeKind.HogQLQuery, query: `SELECT * FROM ${tableName}` }} | ||
onChange={(currentValue) => { | ||
onHogQLValueChange(currentValue) | ||
setIsHogQLDropdownVisible(false) | ||
}} | ||
/> | ||
</div> | ||
} | ||
> | ||
<LemonButton | ||
fullWidth | ||
type="secondary" | ||
onClick={() => setIsHogQLDropdownVisible(!isHogQLDropdownVisible)} | ||
> | ||
<code>{hogQLValue}</code> | ||
</LemonButton> | ||
</LemonDropdown> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters