Skip to content

Commit

Permalink
feat(web-analytics): Change query runner query type
Browse files Browse the repository at this point in the history
  • Loading branch information
robbie-c committed Sep 29, 2023
1 parent 8a83e3e commit ed01d5b
Show file tree
Hide file tree
Showing 19 changed files with 873 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ import {
import { Resizeable } from 'lib/components/Cards/CardMeta'
import { Query } from '~/queries/Query/Query'
import { QueriesUnsupportedHere } from 'lib/components/Cards/InsightCard/QueriesUnsupportedHere'
import { QueryContext } from '~/queries/schema'
import { InsightMeta } from './InsightMeta'
import { dataNodeLogic, DataNodeLogicProps } from '~/queries/nodes/DataNode/dataNodeLogic'
import { filtersToQueryNode } from '~/queries/nodes/InsightQuery/utils/filtersToQueryNode'
import { insightVizDataNodeKey } from '~/queries/nodes/InsightViz/InsightViz'
import { getCachedResults } from '~/queries/nodes/InsightViz/utils'
import { funnelDataLogic } from 'scenes/funnels/funnelDataLogic'
import { QueryContext } from '~/queries/types'

type DisplayedType = ChartDisplayType | 'RetentionContainer' | 'FunnelContainer' | 'PathsContainer'

Expand Down
5 changes: 3 additions & 2 deletions frontend/src/queries/Query/Query.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import {
isDataNode,
isDataTableNode,
isSavedInsightNode,
isInsightVizNode,
isSavedInsightNode,
isTimeToSeeDataSessionsNode,
} from '../utils'
import { DataTable } from '~/queries/nodes/DataTable/DataTable'
import { DataNode } from '~/queries/nodes/DataNode/DataNode'
import { InsightViz } from '~/queries/nodes/InsightViz/InsightViz'
import { AnyResponseType, Node, QueryContext, QuerySchema } from '~/queries/schema'
import { AnyResponseType, Node, QuerySchema } from '~/queries/schema'
import { ErrorBoundary } from '~/layout/ErrorBoundary'
import { useEffect, useState } from 'react'
import { TimeToSeeData } from '../nodes/TimeToSeeData/TimeToSeeData'
import { QueryEditor } from '~/queries/QueryEditor/QueryEditor'
import { LemonDivider } from 'lib/lemon-ui/LemonDivider'
import { SavedInsight } from '../nodes/SavedInsight/SavedInsight'
import { QueryContext } from '~/queries/types'

export interface QueryProps<T extends Node = QuerySchema | Node> {
/** An optional key to identify the query */
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/queries/QueryEditor/QueryEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { queryEditorLogic } from '~/queries/QueryEditor/queryEditorLogic'
import { AutoSizer } from 'react-virtualized/dist/es/AutoSizer'
import clsx from 'clsx'
import { QueryContext } from '~/queries/schema'
import { CodeEditor } from 'lib/components/CodeEditors'
import { QueryContext } from '~/queries/types'

export interface QueryEditorProps {
query: string
setQuery?: (query: string) => void
Expand Down
11 changes: 2 additions & 9 deletions frontend/src/queries/nodes/DataTable/DataTable.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import './DataTable.scss'
import {
AnyResponseType,
DataTableNode,
EventsNode,
EventsQuery,
HogQLQuery,
PersonsNode,
QueryContext,
} from '~/queries/schema'
import { AnyResponseType, DataTableNode, EventsNode, EventsQuery, HogQLQuery, PersonsNode } from '~/queries/schema'
import { useCallback, useState } from 'react'
import { BindLogic, useValues } from 'kea'
import { dataNodeLogic, DataNodeLogicProps } from '~/queries/nodes/DataNode/dataNodeLogic'
Expand Down Expand Up @@ -43,6 +35,7 @@ import { EventType } from '~/types'
import { SavedQueries } from '~/queries/nodes/DataTable/SavedQueries'
import { HogQLQueryEditor } from '~/queries/nodes/HogQLQuery/HogQLQueryEditor'
import { QueryFeature } from '~/queries/nodes/DataTable/queryFeatures'
import { QueryContext } from '~/queries/types'

interface DataTableProps {
uniqueKey?: string | number
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/queries/nodes/DataTable/dataTableLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
EventsQuery,
HogQLExpression,
NodeKind,
QueryContext,
TimeToSeeDataSessionsQuery,
} from '~/queries/schema'
import { getColumnsForQuery, removeExpressionComment } from './utils'
Expand All @@ -18,6 +17,7 @@ import { dataNodeLogic } from '~/queries/nodes/DataNode/dataNodeLogic'
import { dayjs } from 'lib/dayjs'
import equal from 'fast-deep-equal'
import { getQueryFeatures, QueryFeature } from '~/queries/nodes/DataTable/queryFeatures'
import { QueryContext } from '~/queries/types'

export interface DataTableLogicProps {
vizKey: string
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/queries/nodes/DataTable/renderColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { TZLabel } from 'lib/components/TZLabel'
import { Property } from 'lib/components/Property'
import { urls } from 'scenes/urls'
import { PersonDisplay } from 'scenes/persons/PersonDisplay'
import { DataTableNode, EventsQueryPersonColumn, HasPropertiesNode, QueryContext } from '~/queries/schema'
import { DataTableNode, EventsQueryPersonColumn, HasPropertiesNode } from '~/queries/schema'
import { isEventsQuery, isHogQLQuery, isPersonsNode, isTimeToSeeDataSessionsQuery, trimQuotes } from '~/queries/utils'
import { combineUrl, router } from 'kea-router'
import { CopyToClipboardInline } from 'lib/components/CopyToClipboard'
Expand All @@ -17,6 +17,7 @@ import { Spinner } from 'lib/lemon-ui/Spinner/Spinner'
import { LemonTag } from 'lib/lemon-ui/LemonTag/LemonTag'
import { TableCellSparkline } from 'lib/lemon-ui/LemonTable/TableCellSparkline'
import { Tooltip } from 'lib/lemon-ui/Tooltip'
import { QueryContext } from '~/queries/types'

export function renderColumn(
key: string,
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/queries/nodes/DataTable/renderColumnMeta.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { PropertyFilterType } from '~/types'
import { PropertyKeyInfo } from 'lib/components/PropertyKeyInfo'
import { QueryContext, DataTableNode } from '~/queries/schema'
import { DataTableNode } from '~/queries/schema'
import { isEventsQuery, isHogQLQuery, trimQuotes } from '~/queries/utils'
import { extractExpressionComment } from '~/queries/nodes/DataTable/utils'
import { SortingIndicator } from 'lib/lemon-ui/LemonTable/sorting'
import { QueryContext } from '~/queries/types'

export interface ColumnMeta {
title?: JSX.Element | string
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/queries/nodes/InsightViz/InsightContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import { funnelDataLogic } from 'scenes/funnels/funnelDataLogic'
import { insightDataLogic } from 'scenes/insights/insightDataLogic'
import { insightNavLogic } from 'scenes/insights/InsightNav/insightNavLogic'

import { QueryContext } from '~/queries/schema'
import { ChartDisplayType, FunnelVizType, ExporterFormat, InsightType, ItemMode } from '~/types'
import { ChartDisplayType, ExporterFormat, FunnelVizType, InsightType, ItemMode } from '~/types'
import { Tooltip } from 'lib/lemon-ui/Tooltip'
import { Animation } from 'lib/components/Animation/Animation'
import { AnimationType } from 'lib/animations/animations'
Expand All @@ -34,6 +33,7 @@ import { FunnelStepsTable } from 'scenes/insights/views/Funnels/FunnelStepsTable
import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'
import { FunnelCorrelation } from 'scenes/insights/views/Funnels/FunnelCorrelation'
import { InsightResultMetadata } from './InsightResultMetadata'
import { QueryContext } from '~/queries/types'

const VIEW_MAP = {
[`${InsightType.TRENDS}`]: <TrendInsight view={InsightType.TRENDS} />,
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/queries/nodes/InsightViz/InsightViz.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { insightSceneLogic } from 'scenes/insights/insightSceneLogic'
import { isFunnelsQuery } from '~/queries/utils'

import { dataNodeLogic, DataNodeLogicProps } from '../DataNode/dataNodeLogic'
import { InsightVizNode, QueryContext } from '../../schema'
import { InsightVizNode } from '../../schema'

import { InsightContainer } from './InsightContainer'
import { EditorFilters } from './EditorFilters'
Expand All @@ -17,6 +17,7 @@ import { useState } from 'react'

import './Insight.scss'
import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'
import { QueryContext } from '~/queries/types'

/** The key for the dataNodeLogic mounted by an InsightViz for insight of insightProps */
export const insightVizDataNodeKey = (insightProps: InsightLogicProps): string => {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/queries/nodes/SavedInsight/SavedInsight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import { useValues } from 'kea'

import { insightLogic } from 'scenes/insights/insightLogic'
import { Query } from '~/queries/Query/Query'
import { SavedInsightNode, QueryContext } from '~/queries/schema'
import { SavedInsightNode } from '~/queries/schema'
import { InsightLogicProps } from '~/types'
import { Animation } from 'lib/components/Animation/Animation'
import { AnimationType } from 'lib/animations/animations'
import { insightDataLogic } from 'scenes/insights/insightDataLogic'
import { QueryContext } from '~/queries/types'

interface InsightProps {
query: SavedInsightNode
Expand Down
Loading

0 comments on commit ed01d5b

Please sign in to comment.