Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Gilbert09 committed Oct 18, 2024
1 parent 8b1f1e3 commit 4c3a3b7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
9 changes: 2 additions & 7 deletions frontend/src/queries/Query/Query.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export function Query<Q extends Node>(props: QueryProps<Q>): JSX.Element | null
context={queryContext}
cachedResults={props.cachedResults}
uniqueKey={uniqueKey}
readOnly={readOnly}
/>
)
} else if (isDataVisualizationNode(query)) {
Expand Down Expand Up @@ -135,13 +136,7 @@ export function Query<Q extends Node>(props: QueryProps<Q>): JSX.Element | null
} else if (isWebOverviewQuery(query)) {
component = <WebOverview query={query} cachedResults={props.cachedResults} context={queryContext} />
} else if (isHogQuery(query)) {
component = (
<HogDebug
query={query}
setQuery={setQuery as undefined | ((query: any) => void)}
queryKey={String(uniqueKey)}
/>
)
component = <HogDebug query={query} setQuery={setQuery as (query: any) => void} queryKey={String(uniqueKey)} />
} else {
component = <DataNode query={query} cachedResults={props.cachedResults} />
}
Expand Down
14 changes: 11 additions & 3 deletions frontend/src/queries/nodes/DataTable/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,15 @@ import { DataTableOpenEditor } from './DataTableOpenEditor'
interface DataTableProps {
uniqueKey?: string | number
query: DataTableNode
setQuery?: (query: DataTableNode) => void
setQuery: (query: DataTableNode) => void
/** Custom table columns */
context?: QueryContext<DataTableNode>
/* Cached Results are provided when shared or exported,
the data node logic becomes read only implicitly */
cachedResults?: AnyResponseType
// Override the data logic node key if needed
dataNodeLogicKey?: string
readOnly?: boolean
}

const eventGroupTypes = [
Expand All @@ -88,7 +89,14 @@ const personGroupTypes = [TaxonomicFilterGroupType.HogQLExpression, TaxonomicFil

let uniqueNode = 0

export function DataTable({ uniqueKey, query, setQuery, context, cachedResults }: DataTableProps): JSX.Element {
export function DataTable({
uniqueKey,
query,
setQuery,
context,
cachedResults,
readOnly,
}: DataTableProps): JSX.Element {
const [uniqueNodeKey] = useState(() => uniqueNode++)
const [dataKey] = useState(() => `DataNode.${uniqueKey || uniqueNodeKey}`)
const insightProps: InsightLogicProps<DataTableNode> = context?.insightProps || {
Expand Down Expand Up @@ -148,7 +156,7 @@ export function DataTable({ uniqueKey, query, setQuery, context, cachedResults }
showTimings,
} = queryWithDefaults

const isReadOnly = setQuery === undefined
const isReadOnly = !!readOnly

const eventActionsColumnShown =
showActions && sourceFeatures.has(QueryFeature.eventActionsColumn) && columnsInResponse?.includes('*')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import { displayLogic } from './displayLogic'
interface DataTableVisualizationProps {
uniqueKey?: string | number
query: DataVisualizationNode
setQuery?: (query: DataVisualizationNode) => void
setQuery: (query: DataVisualizationNode) => void
context?: QueryContext<DataVisualizationNode>
/* Cached Results are provided when shared or exported,
the data node logic becomes read only implicitly */
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/queries/nodes/InsightViz/InsightViz.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const insightVizDataCollectionId = (props: InsightLogicProps<any> | undef
type InsightVizProps = {
uniqueKey?: string | number
query: InsightVizNode
setQuery?: (node: InsightVizNode) => void
setQuery: (node: InsightVizNode) => void
context?: QueryContext
readOnly?: boolean
embedded?: boolean
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/scenes/debug/HogDebug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export function HogQueryEditor(props: HogQueryEditorProps): JSX.Element {
interface HogDebugProps {
queryKey: string
query: HogQuery
setQuery?: (query: HogQuery) => void
setQuery: (query: HogQuery) => void
debug?: boolean
}

Expand Down

0 comments on commit 4c3a3b7

Please sign in to comment.