-
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(web-analytics): Add overview stats (#17722)
* Move web analytics CTEs to their own file * Add overview stats query * Add very basic structure of web dashboard * Add missing entry in SavedInsights * Move session_cte into from * Replace dashboard css with "tailwind" * Make top pages query not a f-string
- Loading branch information
Showing
17 changed files
with
482 additions
and
236 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
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
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
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
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
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
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,21 @@ | ||
import { Query } from '~/queries/Query/Query' | ||
import { useValues } from 'kea' | ||
import { webAnalyticsLogic } from 'scenes/web-analytics/webAnalyticsLogic' | ||
|
||
export const WebAnalyticsDashboard = (): JSX.Element => { | ||
const { tiles } = useValues(webAnalyticsLogic) | ||
return ( | ||
<div className="grid grid-cols-12 gap-4"> | ||
{tiles.map(({ query, layout }, i) => ( | ||
<div | ||
key={i} | ||
className={`col-span-${layout.colSpan ?? 6} row-span-${ | ||
layout.rowSpan ?? 1 | ||
} min-h-100 flex flex-col`} | ||
> | ||
<Query query={query} readOnly={true} /> | ||
</div> | ||
))} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,67 @@ | ||
import { actions, connect, kea, listeners, path, reducers, selectors, sharedListeners } from 'kea' | ||
|
||
import type { webAnalyticsLogicType } from './webAnalyticsLogicType' | ||
import { NodeKind, QuerySchema } from '~/queries/schema' | ||
|
||
interface Layout { | ||
colSpan?: number | ||
rowSpan?: number | ||
} | ||
export interface WebDashboardTile { | ||
query: QuerySchema | ||
layout: Layout | ||
} | ||
export const webAnalyticsLogic = kea<webAnalyticsLogicType>([ | ||
path(['scenes', 'webAnalytics', 'webAnalyticsSceneLogic']), | ||
connect({}), | ||
actions({}), | ||
reducers({}), | ||
selectors(() => ({})), | ||
selectors({ | ||
tiles: [ | ||
() => [], | ||
(): WebDashboardTile[] => [ | ||
{ | ||
layout: { | ||
colSpan: 12, | ||
}, | ||
query: { | ||
full: true, | ||
kind: NodeKind.DataTableNode, | ||
source: { | ||
kind: NodeKind.WebOverviewStatsQuery, | ||
filters: {}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
layout: { | ||
colSpan: 6, | ||
}, | ||
query: { | ||
full: true, | ||
kind: NodeKind.DataTableNode, | ||
source: { | ||
kind: NodeKind.WebTopPagesQuery, | ||
filters: {}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
layout: { | ||
colSpan: 6, | ||
}, | ||
query: { | ||
full: true, | ||
kind: NodeKind.DataTableNode, | ||
source: { | ||
kind: NodeKind.WebTopSourcesQuery, | ||
filters: {}, | ||
}, | ||
}, | ||
}, | ||
], | ||
], | ||
}), | ||
sharedListeners(() => ({})), | ||
listeners(() => ({})), | ||
]) |
Oops, something went wrong.