Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(dashboards): render NotFound only on a settled 404, not on missing data (#76082)

Matt Pua4134355d821f
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 61257246d612..f340503eded3 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -5578,54 +5578,22 @@ snapshots:
hash: v1.k794b7964.7b105d74e4bd6c48e6ffee982e294557b0230d3c43769a252c753745f0d8ec0a.j2wHTrpAU0iVskR8PYJPk9KNhWUYrGDbwyxM0h9015M
scenes-app-customer-analytics-journeys-nodes-profileflownode--optional-not-completed--light:
hash: v1.k794b7964.165b884e9e737c00707811f9efa7d348927a432402c544b41495eac9722a1fca.wqLWQTzb1O7RBTeeyTR5l_hUeX0IpJXkgexpAQbuNWs
- scenes-app-dashboards--access-control-dashboard--dark:
- hash: v1.k794b7964.0d8f4e16f3bcd82f492569c9d57e00e8832cf39bfed4b85d9c2aaf69e81031d6.uSc9iCdSK_l3raRHxIVu7tVsgyKSOLoGZX2jcR3UOCo
- scenes-app-dashboards--access-control-dashboard--light:
- hash: v1.k794b7964.2a7218a37b2ddef398f5014ce00453fcdc1b4619ff85853b821c1344c8242053.DuVPcy6HzLcslw0RnsYXUbh5G_FGGYc7v2up3anNK0w
- scenes-app-dashboards--edit--dark:
- hash: v1.k794b7964.b85e622d121e2edfb031fec73921ba7d775a50124f5d68c8c82ad28a51985434.eFMlXYTQdWLdvwn7YobjvgCNrFbx2IMXMt2Lzs0yyo4
- scenes-app-dashboards--edit--light:
- hash: v1.k794b7964.49c4e9690bd77d8c7a66dea80d23618e98cfbb1092f918bc47d7518de0bd4cad.2kla497MZylrcqwodI1R5fGyLuRQwKmuaXviNn4gVi0
- scenes-app-dashboards--erroring--dark:
- hash: v1.k794b7964.f1569b95b37fd696ca93e1a429e100488d36b5283e843ba53e94a1dd0237a2c2.89VlumysxOVYUehHA-D-pwFe8LVtLhMbrjf13VAskKY
- scenes-app-dashboards--erroring--light:
- hash: v1.k794b7964.1679f49acc091fc932acd5aee0d19e379c6f5158aefea7edb399f9b0d5a6fc71.F46jqKuhhvYhXv4E9pFTt13CpvLyaNv5AJy0pqSt81Y
+ scenes-app-dashboards--dashboard-states--dark:
+ hash: v1.k794b7964.eadbe0e176b4e99b3b49bda17d1733abc1c19bad129432b8652930d06842034f.E7zBlfYt1tEeIZXvo5obAzaL4nZWP4SKaMCyKcwrnuo
+ scenes-app-dashboards--dashboard-states--light:
+ hash: v1.k794b7964.5104fed8ad7b43526968b2d278ee70f2c560588af25f63c9909662b58863d5f8.Kb8I4hyHuSD4g_SxJaH3yZzFFgqrVCImcy0M6jp27Io
scenes-app-dashboards--list--dark:
hash: v1.k794b7964.00d0fa213e763d116afb415f4a3fea1e98d5d6e81ca29d30e842cd74cf50d7ac.e1Co2_8OmCVBy1IWy67r9-Uo-nt8tATEi1TPcyiV25Y
scenes-app-dashboards--list--light:
hash: v1.k794b7964.8a9ad756d6aff75458241be69cb48a69d8df5a812aafa312256d312f581b5629.TPQoZ3DkpZdldKCS5hx9f5WAaMAHY8TTGoUWjrXA-Zw
- scenes-app-dashboards--new--dark:
- hash: v1.k794b7964.0a812dc0a14bd20dd0b2c88701ee5ef011ced558218f55f787b73d5e6e200557.uUIqLrdSaRIgntHU8Y8ounYiTocCFv55lEntTH7iWUA
- scenes-app-dashboards--new--light:
- hash: v1.k794b7964.e135fb19127d4e79d117b7fcb5550311c2113f8270e1ccde250d4285416694db.ThjbNZgTwq6Lp_NQZ5c_THcn9YWr7mJ212ZP0m6sxxE
+ scenes-app-dashboards--new-dashboard-modal--dark:
+ hash: v1.k794b7964.09aeb9a9e7c4cba1d60a71d04c092dba183b777899317a1adc4132ada91b149d.WsFZ7c7EkU4WZ3LXjE86EgfZomRxQQgxKBjf9pLs6H4
+ scenes-app-dashboards--new-dashboard-modal--light:
+ hash: v1.k794b7964.efef41777007ace5a224150f359a3a5adb20fef1f359da19ca8c00f6cc7f24dd.E865w7TaWkthreAAOFY1K8iSjFdtE7RTJlhGVkVuDuM
scenes-app-dashboards--new-select-variables--dark:
hash: v1.k794b7964.369294c02a688cb4e20bf6c50c1bd4547e948e9edd37da97de3a3f22d2a7370b.UYYFQYqpgQ9LngU4sSowj-D-opolhj2Qtk7hwnqOr5k
scenes-app-dashboards--new-select-variables--light:
hash: v1.k794b7964.797ad1692f8f2234f4b8d77f434d185d846f47461366c53a435e581ab9a30213._Df8CY78V8jElYaTyOhXUsQMETjiIDr2zehSgb8D5Mo
- scenes-app-dashboards--not-found--dark:
- hash: v1.k794b7964.d5253d0fd9f143de83259d6ba9cd213fdff2ce949117c52b2f88bc78f6a73f7e.7-lf2SKFsVV2pNFc4mN3mW4wW1EpJfwEd1lXLybo3mk
- scenes-app-dashboards--not-found--light:
- hash: v1.k794b7964.ed4b8e9397bf960ff4b19b54e722c74962b25a2ec0270ecc090eda9b6d5d7f7b.XiealyyQzU_NqFX_PQmkZiIkJcX0h_joVE0Wbl-1twc
- scenes-app-dashboards--show-across-viewports--medium--dark:
- hash: v1.k794b7964.700cde8e1a4cc8c902b217300de8c5bbca2c3d1d4c727f0533fc664679bc22d3.bd-grjT3BisGzyb6iVrYefXx4uBqpaFrcjl3ZM-eEII
- scenes-app-dashboards--show-across-viewports--medium--light:
- hash: v1.k794b7964.d6d98db22461a9fcc20cfd0cc0895ee4fc2a55161f65b64ffe6cf27f51d99283.QKCyAmMYL4QKkMB6RCEfi4sSiY9IYcrVmRoi8xeYS_0
- scenes-app-dashboards--show-across-viewports--narrow--dark:
- hash: v1.k794b7964.e919c4955d7113170ab00269c5f628c318afe14f26dc8aafb046b172e17f362e.YDXD84rrb2KR1I36pHMxEsGZ0sN0os_cBBdNIf89Pu8
- scenes-app-dashboards--show-across-viewports--narrow--light:
- hash: v1.k794b7964.61689120594f7d93205490ecc2d8a6a91cbfca510e0f321cab8de6697c1a30ee.u0YLZQ3GdtApGR6RM-2HDvep5Clj4DAXPHvFtGZAjSY
- scenes-app-dashboards--show-across-viewports--superwide--dark:
- hash: v1.k794b7964.9948b52cf842206c1584057a6a16b8caed7a32d95f103dbea07089a02df75a53.AuXGqOvw-P-XuzOL2Zl-BkBPb1-Q3R1949f5-IkTjZA
- scenes-app-dashboards--show-across-viewports--superwide--light:
- hash: v1.k794b7964.1542648e0574b69e733300ac19ebc6a85de75a6d844c7d3a6fb1563ab91b7678.ooG1TuGEfLZFGwwM6lrPBhHFe_HOoNm46gvg6ySnp9c
- scenes-app-dashboards--show-across-viewports--wide--dark:
- hash: v1.k794b7964.8eda456a1e6977f86853707a6bb59082480b6840481df879ef62bb11a5e1266d.-2RnTNoWUUoSApAiuc-tozXF6p8FJBtS19b_RhCtCrQ
- scenes-app-dashboards--show-across-viewports--wide--light:
- hash: v1.k794b7964.2a748a776b2f744013e450da34ffe4916fe9b4219e2eb1a285527d38bab66ae6.NvjlpxgiqbitrdcBtd1Y-gaJHb2TI7zeFt-Td4pcuTI
- scenes-app-dashboards--view-only-dashboard--dark:
- hash: v1.k794b7964.f550d9fef24e7bb7433e5a98b26f61dadc18e5fb0e7162fd01fb37d4cf7290a9.XTRFXTXlBUztmcj1ruYRU8nkOvtpDCz4gewMVkhHfEM
- scenes-app-dashboards--view-only-dashboard--light:
- hash: v1.k794b7964.9afe34608abd84010f386c6f1da1669441ca823febfba881e480465f13569c3c.ZvdqzPeIt4d9kmQqk4EAZs6XEkjCjrNNhRg9wyvGdrs
scenes-app-dashboards-add-insight-to-dashboard-modal--default--dark:
hash: v1.k794b7964.65a26ab25825086d5463677deec55324c7ada5ad92d46976038a9334748fdafd.-icTyqvvUjLQRZfthpF9m2gJ513_nxn6zhe-ChRyTrI
scenes-app-dashboards-add-insight-to-dashboard-modal--default--light:
diff --git a/frontend/src/lib/api-error.test.ts b/frontend/src/lib/api-error.test.ts
new file mode 100644
index 000000000000..447739c8558d
--- /dev/null
+++ b/frontend/src/lib/api-error.test.ts
@@ -0,0 +1,57 @@
+import { ApiError } from './api-error'
+
+describe('ApiError.fromResponse', () => {
+ it.each([
+ ['error', { error: 'error message' }, 'error message'],
+ ['detail', { detail: 'detail message' }, 'detail message'],
+ ['message', { message: 'message value' }, 'message value'],
+ ])('uses the %s field as the error message', async (_, body, expected) => {
+ const response = new Response(JSON.stringify(body), { status: 400 })
+
+ const error = await ApiError.fromResponse(response, 'fallback')
+
+ expect(error).toMatchObject({ message: expected, status: 400, data: body })
+ })
+
+ it('uses the fallback for a response without a recognized message', async () => {
+ const response = new Response('Bad gateway', { status: 502 })
+
+ const error = await ApiError.fromResponse(response, 'Request failed')
+
+ expect(error).toMatchObject({ message: 'Request failed', status: 502, data: null })
+ })
+
+ it('preserves response metadata and prioritizes error messages consistently', async () => {
+ const body = {
+ error: 'primary message',
+ detail: 'DRF detail',
+ message: 'secondary message',
+ code: 'permission_denied',
+ }
+
+ const error = await ApiError.fromResponse(new Response(JSON.stringify(body), { status: 403 }))
+
+ expect(error).toMatchObject({
+ message: 'primary message',
+ detail: 'DRF detail',
+ code: 'permission_denied',
+ status: 403,
+ data: body,
+ })
+ })
+
+ it('uses the default ApiError message for an empty response without a fallback', async () => {
+ const error = await ApiError.fromResponse(new Response(null, { status: 404 }))
+
+ expect(error).toMatchObject({ message: 'API request failed with status: 404', status: 404, data: null })
+ })
+
+ it('propagates an aborted response body read', async () => {
+ const abortError = new DOMException('Aborted', 'AbortError')
+ const response = {
+ json: jest.fn().mockRejectedValue(abortError),
+ } as unknown as Response
+
+ await expect(ApiError.fromResponse(response)).rejects.toBe(abortError)
+ })
+})
diff --git a/frontend/src/lib/api-error.ts b/frontend/src/lib/api-error.ts
index ac41fff41377..df602409c98d 100644
--- a/frontend/src/lib/api-error.ts
+++ b/frontend/src/lib/api-error.ts
@@ -34,6 +34,25 @@ export class ApiError extends Error {
this.attr = data?.attr || null
}
+ static async fromResponse(response: Response, fallbackMessage?: string): Promise<ApiError> {
+ let data: unknown = null
+
+ try {
+ data = await response.json()
+ } catch (error) {
+ if ((error as { name?: string } | null)?.name === 'AbortError') {
+ throw error
+ }
+ }
+
+ const errorData = data && typeof data === 'object' ? (data as Record<string, unknown>) : null
+ const responseMessage = [errorData?.error, errorData?.detail, errorData?.message].find(
+ (value): value is string => typeof value === 'string'
+ )
+
+ return new ApiError(responseMessage || fallbackMessage, response.status, response.headers, data)
+ }
+
/**
* For when the API returned a 429 (Too Many Requests) error:
* If the `Retry-After` header is present, return a human-friendly duration, e.g. "in 4 hours", otherwise just "later".
diff --git a/frontend/src/lib/api.test.ts b/frontend/src/lib/api.test.ts
index aef1ff293181..0bbeb3546795 100644
--- a/frontend/src/lib/api.test.ts
+++ b/frontend/src/lib/api.test.ts
@@ -1,6 +1,8 @@
+import * as fetchEventSourceModule from '@microsoft/fetch-event-source'
import posthog from 'posthog-js'
import api, { ApiConfig, ApiError, ApiRequest } from 'lib/api'
+import { apiStatusLogic } from 'lib/logic/apiStatusLogic'
import { NodeKind } from '~/queries/schema/schema-general'
import { PropertyFilterType, PropertyOperator } from '~/types'
@@ -59,6 +61,84 @@ describe('API helper', () => {
})
})
+ describe('dashboard tile streaming', () => {
+ it.each([
+ { status: 401, body: { detail: 'Authentication expired.' }, expectedCode: null },
+ {
+ status: 403,
+ body: { detail: 'Access denied.', code: 'permission_denied' },
+ expectedCode: 'permission_denied',
+ },
+ ])('preserves status handling for HTTP $status', async ({ status, body, expectedCode }) => {
+ const onApiResponse = jest.fn()
+ const apiStatusLogicSpy = jest
+ .spyOn(apiStatusLogic, 'findMounted')
+ .mockReturnValueOnce({ actions: { onApiResponse } } as any)
+
+ const fetchEventSourceSpy = jest
+ .spyOn(fetchEventSourceModule, 'fetchEventSource')
+ .mockReturnValueOnce(new Promise<void>(() => {}))
+
+ const onError = jest.fn()
+ await api.dashboards.streamTiles(5, {}, jest.fn(), jest.fn(), onError)
+ expect(fetchEventSourceSpy).toHaveBeenCalledTimes(1)
+
+ const response = new Response(JSON.stringify(body), {
+ status,
+ headers: { 'Content-Type': 'application/json' },
+ })
+ await fetchEventSourceSpy.mock.calls[0][1].onopen?.(response)
+
+ expect(onApiResponse).toHaveBeenCalledTimes(1)
+ expect(onApiResponse.mock.calls[0][0]).toMatchObject({ status })
+ expect(onError).toHaveBeenCalledWith(expect.objectContaining({ status, code: expectedCode }))
+ fetchEventSourceSpy.mockRestore()
+ apiStatusLogicSpy.mockRestore()
+ })
+
+ it('reports connection failures and ignores intentional aborts', async () => {
+ const onApiResponse = jest.fn()
+ const apiStatusLogicSpy = jest
+ .spyOn(apiStatusLogic, 'findMounted')
+ .mockReturnValue({ actions: { onApiResponse } } as any)
+ const fetchEventSourceSpy = jest
+ .spyOn(fetchEventSourceModule, 'fetchEventSource')
+ .mockReturnValueOnce(new Promise<void>(() => {}))
+ const onError = jest.fn()
+
+ await api.dashboards.streamTiles(5, {}, jest.fn(), jest.fn(), onError)
+
+ const streamOptions = fetchEventSourceSpy.mock.calls[0][1]
+ const connectionError = new TypeError('Failed to fetch')
+ streamOptions.onerror?.(connectionError)
+ expect(onApiResponse).toHaveBeenCalledWith(undefined, connectionError)
+ expect(onError).toHaveBeenCalledWith(connectionError)
+
+ const abortError = new DOMException('The operation was aborted', 'AbortError')
+ streamOptions.onerror?.(abortError)
+ expect(onApiResponse).toHaveBeenCalledTimes(1)
+ expect(onError).toHaveBeenCalledTimes(1)
+
+ fetchEventSourceSpy.mockRestore()
+ apiStatusLogicSpy.mockRestore()
+ })
+
+ it('reports a stream that closes before completion', async () => {
+ const fetchEventSourceSpy = jest.spyOn(fetchEventSourceModule, 'fetchEventSource').mockResolvedValueOnce()
+ const onError = jest.fn()
+
+ await api.dashboards.streamTiles(5, {}, jest.fn(), jest.fn(), onError)
+ await Promise.resolve()
+
+ expect(onError).toHaveBeenCalledWith(
+ expect.objectContaining({
+ message: 'Dashboard stream ended before loading finished. Refresh the page.',
+ })
+ )
+ fetchEventSourceSpy.mockRestore()
+ })
+ })
+
describe('query endpoints', () => {
it('adds query kind to the query URL when present', async () => {
await api.query({ kind: NodeKind.HogQLQuery, query: 'select 1' })
diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts
index 76469ad8df4b..32d088a40214 100644
--- a/frontend/src/lib/api.ts
+++ b/frontend/src/lib/api.ts
@@ -365,10 +365,6 @@ export async function getJSONOrNull(response: Response): Promise<any> {
try {
return await response.json()
} catch (error) {
- // A body read cancelled mid-stream (navigation, superseded request) surfaces here as an
- // AbortError. Propagate it so it flows through the normal cancellation path instead of
- // masquerading as a successful `null` — otherwise callers dereference it (`.results`,
- // `.count`, …) and blow up with a `Cannot read properties of null` TypeError.
if (isAbortError(error)) {
throw error
}
@@ -376,6 +372,11 @@ export async function getJSONOrNull(response: Response): Promise<any> {
}
}
+function apiErrorFallback(response: Response, method: string, url: string): string {
+ const pathname = new URL(url, location.origin).pathname
+ return `Non-OK response [${method} ${pathname}] (status ${response.status}: ${response.statusText})`
+}
+
/**
* Parse the body of a *successful* response, which is expected to be JSON.
*
@@ -3547,28 +3548,24 @@ const api = {
.assembleFullUrl(true)
const abortController = new AbortController()
+ let streamFinished = false
+ const handleConnectionError = (error: any): void => {
+ if (isAbortError(error)) {
+ return
+ }
+ apiStatusLogic.findMounted()?.actions.onApiResponse(undefined, error)
+ onError(error)
+ }
fetchEventSource(url, {
signal: abortController.signal,
credentials: 'include',
openWhenHidden: true,
onopen: async (response) => {
- if (!response.ok) {
- // Get server error message if available
- let errorMessage = `HTTP ${response.status}`
- try {
- const errorText = await response.text()
- if (errorText) {
- errorMessage = `HTTP ${response.status}: ${errorText}`
- }
- } catch {
- // If we can't read the response, just use the status
- }
+ apiStatusLogic.findMounted()?.actions.onApiResponse(response.clone())
- // Carry the real HTTP status so callers can classify the failure by status code
- // rather than string-matching the message (which misfires on transient/stream errors).
- const error = new Error(errorMessage) as Error & { status?: number }
- error.status = response.status
+ if (!response.ok) {
+ const error = await ApiError.fromResponse(response, apiErrorFallback(response, 'GET', url))
onError(error)
abortController.abort()
return
@@ -3578,8 +3575,10 @@ const api = {
try {
const data = JSON.parse(event.data)
if (data.type === 'complete') {
+ streamFinished = true
onComplete()
} else if (data.type === 'error') {
+ streamFinished = true
onError(new Error(data.error || 'Streaming error'))
} else {
onMessage(data)
@@ -3589,9 +3588,15 @@ const api = {
}
},
onerror: (error) => {
- onError(error)
+ handleConnectionError(error)
},
- }).catch(onError)
+ }).then(() => {
+ if (!abortController.signal.aborted && !streamFinished) {
+ handleConnectionError(
+ new Error('Dashboard stream ended before loading finished. Refresh the page.')
+ )
+ }
+ }, handleConnectionError)
return () => abortController.abort()
},
@@ -7336,12 +7341,8 @@ const api = {
abortController.abort()
}
} else if (!response.ok) {
- let errorData: any = {}
- try {
- errorData = await response.json()
- } catch {
- // If JSON parsing fails, leave errorData empty
- }
+ const error = await ApiError.fromResponse(response, `Request failed with status ${response.status}`)
+ const errorData = error.data
// TEMPORARY: capture 401s with decoded (masked) JWT claims so we can
// identify which failure mode is producing the livestream auth baseline.
// Remove once root cause is known.
@@ -7354,14 +7355,7 @@ const api = {
server_message: errorData?.message || errorData?.error,
})
}
- onError(
- new ApiError(
- errorData.error || `Request failed with status ${response.status}`,
- response.status,
- response.headers,
- errorData
- )
- )
+ onError(error)
abortController.abort()
} else {
onOpen?.()
@@ -7573,28 +7567,7 @@ async function handleFetch(
}
}
- const data = await getJSONOrNull(response)
-
- if (response.status >= 400 && data) {
- if (typeof data.error === 'string') {
- throw new ApiError(data.error, response.status, response.headers, data)
- }
-
- if (typeof data.detail === 'string') {
- throw new ApiError(data.detail, response.status, response.headers, data)
- }
-
- if (typeof data.message === 'string') {
- throw new ApiError(data.message, response.status, response.headers, data)
- }
- }
-
- throw new ApiError(
- `Non-OK response [${method} ${pathname}] (status ${response.status}: ${response.statusText})`,
- response.status,
- response.headers,
- data
- )
+ throw await ApiError.fromResponse(response, apiErrorFallback(response, method, url))
}
return response
diff --git a/frontend/src/scenes/dashboard/Dashboard.tsx b/frontend/src/scenes/dashboard/Dashboard.tsx
index 4fc058dd25ff..4b9c2ab6f873 100644
--- a/frontend/src/scenes/dashboard/Dashboard.tsx
+++ b/frontend/src/scenes/dashboard/Dashboard.tsx
@@ -6,6 +6,7 @@ import { AccessDenied } from 'lib/components/AccessDenied'
import { NotFound } from 'lib/components/NotFound'
import { useFileSystemLogView } from 'lib/hooks/useFileSystemLogView'
import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
+import { Link } from 'lib/lemon-ui/Link'
import { cn } from 'lib/utils/css-classes'
import { DashboardFilterBar } from 'scenes/dashboard/DashboardFilters'
import { DashboardItems } from 'scenes/dashboard/DashboardItems'
@@ -13,6 +14,7 @@ import { DashboardLogicProps, dashboardLogic } from 'scenes/dashboard/dashboardL
import { dataThemeLogic } from 'scenes/dataThemeLogic'
import { InsightErrorState } from 'scenes/insights/EmptyStates'
import { SceneExport } from 'scenes/sceneTypes'
+import { urls } from 'scenes/urls'
import { SceneContent } from '~/layout/scenes/components/SceneContent'
import { SceneStickyBar } from '~/layout/scenes/components/SceneStickyBar'
@@ -95,6 +97,7 @@ function DashboardScene({
layoutEditMode,
dashboardFailedToLoad,
accessDeniedToDashboard,
+ error404,
} = useValues(dashboardLogic)
const { layoutZoom } = useValues(dashboardLogic)
const { currentTeamId } = useValues(teamLogic)
@@ -118,8 +121,19 @@ function DashboardScene({
return () => abortAnyRunningQuery()
})
- if (!dashboard && !itemsLoading && !dashboardFailedToLoad) {
- return <NotFound object="dashboard" />
+ // `error404` only becomes true once a load has settled as a 404, so pending loads fall through to the empty/loading state
+ if (error404 && !dashboard && !dashboardFailedToLoad) {
+ return (
+ <NotFound
+ object="dashboard"
+ caption={
+ <>
+ It may have been deleted, or the link is out of date.{' '}
+ <Link to={urls.dashboards()}>Go to your dashboards</Link>.
+ </>
+ }
+ />
+ )
}
if (accessDeniedToDashboard) {
@@ -136,9 +150,9 @@ function DashboardScene({
<DashboardPublicAccessBanner dashboard={dashboard} placement={placement} />
{dashboardFailedToLoad ? (
- <InsightErrorState title="There was an error loading this dashboard" />
+ <InsightErrorState title="There was an error loading this dashboard" supportOnly />
) : !tiles || tiles.length === 0 ? (
- <EmptyDashboardComponent loading={itemsLoading} canEdit={canEditDashboard} />
+ <EmptyDashboardComponent loading={itemsLoading || !dashboard} canEdit={canEditDashboard} />
) : (
<div
className={cn({
diff --git a/frontend/src/scenes/dashboard/DashboardInsightCardLegend.stories.tsx b/frontend/src/scenes/dashboard/DashboardInsightCardLegend.stories.tsx
deleted file mode 100644
index c3169d71e983..000000000000
--- a/frontend/src/scenes/dashboard/DashboardInsightCardLegend.stories.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import { Meta, StoryObj } from '@storybook/react'
-
-import { App } from 'scenes/App'
-import { urls } from 'scenes/urls'
-
-import { mswDecorator } from '~/mocks/browser'
-
-import __dashboard_insight_card_legend_legacy from './__mocks__/dashboard_insight_card_legend_legacy.json'
-import __dashboard_insight_card_legend_query from './__mocks__/dashboard_insight_card_legend_query.json'
-
-const meta: Meta = {
- component: App,
- title: 'Scenes-App/Dashboards',
- decorators: [
- mswDecorator({
- get: {
- '/api/environments/:team_id/dashboards/1/': __dashboard_insight_card_legend_query as any,
- '/api/environments/:team_id/dashboards/2/': __dashboard_insight_card_legend_legacy as any,
- },
- }),
- ],
- parameters: {
- layout: 'fullscreen',
- viewMode: 'story',
- mockDate: '2023-02-01',
- waitForSelector: '.InsightCard',
- pageUrl: urls.dashboard(1),
- },
- tags: ['test-skip'], // Flakey
-}
-export default meta
-
-type Story = StoryObj<{}>
-export const InsightLegend: Story = {}
-
-export const InsightLegendLegacy: Story = {
- parameters: {
- pageUrl: urls.dashboard(2),
- },
-}
diff --git a/frontend/src/scenes/dashboard/Dashboards.stories.tsx b/frontend/src/scenes/dashboard/Dashboards.stories.tsx
index 3b7831c9526b..8c8248c43b10 100644
--- a/frontend/src/scenes/dashboard/Dashboards.stories.tsx
+++ b/frontend/src/scenes/dashboard/Dashboards.stories.tsx
@@ -1,16 +1,15 @@
import { Meta, StoryObj } from '@storybook/react'
+import { delay, HttpResponse } from 'msw'
import { useDelayedOnMountEffect } from 'lib/hooks/useOnMountEffect'
-import { DashboardEventSource } from 'lib/utils/eventUsageLogic'
import { App } from 'scenes/App'
-import { dashboardLogic } from 'scenes/dashboard/dashboardLogic'
import { newDashboardLogic } from 'scenes/dashboard/newDashboardLogic'
import { urls } from 'scenes/urls'
-import { mswDecorator } from '~/mocks/browser'
+import { mswDecorator, useStorybookMocks } from '~/mocks/browser'
import { useAvailableFeatures } from '~/mocks/features'
import type { MockResolverInfo } from '~/mocks/utils'
-import { BaseMathType, DashboardMode, EntityTypes } from '~/types'
+import { BaseMathType, EntityTypes } from '~/types'
import __dashboard1 from './__mocks__/dashboard1.json'
import __dashboard_template_schema from './__mocks__/dashboard_template_schema.json'
@@ -70,8 +69,7 @@ const insightFetchMock = ({ params }: MockResolverInfo): [number, any] => {
}
const BASE_DASHBOARD_ID = 1
-const SERVER_ERROR_DASHBOARD_ID = 2
-const NOT_FOUND_DASHBOARD_ID = 1000
+const DASHBOARD_STATE_ID = 2
const meta: Meta = {
component: App,
@@ -84,10 +82,6 @@ const meta: Meta = {
...insightMocks,
'/api/environments/:team_id/insights/:id/': insightFetchMock,
[`/api/environments/:team_id/dashboards/${BASE_DASHBOARD_ID}/collaborators/`]: [],
- [`/api/environments/:team_id/dashboards/${SERVER_ERROR_DASHBOARD_ID}/`]: [
- 500,
- { detail: 'Server error' },
- ],
'/api/projects/:team_id/dashboard_templates/': __dashboard_templates as any,
'/api/projects/:team_id/dashboard_templates/json_schema/': __dashboard_template_schema as any,
'/api/environments/:team_id/dashboards/:dash_id/sharing/': {
@@ -117,9 +111,12 @@ const meta: Meta = {
export default meta
type Story = StoryObj<{}>
+const DASHBOARD_STATES = ['Loading', 'Not Found', 'Access Denied', 'Server Error', 'Empty'] as const
+type DashboardState = (typeof DASHBOARD_STATES)[number]
+
export const List: Story = {}
-export const New: Story = {
+export const NewDashboardModal: Story = {
render: () => {
useAvailableFeatures([])
useDelayedOnMountEffect(() => {
@@ -200,166 +197,50 @@ export const Show: Story = {
},
}
-// Multi-viewport snapshots of the dashboard scene from mobile to superwide, so we catch the header
-// layout (and any squishing) across breakpoints. `skipCanvasDraw` is re-declared because per-story
-// `testOptions` replaces the meta-level object rather than merging into it.
-export const ShowAcrossViewports: Story = {
- parameters: {
- pageUrl: urls.dashboard(BASE_DASHBOARD_ID),
- testOptions: { skipCanvasDraw: true, viewportWidths: ['narrow', 'medium', 'wide', 'superwide'] },
- },
-}
-
-export const Edit: Story = {
- render: () => {
- useDelayedOnMountEffect(() => {
- dashboardLogic({ id: BASE_DASHBOARD_ID }).mount()
- dashboardLogic({ id: BASE_DASHBOARD_ID }).actions.setDashboardMode(
- DashboardMode.Edit,
- DashboardEventSource.Browser
- )
- })
-
- return <App />
- },
- parameters: { pageUrl: urls.dashboard(BASE_DASHBOARD_ID) },
-}
-
-export const NotFound: Story = {
- parameters: {
- pageUrl: urls.dashboard(NOT_FOUND_DASHBOARD_ID),
- },
-}
-
-export const Erroring: Story = {
- parameters: {
- pageUrl: urls.dashboard(SERVER_ERROR_DASHBOARD_ID),
+export const DashboardStates: StoryObj<{ state: DashboardState }> = {
+ args: {
+ state: 'Loading',
},
-}
-
-// Access Control Dashboard Stories
-const ACCESS_CONTROL_DASHBOARD_ID = 9999
-
-const accessControlDashboard = {
- ...dashboard,
- id: ACCESS_CONTROL_DASHBOARD_ID,
- name: 'Access Control Demo Dashboard',
- description: 'Dashboard demonstrating different insight access levels',
- user_access_level: 'editor', // User has edit access to the dashboard
- tiles: [
- // Tile with no access insight
- {
- ...dashboard.tiles[0],
- id: 1001,
- insight: {
- ...dashboard.tiles[0].insight,
- id: 1001,
- short_id: 'no-access',
- name: 'Restricted Financial Data',
- description: 'This insight contains sensitive financial information.',
- user_access_level: 'none',
- },
- },
- // Tile with viewer access insight
- {
- ...dashboard.tiles[1],
- id: 1002,
- insight: {
- ...dashboard.tiles[1].insight,
- id: 1002,
- short_id: 'viewer-access',
- name: 'Public Metrics',
- description: 'General metrics available for viewing.',
- user_access_level: 'viewer',
- },
- },
- // Tile with editor access insight
- {
- ...dashboard.tiles[2],
- id: 1003,
- insight: {
- ...dashboard.tiles[2].insight,
- id: 1003,
- short_id: 'editor-access',
- name: 'Team Analytics',
- description: 'Analytics that the team can edit.',
- user_access_level: 'editor',
- },
- },
- // Tile with legacy insight (no access control)
- {
- ...dashboard.tiles[3],
- id: 1004,
- insight: {
- ...dashboard.tiles[3].insight,
- id: 1004,
- short_id: 'legacy-insight',
- name: 'Legacy Report',
- description: 'Old insight without access control.',
- // user_access_level is intentionally undefined
- },
+ argTypes: {
+ state: {
+ control: 'select',
+ options: DASHBOARD_STATES,
},
- ],
-}
-
-const accessControlInsightMocks = accessControlDashboard.tiles.reduce((acc: Record<string, any>, tile: any) => {
- if (tile.insight) {
- // Add both project and environment paths
- acc[`/api/projects/:team_id/insights/${tile.insight.id}/`] = tile.insight
- acc[`/api/environments/:team_id/insights/${tile.insight.id}/`] = tile.insight
- }
- return acc
-}, {})
-
-export const AccessControlDashboard: Story = {
- decorators: [
- mswDecorator({
- get: {
- ...accessControlInsightMocks,
- '/api/projects/:team_id/dashboards/': {
- count: 1,
- next: null,
- previous: null,
- results: [accessControlDashboard],
- },
- [`/api/projects/:team_id/dashboards/${ACCESS_CONTROL_DASHBOARD_ID}/`]: accessControlDashboard,
- [`/api/environments/:team_id/dashboards/${ACCESS_CONTROL_DASHBOARD_ID}/`]: accessControlDashboard,
- [`/api/environments/:team_id/insights/:id/`]: insightFetchMock,
- },
- }),
- ],
- parameters: {
- pageUrl: urls.dashboard(ACCESS_CONTROL_DASHBOARD_ID),
},
-}
-
-// Dashboard with no access (user can't edit dashboard but can view some insights)
-const viewOnlyDashboard = {
- ...accessControlDashboard,
- id: ACCESS_CONTROL_DASHBOARD_ID + 1,
- name: 'View Only Dashboard',
- description: 'Dashboard where user has view access only',
- user_access_level: 'viewer', // User can only view the dashboard
-}
-
-export const ViewOnlyDashboard: Story = {
- decorators: [
- mswDecorator({
+ render: ({ state }) => {
+ let response: any
+
+ switch (state) {
+ case 'Not Found':
+ response = [404, { detail: 'Not found.' }]
+ break
+ case 'Access Denied':
+ response = [403, { code: 'permission_denied', detail: 'You do not have access to this dashboard.' }]
+ break
+ case 'Server Error':
+ response = [500, { detail: 'Server error' }]
+ break
+ case 'Empty':
+ response = { ...dashboard, id: DASHBOARD_STATE_ID, name: 'Empty dashboard', tiles: [] }
+ break
+ case 'Loading':
+ response = async () => {
+ await delay('infinite')
+ return HttpResponse.json({})
+ }
+ break
+ }
+
+ useStorybookMocks({
get: {
- ...accessControlInsightMocks,
- '/api/projects/:team_id/dashboards/': {
- count: 1,
- next: null,
- previous: null,
- results: [viewOnlyDashboard],
- },
- [`/api/projects/:team_id/dashboards/${ACCESS_CONTROL_DASHBOARD_ID + 1}/`]: viewOnlyDashboard,
- [`/api/environments/:team_id/dashboards/${ACCESS_CONTROL_DASHBOARD_ID + 1}/`]: viewOnlyDashboard,
- [`/api/environments/:team_id/insights/:id/`]: insightFetchMock,
+ [`/api/environments/:team_id/dashboards/${DASHBOARD_STATE_ID}/`]: response,
},
- }),
- ],
+ })
+
+ return <App key={state} />
+ },
parameters: {
- pageUrl: urls.dashboard(ACCESS_CONTROL_DASHBOARD_ID + 1),
+ pageUrl: urls.dashboard(DASHBOARD_STATE_ID),
+ testOptions: { waitForLoadersToDisappear: false, waitForSelector: '[aria-label="Loading dashboard"]' },
},
}
diff --git a/frontend/src/scenes/dashboard/EmptyDashboardComponent.tsx b/frontend/src/scenes/dashboard/EmptyDashboardComponent.tsx
index 4aefac2f5666..e4f0dfecf69c 100644
--- a/frontend/src/scenes/dashboard/EmptyDashboardComponent.tsx
+++ b/frontend/src/scenes/dashboard/EmptyDashboardComponent.tsx
@@ -3,7 +3,7 @@ import { router } from 'kea-router'
import * as chartPng from '@posthog/brand/hoggies/png/chart'
import { IconPlus } from '@posthog/icons'
-import { LemonTag, Spinner } from '@posthog/lemon-ui'
+import { LemonSkeleton, LemonTag } from '@posthog/lemon-ui'
import { pngHoggie } from 'lib/brand/hoggies'
import { AccessControlAction } from 'lib/components/AccessControlAction'
@@ -193,8 +193,16 @@ function EmptyDashboardContent({ canEdit }: { canEdit: boolean }): JSX.Element {
export function EmptyDashboardComponent({ loading, canEdit }: { loading: boolean; canEdit: boolean }): JSX.Element {
if (loading) {
return (
- <div className="flex justify-center items-center min-h-[24rem] py-8">
- <Spinner />
+ <div className="grid grid-cols-1 lg:grid-cols-2 gap-4 py-4" aria-label="Loading dashboard">
+ {Array.from({ length: 8 }, (_, index) => (
+ <div key={index} className="border rounded bg-surface-primary p-4 min-h-64">
+ <div className="flex items-center justify-between gap-4 mb-6">
+ <LemonSkeleton className="h-4 w-2/5" />
+ <LemonSkeleton className="h-8 w-8 rounded" />
+ </div>
+ <LemonSkeleton className="h-40 w-full rounded" />
+ </div>
+ ))}
</div>
)
}
diff --git a/frontend/src/scenes/dashboard/__mocks__/dashboard_insight_card_legend_legacy.json b/frontend/src/scenes/dashboard/__mocks__/dashboard_insight_card_legend_legacy.json
deleted file mode 100644
index 1ee064e0f70f..000000000000
--- a/frontend/src/scenes/dashboard/__mocks__/dashboard_insight_card_legend_legacy.json
+++ /dev/null
@@ -1,1521 +0,0 @@
-{
- "id": 32,
- "name": "Insight Card Legend",
- "description": "",
- "pinned": false,
- "created_at": "2024-07-18T19:36:25.630503Z",
- "created_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "is_shared": false,
- "deleted": false,
- "creation_mode": "default",
- "filters": {},
- "tiles": [
- {
- "id": 127,
- "insight": {
- "id": 215,
- "short_id": "0DJUR3sn",
- "name": "Line chart",
- "derived_name": "Pageview count & Interacted with file count & Custom name count",
- "filters": {
- "events": [
- {
- "id": "$pageview",
- "math": "total",
- "name": "$pageview",
- "type": "events",
- "order": 0
- },
- {
- "id": "$pageview",
- "math": "total",
- "name": "Pageview",
- "type": "events",
- "order": 2,
- "custom_name": "Custom name"
- }
- ],
- "actions": [
- {
- "id": "1",
- "math": "total",
- "name": "Interacted with file",
- "type": "actions",
- "order": 1
- }
- ],
- "display": "ActionsLineGraph",
- "insight": "TRENDS",
- "interval": "day",
- "entity_type": "events",
- "show_legend": true,
- "filter_test_accounts": true,
- "date_from": null,
- "date_to": null
- },
- "query": null,
- "order": null,
- "deleted": false,
- "dashboards": [32],
- "dashboard_tiles": [
- {
- "id": 127,
- "dashboard_id": 32,
- "deleted": null
- }
- ],
- "last_refresh": "2024-07-18T19:19:34.148020Z",
- "cache_target_age": "2024-07-18T21:19:34.148020Z",
- "next_allowed_client_refresh": "2024-07-18T19:34:34.148020Z",
- "result": [
- {
- "data": [0, 14, 0, 0, 74, 38, 4, 113],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 243.0,
- "label": "$pageview",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraph",
- "showLegend": false,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "$pageview",
- "type": "events",
- "order": 0,
- "name": "$pageview",
- "custom_name": null,
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- },
- {
- "data": [0, 0, 0, 0, 0, 0, 0, 0],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 0.0,
- "label": "Interacted with file",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraph",
- "showLegend": false,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "Interacted with file",
- "type": "events",
- "order": 1,
- "name": "Interacted with file",
- "custom_name": null,
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- },
- {
- "data": [0, 14, 0, 0, 74, 38, 4, 113],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 243.0,
- "label": "$pageview",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraph",
- "showLegend": false,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "$pageview",
- "type": "events",
- "order": 2,
- "name": "$pageview",
- "custom_name": "Custom name",
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- }
- ],
- "columns": null,
- "created_at": "2024-07-18T19:21:54.020144Z",
- "created_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "description": "",
- "updated_at": "2024-07-18T19:37:46.634311Z",
- "favorited": false,
- "saved": true,
- "last_modified_at": "2024-07-18T19:37:46.606900Z",
- "last_modified_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "is_sample": false,
- "timezone": "America/Aruba",
- "is_cached": true,
- "query_status": null,
- "hogql": "SELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date) AS total\nFROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), equals(event, '$pageview'), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000\nUNION ALL\nSELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date) AS total\nFROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))), or(equals(event, 'uploaded_file'), equals(event, 'downloaded_file'), equals(event, 'deleted_file'), equals(event, 'shared_file_link')))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000\nUNION ALL\nSELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date) AS total\nFROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), equals(event, '$pageview'), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000",
- "tags": [],
- "filters_hash": "cache_bae60b6f07f4c80944d20aac84a3496f"
- },
- "text": null,
- "layouts": {},
- "color": null,
- "last_refresh": "2024-07-18T19:19:34.148020Z",
- "is_cached": true
- },
- {
- "id": 126,
- "insight": {
- "id": 216,
- "short_id": "zPsy2pHi",
- "name": "Bar chart",
- "derived_name": "Pageview count & Interacted with file count & Custom name count",
- "filters": {
- "events": [
- {
- "id": "$pageview",
- "math": "total",
- "name": "$pageview",
- "type": "events",
- "order": 0
- },
- {
- "id": "$pageview",
- "math": "total",
- "name": "Pageview",
- "type": "events",
- "order": 2,
- "custom_name": "Custom name"
- }
- ],
- "actions": [
- {
- "id": "1",
- "math": "total",
- "name": "Interacted with file",
- "type": "actions",
- "order": 1
- }
- ],
- "display": "ActionsBar",
- "insight": "TRENDS",
- "interval": "day",
- "entity_type": "events",
- "show_legend": true,
- "filter_test_accounts": true,
- "date_from": null,
- "date_to": null
- },
- "query": null,
- "order": null,
- "deleted": false,
- "dashboards": [32],
- "dashboard_tiles": [
- {
- "id": 126,
- "dashboard_id": 32,
- "deleted": null
- }
- ],
- "last_refresh": "2024-07-18T19:19:34.148020Z",
- "cache_target_age": "2024-07-18T21:19:34.148020Z",
- "next_allowed_client_refresh": "2024-07-18T19:34:34.148020Z",
- "result": [
- {
- "data": [0, 14, 0, 0, 74, 38, 4, 113],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 243.0,
- "label": "$pageview",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraph",
- "showLegend": false,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "$pageview",
- "type": "events",
- "order": 0,
- "name": "$pageview",
- "custom_name": null,
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- },
- {
- "data": [0, 0, 0, 0, 0, 0, 0, 0],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 0.0,
- "label": "Interacted with file",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraph",
- "showLegend": false,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "Interacted with file",
- "type": "events",
- "order": 1,
- "name": "Interacted with file",
- "custom_name": null,
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- },
- {
- "data": [0, 14, 0, 0, 74, 38, 4, 113],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 243.0,
- "label": "$pageview",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraph",
- "showLegend": false,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "$pageview",
- "type": "events",
- "order": 2,
- "name": "$pageview",
- "custom_name": "Custom name",
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- }
- ],
- "columns": null,
- "created_at": "2024-07-18T19:34:03.039486Z",
- "created_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "description": "",
- "updated_at": "2024-07-18T19:37:39.771073Z",
- "favorited": false,
- "saved": true,
- "last_modified_at": "2024-07-18T19:37:39.733284Z",
- "last_modified_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "is_sample": false,
- "timezone": "America/Aruba",
- "is_cached": true,
- "query_status": null,
- "hogql": "SELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date) AS total\nFROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), equals(event, '$pageview'), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000\nUNION ALL\nSELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date) AS total\nFROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))), or(equals(event, 'uploaded_file'), equals(event, 'downloaded_file'), equals(event, 'deleted_file'), equals(event, 'shared_file_link')))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000\nUNION ALL\nSELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date) AS total\nFROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), equals(event, '$pageview'), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000",
- "tags": [],
- "filters_hash": "cache_bae60b6f07f4c80944d20aac84a3496f"
- },
- "text": null,
- "layouts": {},
- "color": null,
- "last_refresh": "2024-07-18T19:19:34.148020Z",
- "is_cached": true
- },
- {
- "id": 125,
- "insight": {
- "id": 217,
- "short_id": "Hpxsmd9D",
- "name": "Area chart",
- "derived_name": "Pageview count & Interacted with file count & Custom name count",
- "filters": {
- "events": [
- {
- "id": "$pageview",
- "math": "total",
- "name": "$pageview",
- "type": "events",
- "order": 0
- },
- {
- "id": "$pageview",
- "math": "total",
- "name": "Pageview",
- "type": "events",
- "order": 2,
- "custom_name": "Custom name"
- }
- ],
- "actions": [
- {
- "id": "1",
- "math": "total",
- "name": "Interacted with file",
- "type": "actions",
- "order": 1
- }
- ],
- "display": "ActionsAreaGraph",
- "insight": "TRENDS",
- "interval": "day",
- "entity_type": "events",
- "show_legend": true,
- "filter_test_accounts": true,
- "date_from": null,
- "date_to": null
- },
- "query": null,
- "order": null,
- "deleted": false,
- "dashboards": [32],
- "dashboard_tiles": [
- {
- "id": 125,
- "dashboard_id": 32,
- "deleted": null
- }
- ],
- "last_refresh": "2024-07-18T19:19:34.148020Z",
- "cache_target_age": "2024-07-18T21:19:34.148020Z",
- "next_allowed_client_refresh": "2024-07-18T19:34:34.148020Z",
- "result": [
- {
- "data": [0, 14, 0, 0, 74, 38, 4, 113],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 243.0,
- "label": "$pageview",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraph",
- "showLegend": false,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "$pageview",
- "type": "events",
- "order": 0,
- "name": "$pageview",
- "custom_name": null,
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- },
- {
- "data": [0, 0, 0, 0, 0, 0, 0, 0],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 0.0,
- "label": "Interacted with file",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraph",
- "showLegend": false,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "Interacted with file",
- "type": "events",
- "order": 1,
- "name": "Interacted with file",
- "custom_name": null,
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- },
- {
- "data": [0, 14, 0, 0, 74, 38, 4, 113],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 243.0,
- "label": "$pageview",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraph",
- "showLegend": false,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "$pageview",
- "type": "events",
- "order": 2,
- "name": "$pageview",
- "custom_name": "Custom name",
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- }
- ],
- "columns": null,
- "created_at": "2024-07-18T19:34:23.909745Z",
- "created_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "description": "",
- "updated_at": "2024-07-18T19:37:33.262208Z",
- "favorited": false,
- "saved": true,
- "last_modified_at": "2024-07-18T19:37:33.227409Z",
- "last_modified_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "is_sample": false,
- "timezone": "America/Aruba",
- "is_cached": true,
- "query_status": null,
- "hogql": "SELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date) AS total\nFROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), equals(event, '$pageview'), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000\nUNION ALL\nSELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date) AS total\nFROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))), or(equals(event, 'uploaded_file'), equals(event, 'downloaded_file'), equals(event, 'deleted_file'), equals(event, 'shared_file_link')))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000\nUNION ALL\nSELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date) AS total\nFROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), equals(event, '$pageview'), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000",
- "tags": [],
- "filters_hash": "cache_bae60b6f07f4c80944d20aac84a3496f"
- },
- "text": null,
- "layouts": {},
- "color": null,
- "last_refresh": "2024-07-18T19:19:34.148020Z",
- "is_cached": true
- },
- {
- "id": 124,
- "insight": {
- "id": 218,
- "short_id": "Wwlgu6T2",
- "name": "Cumulative chart",
- "derived_name": "Pageview count & Interacted with file count & Custom name count",
- "filters": {
- "events": [
- {
- "id": "$pageview",
- "math": "total",
- "name": "$pageview",
- "type": "events",
- "order": 0
- },
- {
- "id": "$pageview",
- "math": "total",
- "name": "Pageview",
- "type": "events",
- "order": 2,
- "custom_name": "Custom name"
- }
- ],
- "actions": [
- {
- "id": "1",
- "math": "total",
- "name": "Interacted with file",
- "type": "actions",
- "order": 1
- }
- ],
- "display": "ActionsLineGraphCumulative",
- "insight": "TRENDS",
- "interval": "day",
- "entity_type": "events",
- "show_legend": true,
- "filter_test_accounts": true,
- "date_from": null,
- "date_to": null
- },
- "query": null,
- "order": null,
- "deleted": false,
- "dashboards": [32],
- "dashboard_tiles": [
- {
- "id": 124,
- "dashboard_id": 32,
- "deleted": null
- }
- ],
- "last_refresh": "2024-07-18T18:45:56.190392Z",
- "cache_target_age": "2024-07-18T20:45:56.190392Z",
- "next_allowed_client_refresh": "2024-07-18T19:00:56.190392Z",
- "result": [
- {
- "data": [0, 14, 14, 14, 88, 126, 130, 194],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 194,
- "label": "$pageview",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraphCumulative",
- "showLegend": true,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "$pageview",
- "type": "events",
- "order": 0,
- "name": "$pageview",
- "custom_name": null,
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- },
- {
- "data": [0, 0, 0, 0, 0, 0, 0, 0],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 0,
- "label": "Interacted with file",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraphCumulative",
- "showLegend": true,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "Interacted with file",
- "type": "events",
- "order": 1,
- "name": "Interacted with file",
- "custom_name": null,
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- },
- {
- "data": [0, 14, 14, 14, 88, 126, 130, 194],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 194,
- "label": "$pageview",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraphCumulative",
- "showLegend": true,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "$pageview",
- "type": "events",
- "order": 2,
- "name": "$pageview",
- "custom_name": "Custom name",
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- }
- ],
- "columns": null,
- "created_at": "2024-07-18T19:34:45.135065Z",
- "created_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "description": "",
- "updated_at": "2024-07-18T19:37:26.401750Z",
- "favorited": false,
- "saved": true,
- "last_modified_at": "2024-07-18T19:37:26.374965Z",
- "last_modified_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "is_sample": false,
- "timezone": "America/Aruba",
- "is_cached": true,
- "query_status": null,
- "hogql": "SELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayFill(x -> greater(x, 0), arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date)) AS total\nFROM\n (SELECT\n day_start,\n sum(count) OVER (ORDER BY day_start ASC) AS count\n FROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), equals(event, '$pageview'), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000\nUNION ALL\nSELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayFill(x -> greater(x, 0), arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date)) AS total\nFROM\n (SELECT\n day_start,\n sum(count) OVER (ORDER BY day_start ASC) AS count\n FROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))), or(equals(event, 'uploaded_file'), equals(event, 'downloaded_file'), equals(event, 'deleted_file'), equals(event, 'shared_file_link')))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000\nUNION ALL\nSELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayFill(x -> greater(x, 0), arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date)) AS total\nFROM\n (SELECT\n day_start,\n sum(count) OVER (ORDER BY day_start ASC) AS count\n FROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), equals(event, '$pageview'), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000",
- "tags": [],
- "filters_hash": "cache_dd6693d85d1a89368c92626a2aef808e"
- },
- "text": null,
- "layouts": {},
- "color": null,
- "last_refresh": "2024-07-18T18:45:56.190392Z",
- "is_cached": true
- },
- {
- "id": 123,
- "insight": {
- "id": 219,
- "short_id": "P3x5xvKY",
- "name": "Pie chart",
- "derived_name": "Pageview count & Interacted with file count & Custom name count",
- "filters": {
- "events": [
- {
- "id": "$pageview",
- "math": "total",
- "name": "$pageview",
- "type": "events",
- "order": 0
- },
- {
- "id": "$pageview",
- "math": "total",
- "name": "Pageview",
- "type": "events",
- "order": 2,
- "custom_name": "Custom name"
- }
- ],
- "actions": [
- {
- "id": "1",
- "math": "total",
- "name": "Interacted with file",
- "type": "actions",
- "order": 1
- }
- ],
- "display": "ActionsPie",
- "insight": "TRENDS",
- "interval": "day",
- "entity_type": "events",
- "show_legend": true,
- "filter_test_accounts": true,
- "date_from": null,
- "date_to": null
- },
- "query": null,
- "order": null,
- "deleted": false,
- "dashboards": [32],
- "dashboard_tiles": [
- {
- "id": 123,
- "dashboard_id": 32,
- "deleted": null
- }
- ],
- "last_refresh": "2024-07-18T18:46:20.409975Z",
- "cache_target_age": "2024-07-18T20:46:20.409975Z",
- "next_allowed_client_refresh": "2024-07-18T19:01:20.409975Z",
- "result": [
- {
- "data": [],
- "days": [],
- "count": 0,
- "aggregated_value": 198,
- "label": "$pageview",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsPie",
- "showLegend": true,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "$pageview",
- "type": "events",
- "order": 0,
- "name": "$pageview",
- "custom_name": null,
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- },
- {
- "data": [],
- "days": [],
- "count": 0,
- "aggregated_value": 0,
- "label": "Interacted with file",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsPie",
- "showLegend": true,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "Interacted with file",
- "type": "events",
- "order": 1,
- "name": "Interacted with file",
- "custom_name": null,
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- },
- {
- "data": [],
- "days": [],
- "count": 0,
- "aggregated_value": 198,
- "label": "$pageview",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsPie",
- "showLegend": true,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "$pageview",
- "type": "events",
- "order": 2,
- "name": "$pageview",
- "custom_name": "Custom name",
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- }
- ],
- "columns": null,
- "created_at": "2024-07-18T19:35:08.932000Z",
- "created_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "description": "",
- "updated_at": "2024-07-18T19:38:38.729348Z",
- "favorited": false,
- "saved": true,
- "last_modified_at": "2024-07-18T19:38:38.729019Z",
- "last_modified_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "is_sample": false,
- "timezone": "America/Aruba",
- "is_cached": true,
- "query_status": null,
- "hogql": "SELECT\n count() AS total\nFROM\n events AS e SAMPLE 1\nWHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), equals(event, '$pageview'), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))))\nORDER BY\n 1 DESC\nLIMIT 50000\nUNION ALL\nSELECT\n count() AS total\nFROM\n events AS e SAMPLE 1\nWHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))), or(equals(event, 'uploaded_file'), equals(event, 'downloaded_file'), equals(event, 'deleted_file'), equals(event, 'shared_file_link')))\nORDER BY\n 1 DESC\nLIMIT 50000\nUNION ALL\nSELECT\n count() AS total\nFROM\n events AS e SAMPLE 1\nWHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), equals(event, '$pageview'), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))))\nORDER BY\n 1 DESC\nLIMIT 50000",
- "tags": [],
- "filters_hash": "cache_d39ee6b334cb054176bcbd9f38b5e5d5"
- },
- "text": null,
- "layouts": {},
- "color": null,
- "last_refresh": "2024-07-18T18:46:20.409975Z",
- "is_cached": true
- },
- {
- "id": 122,
- "insight": {
- "id": 220,
- "short_id": "G46gkRyE",
- "name": "Stickiness chart",
- "derived_name": "User stickiness based on Pageview & user stickiness based on Interacted with file & user stickiness based on Custom name",
- "filters": {
- "events": [
- {
- "id": "$pageview",
- "math": "dau",
- "name": "$pageview",
- "type": "events",
- "order": 0
- },
- {
- "id": "$pageview",
- "math": "dau",
- "name": "Pageview",
- "type": "events",
- "order": 2,
- "custom_name": "Custom name"
- }
- ],
- "actions": [
- {
- "id": "1",
- "math": "dau",
- "name": "Interacted with file",
- "type": "actions",
- "order": 1
- }
- ],
- "display": "ActionsLineGraph",
- "insight": "STICKINESS",
- "interval": "day",
- "entity_type": "events",
- "show_legend": true,
- "filter_test_accounts": true,
- "date_from": null,
- "date_to": null
- },
- "query": null,
- "order": null,
- "deleted": false,
- "dashboards": [32],
- "dashboard_tiles": [
- {
- "id": 122,
- "dashboard_id": 32,
- "deleted": null
- }
- ],
- "last_refresh": "2024-07-18T18:47:48.359688Z",
- "cache_target_age": "2024-07-18T20:47:48.359688Z",
- "next_allowed_client_refresh": "2024-07-18T19:02:48.359688Z",
- "result": [
- {
- "count": 1,
- "data": [0, 0, 0, 0, 1, 0, 0, 0],
- "days": [1, 2, 3, 4, 5, 6, 7, 8],
- "label": "$pageview",
- "labels": ["1 day", "2 days", "3 days", "4 days", "5 days", "6 days", "7 days", "8 days"]
- },
- {
- "count": 0,
- "data": [0, 0, 0, 0, 0, 0, 0, 0],
- "days": [1, 2, 3, 4, 5, 6, 7, 8],
- "label": "Interacted with file",
- "labels": ["1 day", "2 days", "3 days", "4 days", "5 days", "6 days", "7 days", "8 days"]
- },
- {
- "count": 1,
- "data": [0, 0, 0, 0, 1, 0, 0, 0],
- "days": [1, 2, 3, 4, 5, 6, 7, 8],
- "label": "$pageview",
- "labels": ["1 day", "2 days", "3 days", "4 days", "5 days", "6 days", "7 days", "8 days"]
- }
- ],
- "columns": null,
- "created_at": "2024-07-18T19:35:39.029828Z",
- "created_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "description": "",
- "updated_at": "2024-07-18T19:36:25.882154Z",
- "favorited": false,
- "saved": true,
- "last_modified_at": "2024-07-18T19:36:25.808332Z",
- "last_modified_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "is_sample": false,
- "timezone": "America/Aruba",
- "is_cached": true,
- "query_status": null,
- "hogql": null,
- "tags": [],
- "filters_hash": "cache_b3bb0a085129f46b8ad135269a13d28e"
- },
- "text": null,
- "layouts": {},
- "color": null,
- "last_refresh": "2024-07-18T18:47:48.359688Z",
- "is_cached": true
- }
- ],
- "tags": []
-}
diff --git a/frontend/src/scenes/dashboard/__mocks__/dashboard_insight_card_legend_query.json b/frontend/src/scenes/dashboard/__mocks__/dashboard_insight_card_legend_query.json
deleted file mode 100644
index f40cff28d440..000000000000
--- a/frontend/src/scenes/dashboard/__mocks__/dashboard_insight_card_legend_query.json
+++ /dev/null
@@ -1,1509 +0,0 @@
-{
- "id": 31,
- "name": "Insight Card Legend",
- "description": "",
- "pinned": false,
- "created_at": "2024-07-18T18:49:21.463338Z",
- "created_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "is_shared": false,
- "deleted": false,
- "creation_mode": "default",
- "filters": {},
- "tiles": [
- {
- "id": 121,
- "insight": {
- "id": 208,
- "short_id": "7vErWg39",
- "name": "Line chart",
- "derived_name": "Pageview count & Interacted with file count & Custom name count",
- "filters": {},
- "query": {
- "kind": "InsightVizNode",
- "source": {
- "kind": "TrendsQuery",
- "series": [
- {
- "kind": "EventsNode",
- "math": "total",
- "name": "$pageview",
- "event": "$pageview"
- },
- {
- "id": "1",
- "kind": "ActionsNode",
- "math": "total",
- "name": "Interacted with file"
- },
- {
- "kind": "EventsNode",
- "math": "total",
- "name": "Pageview",
- "event": "$pageview",
- "custom_name": "Custom name"
- }
- ],
- "interval": "day",
- "trendsFilter": {
- "display": "ActionsLineGraph",
- "showLegend": true,
- "showValuesOnSeries": false
- },
- "filterTestAccounts": true
- }
- },
- "order": null,
- "deleted": false,
- "dashboards": [31],
- "dashboard_tiles": [
- {
- "id": 121,
- "dashboard_id": 31,
- "deleted": null
- }
- ],
- "last_refresh": "2024-07-18T18:43:15.926455Z",
- "cache_target_age": "2024-07-18T20:43:15.926455Z",
- "next_allowed_client_refresh": "2024-07-18T18:58:15.926455Z",
- "result": [
- {
- "data": [0, 14, 0, 0, 74, 38, 4, 51],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 181.0,
- "label": "$pageview",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraph",
- "showLegend": false,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "$pageview",
- "type": "events",
- "order": 0,
- "name": "$pageview",
- "custom_name": null,
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- },
- {
- "data": [0, 0, 0, 0, 0, 0, 0, 0],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 0.0,
- "label": "Interacted with file",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraph",
- "showLegend": false,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "Interacted with file",
- "type": "events",
- "order": 1,
- "name": "Interacted with file",
- "custom_name": null,
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- },
- {
- "data": [0, 14, 0, 0, 74, 38, 4, 51],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 181.0,
- "label": "$pageview",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraph",
- "showLegend": false,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "$pageview",
- "type": "events",
- "order": 2,
- "name": "$pageview",
- "custom_name": "Custom name",
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- }
- ],
- "columns": null,
- "created_at": "2024-07-18T18:43:34.456156Z",
- "created_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "description": "",
- "updated_at": "2024-07-18T18:50:25.744742Z",
- "favorited": false,
- "saved": true,
- "last_modified_at": "2024-07-18T18:50:25.719205Z",
- "last_modified_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "is_sample": false,
- "timezone": "America/Aruba",
- "is_cached": true,
- "query_status": null,
- "hogql": "SELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date) AS total\nFROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), equals(event, '$pageview'), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000\nUNION ALL\nSELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date) AS total\nFROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))), or(equals(event, 'uploaded_file'), equals(event, 'downloaded_file'), equals(event, 'deleted_file'), equals(event, 'shared_file_link')))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000\nUNION ALL\nSELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date) AS total\nFROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), equals(event, '$pageview'), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000",
- "tags": [],
- "filters_hash": "cache_bae60b6f07f4c80944d20aac84a3496f"
- },
- "text": null,
- "layouts": {},
- "color": null,
- "last_refresh": "2024-07-18T18:43:15.926455Z",
- "is_cached": true
- },
- {
- "id": 120,
- "insight": {
- "id": 209,
- "short_id": "LrODelKB",
- "name": "Bar chart",
- "derived_name": "Pageview count & Interacted with file count & Custom name count",
- "filters": {},
- "query": {
- "kind": "InsightVizNode",
- "source": {
- "kind": "TrendsQuery",
- "series": [
- {
- "kind": "EventsNode",
- "math": "total",
- "name": "$pageview",
- "event": "$pageview"
- },
- {
- "id": "1",
- "kind": "ActionsNode",
- "math": "total",
- "name": "Interacted with file"
- },
- {
- "kind": "EventsNode",
- "math": "total",
- "name": "Pageview",
- "event": "$pageview",
- "custom_name": "Custom name"
- }
- ],
- "interval": "day",
- "trendsFilter": {
- "display": "ActionsBar",
- "showLegend": true,
- "showValuesOnSeries": false
- },
- "filterTestAccounts": true
- }
- },
- "order": null,
- "deleted": false,
- "dashboards": [31],
- "dashboard_tiles": [
- {
- "id": 120,
- "dashboard_id": 31,
- "deleted": null
- }
- ],
- "last_refresh": "2024-07-18T18:43:15.926455Z",
- "cache_target_age": "2024-07-18T20:43:15.926455Z",
- "next_allowed_client_refresh": "2024-07-18T18:58:15.926455Z",
- "result": [
- {
- "data": [0, 14, 0, 0, 74, 38, 4, 51],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 181.0,
- "label": "$pageview",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraph",
- "showLegend": false,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "$pageview",
- "type": "events",
- "order": 0,
- "name": "$pageview",
- "custom_name": null,
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- },
- {
- "data": [0, 0, 0, 0, 0, 0, 0, 0],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 0.0,
- "label": "Interacted with file",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraph",
- "showLegend": false,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "Interacted with file",
- "type": "events",
- "order": 1,
- "name": "Interacted with file",
- "custom_name": null,
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- },
- {
- "data": [0, 14, 0, 0, 74, 38, 4, 51],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 181.0,
- "label": "$pageview",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraph",
- "showLegend": false,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "$pageview",
- "type": "events",
- "order": 2,
- "name": "$pageview",
- "custom_name": "Custom name",
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- }
- ],
- "columns": null,
- "created_at": "2024-07-18T18:43:49.398911Z",
- "created_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "description": "",
- "updated_at": "2024-07-18T18:50:19.792306Z",
- "favorited": false,
- "saved": true,
- "last_modified_at": "2024-07-18T18:50:19.735387Z",
- "last_modified_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "is_sample": false,
- "timezone": "America/Aruba",
- "is_cached": true,
- "query_status": null,
- "hogql": "SELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date) AS total\nFROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), equals(event, '$pageview'), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000\nUNION ALL\nSELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date) AS total\nFROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))), or(equals(event, 'uploaded_file'), equals(event, 'downloaded_file'), equals(event, 'deleted_file'), equals(event, 'shared_file_link')))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000\nUNION ALL\nSELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date) AS total\nFROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), equals(event, '$pageview'), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000",
- "tags": [],
- "filters_hash": "cache_bae60b6f07f4c80944d20aac84a3496f"
- },
- "text": null,
- "layouts": {},
- "color": null,
- "last_refresh": "2024-07-18T18:43:15.926455Z",
- "is_cached": true
- },
- {
- "id": 119,
- "insight": {
- "id": 210,
- "short_id": "NlNzFFpg",
- "name": "Area chart",
- "derived_name": "Pageview count & Interacted with file count & Custom name count",
- "filters": {},
- "query": {
- "kind": "InsightVizNode",
- "source": {
- "kind": "TrendsQuery",
- "series": [
- {
- "kind": "EventsNode",
- "math": "total",
- "name": "$pageview",
- "event": "$pageview"
- },
- {
- "id": "1",
- "kind": "ActionsNode",
- "math": "total",
- "name": "Interacted with file"
- },
- {
- "kind": "EventsNode",
- "math": "total",
- "name": "Pageview",
- "event": "$pageview",
- "custom_name": "Custom name"
- }
- ],
- "interval": "day",
- "trendsFilter": {
- "display": "ActionsAreaGraph",
- "showLegend": true,
- "showValuesOnSeries": false
- },
- "filterTestAccounts": true
- }
- },
- "order": null,
- "deleted": false,
- "dashboards": [31],
- "dashboard_tiles": [
- {
- "id": 119,
- "dashboard_id": 31,
- "deleted": null
- }
- ],
- "last_refresh": "2024-07-18T18:43:15.926455Z",
- "cache_target_age": "2024-07-18T20:43:15.926455Z",
- "next_allowed_client_refresh": "2024-07-18T18:58:15.926455Z",
- "result": [
- {
- "data": [0, 14, 0, 0, 74, 38, 4, 51],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 181.0,
- "label": "$pageview",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraph",
- "showLegend": false,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "$pageview",
- "type": "events",
- "order": 0,
- "name": "$pageview",
- "custom_name": null,
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- },
- {
- "data": [0, 0, 0, 0, 0, 0, 0, 0],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 0.0,
- "label": "Interacted with file",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraph",
- "showLegend": false,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "Interacted with file",
- "type": "events",
- "order": 1,
- "name": "Interacted with file",
- "custom_name": null,
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- },
- {
- "data": [0, 14, 0, 0, 74, 38, 4, 51],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 181.0,
- "label": "$pageview",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraph",
- "showLegend": false,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "$pageview",
- "type": "events",
- "order": 2,
- "name": "$pageview",
- "custom_name": "Custom name",
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- }
- ],
- "columns": null,
- "created_at": "2024-07-18T18:44:17.914188Z",
- "created_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "description": "",
- "updated_at": "2024-07-18T18:50:14.717170Z",
- "favorited": false,
- "saved": true,
- "last_modified_at": "2024-07-18T18:50:14.688589Z",
- "last_modified_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "is_sample": false,
- "timezone": "America/Aruba",
- "is_cached": true,
- "query_status": null,
- "hogql": "SELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date) AS total\nFROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), equals(event, '$pageview'), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000\nUNION ALL\nSELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date) AS total\nFROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))), or(equals(event, 'uploaded_file'), equals(event, 'downloaded_file'), equals(event, 'deleted_file'), equals(event, 'shared_file_link')))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000\nUNION ALL\nSELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date) AS total\nFROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), equals(event, '$pageview'), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000",
- "tags": [],
- "filters_hash": "cache_bae60b6f07f4c80944d20aac84a3496f"
- },
- "text": null,
- "layouts": {},
- "color": null,
- "last_refresh": "2024-07-18T18:43:15.926455Z",
- "is_cached": true
- },
- {
- "id": 118,
- "insight": {
- "id": 211,
- "short_id": "VWy7f5ID",
- "name": "Cumulative chart",
- "derived_name": "Pageview count & Interacted with file count & Custom name count",
- "filters": {},
- "query": {
- "kind": "InsightVizNode",
- "source": {
- "kind": "TrendsQuery",
- "series": [
- {
- "kind": "EventsNode",
- "math": "total",
- "name": "$pageview",
- "event": "$pageview"
- },
- {
- "id": "1",
- "kind": "ActionsNode",
- "math": "total",
- "name": "Interacted with file"
- },
- {
- "kind": "EventsNode",
- "math": "total",
- "name": "Pageview",
- "event": "$pageview",
- "custom_name": "Custom name"
- }
- ],
- "interval": "day",
- "trendsFilter": {
- "display": "ActionsLineGraphCumulative",
- "showLegend": true,
- "showValuesOnSeries": false
- },
- "filterTestAccounts": true
- }
- },
- "order": null,
- "deleted": false,
- "dashboards": [31],
- "dashboard_tiles": [
- {
- "id": 118,
- "dashboard_id": 31,
- "deleted": null
- }
- ],
- "last_refresh": "2024-07-18T18:45:56.190392Z",
- "cache_target_age": "2024-07-18T20:45:56.190392Z",
- "next_allowed_client_refresh": "2024-07-18T19:00:56.190392Z",
- "result": [
- {
- "data": [0, 14, 14, 14, 88, 126, 130, 194],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 194,
- "label": "$pageview",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraphCumulative",
- "showLegend": true,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "$pageview",
- "type": "events",
- "order": 0,
- "name": "$pageview",
- "custom_name": null,
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- },
- {
- "data": [0, 0, 0, 0, 0, 0, 0, 0],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 0,
- "label": "Interacted with file",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraphCumulative",
- "showLegend": true,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "Interacted with file",
- "type": "events",
- "order": 1,
- "name": "Interacted with file",
- "custom_name": null,
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- },
- {
- "data": [0, 14, 14, 14, 88, 126, 130, 194],
- "labels": [
- "11-Jul-2024",
- "12-Jul-2024",
- "13-Jul-2024",
- "14-Jul-2024",
- "15-Jul-2024",
- "16-Jul-2024",
- "17-Jul-2024",
- "18-Jul-2024"
- ],
- "days": [
- "2024-07-11",
- "2024-07-12",
- "2024-07-13",
- "2024-07-14",
- "2024-07-15",
- "2024-07-16",
- "2024-07-17",
- "2024-07-18"
- ],
- "count": 194,
- "label": "$pageview",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsLineGraphCumulative",
- "showLegend": true,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "$pageview",
- "type": "events",
- "order": 2,
- "name": "$pageview",
- "custom_name": "Custom name",
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- }
- ],
- "columns": null,
- "created_at": "2024-07-18T18:45:51.678795Z",
- "created_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "description": "",
- "updated_at": "2024-07-18T18:50:08.838479Z",
- "favorited": false,
- "saved": true,
- "last_modified_at": "2024-07-18T18:50:08.804209Z",
- "last_modified_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "is_sample": false,
- "timezone": "America/Aruba",
- "is_cached": true,
- "query_status": null,
- "hogql": "SELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayFill(x -> greater(x, 0), arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date)) AS total\nFROM\n (SELECT\n day_start,\n sum(count) OVER (ORDER BY day_start ASC) AS count\n FROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), equals(event, '$pageview'), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000\nUNION ALL\nSELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayFill(x -> greater(x, 0), arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date)) AS total\nFROM\n (SELECT\n day_start,\n sum(count) OVER (ORDER BY day_start ASC) AS count\n FROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))), or(equals(event, 'uploaded_file'), equals(event, 'downloaded_file'), equals(event, 'deleted_file'), equals(event, 'shared_file_link')))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000\nUNION ALL\nSELECT\n arrayMap(number -> plus(toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toIntervalDay(number)), range(0, plus(coalesce(dateDiff('day', toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00'))), toStartOfDay(assumeNotNull(toDateTime('2024-07-18 23:59:59'))))), 1))) AS date,\n arrayFill(x -> greater(x, 0), arrayMap(_match_date -> arraySum(arraySlice(groupArray(count), indexOf(groupArray(day_start) AS _days_for_count, _match_date) AS _index, plus(minus(arrayLastIndex(x -> equals(x, _match_date), _days_for_count), _index), 1))), date)) AS total\nFROM\n (SELECT\n day_start,\n sum(count) OVER (ORDER BY day_start ASC) AS count\n FROM\n (SELECT\n sum(total) AS count,\n day_start\n FROM\n (SELECT\n count() AS total,\n toStartOfDay(timestamp) AS day_start\n FROM\n events AS e SAMPLE 1\n WHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), equals(event, '$pageview'), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))))\n GROUP BY\n day_start)\n GROUP BY\n day_start\n ORDER BY\n day_start ASC)\n ORDER BY\n day_start ASC)\nORDER BY\n arraySum(total) DESC\nLIMIT 50000",
- "tags": [],
- "filters_hash": "cache_dd6693d85d1a89368c92626a2aef808e"
- },
- "text": null,
- "layouts": {},
- "color": null,
- "last_refresh": "2024-07-18T18:45:56.190392Z",
- "is_cached": true
- },
- {
- "id": 117,
- "insight": {
- "id": 212,
- "short_id": "nzGwgU7Q",
- "name": "Pie chart",
- "derived_name": "Pageview count & Interacted with file count & Custom name count",
- "filters": {},
- "query": {
- "kind": "InsightVizNode",
- "source": {
- "kind": "TrendsQuery",
- "series": [
- {
- "kind": "EventsNode",
- "math": "total",
- "name": "$pageview",
- "event": "$pageview"
- },
- {
- "id": "1",
- "kind": "ActionsNode",
- "math": "total",
- "name": "Interacted with file"
- },
- {
- "kind": "EventsNode",
- "math": "total",
- "name": "Pageview",
- "event": "$pageview",
- "custom_name": "Custom name"
- }
- ],
- "interval": "day",
- "trendsFilter": {
- "display": "ActionsPie",
- "showLegend": true,
- "showValuesOnSeries": false
- },
- "filterTestAccounts": true
- }
- },
- "order": null,
- "deleted": false,
- "dashboards": [31],
- "dashboard_tiles": [
- {
- "id": 117,
- "dashboard_id": 31,
- "deleted": null
- }
- ],
- "last_refresh": "2024-07-18T18:46:20.409975Z",
- "cache_target_age": "2024-07-18T20:46:20.409975Z",
- "next_allowed_client_refresh": "2024-07-18T19:01:20.409975Z",
- "result": [
- {
- "data": [],
- "days": [],
- "count": 0,
- "aggregated_value": 198,
- "label": "$pageview",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsPie",
- "showLegend": true,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "$pageview",
- "type": "events",
- "order": 0,
- "name": "$pageview",
- "custom_name": null,
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- },
- {
- "data": [],
- "days": [],
- "count": 0,
- "aggregated_value": 0,
- "label": "Interacted with file",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsPie",
- "showLegend": true,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "Interacted with file",
- "type": "events",
- "order": 1,
- "name": "Interacted with file",
- "custom_name": null,
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- },
- {
- "data": [],
- "days": [],
- "count": 0,
- "aggregated_value": 198,
- "label": "$pageview",
- "filter": {
- "insight": "TRENDS",
- "properties": [],
- "filter_test_accounts": true,
- "date_to": "2024-07-18T23:59:59.999999-04:00",
- "date_from": "2024-07-11T00:00:00-04:00",
- "entity_type": "events",
- "interval": "day",
- "aggregationAxisFormat": "numeric",
- "display": "ActionsPie",
- "showLegend": true,
- "showPercentStackView": false,
- "showValuesOnSeries": false,
- "smoothingIntervals": 1
- },
- "action": {
- "days": [
- "2024-07-11T00:00:00-04:00",
- "2024-07-12T00:00:00-04:00",
- "2024-07-13T00:00:00-04:00",
- "2024-07-14T00:00:00-04:00",
- "2024-07-15T00:00:00-04:00",
- "2024-07-16T00:00:00-04:00",
- "2024-07-17T00:00:00-04:00",
- "2024-07-18T00:00:00-04:00"
- ],
- "id": "$pageview",
- "type": "events",
- "order": 2,
- "name": "$pageview",
- "custom_name": "Custom name",
- "math": "total",
- "math_property": null,
- "math_hogql": null,
- "math_group_type_index": null,
- "properties": {}
- }
- }
- ],
- "columns": null,
- "created_at": "2024-07-18T18:46:09.818757Z",
- "created_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "description": "",
- "updated_at": "2024-07-18T18:50:00.486559Z",
- "favorited": false,
- "saved": true,
- "last_modified_at": "2024-07-18T18:50:00.434071Z",
- "last_modified_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "is_sample": false,
- "timezone": "America/Aruba",
- "is_cached": true,
- "query_status": null,
- "hogql": "SELECT\n count() AS total\nFROM\n events AS e SAMPLE 1\nWHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), equals(event, '$pageview'), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))))\nORDER BY\n 1 DESC\nLIMIT 50000\nUNION ALL\nSELECT\n count() AS total\nFROM\n events AS e SAMPLE 1\nWHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))), or(equals(event, 'uploaded_file'), equals(event, 'downloaded_file'), equals(event, 'deleted_file'), equals(event, 'shared_file_link')))\nORDER BY\n 1 DESC\nLIMIT 50000\nUNION ALL\nSELECT\n count() AS total\nFROM\n events AS e SAMPLE 1\nWHERE\n and(greaterOrEquals(timestamp, toStartOfDay(assumeNotNull(toDateTime('2024-07-11 00:00:00')))), lessOrEquals(timestamp, assumeNotNull(toDateTime('2024-07-18 23:59:59'))), equals(event, '$pageview'), in(person_id, (SELECT\n person_id\n FROM\n raw_cohort_people\n WHERE\n and(equals(cohort_id, 2), equals(version, 251)))))\nORDER BY\n 1 DESC\nLIMIT 50000",
- "tags": [],
- "filters_hash": "cache_d39ee6b334cb054176bcbd9f38b5e5d5"
- },
- "text": null,
- "layouts": {},
- "color": null,
- "last_refresh": "2024-07-18T18:46:20.409975Z",
- "is_cached": true
- },
- {
- "id": 115,
- "insight": {
- "id": 214,
- "short_id": "eu9v1ge3",
- "name": "Stickiness chart",
- "derived_name": "User stickiness based on Pageview & user stickiness based on Interacted with file & user stickiness based on Custom name",
- "filters": {},
- "query": {
- "kind": "InsightVizNode",
- "source": {
- "kind": "StickinessQuery",
- "series": [
- {
- "kind": "EventsNode",
- "math": "dau",
- "name": "$pageview",
- "event": "$pageview"
- },
- {
- "id": "1",
- "kind": "ActionsNode",
- "math": "dau",
- "name": "Interacted with file"
- },
- {
- "kind": "EventsNode",
- "math": "dau",
- "name": "Pageview",
- "event": "$pageview",
- "custom_name": "Custom name"
- }
- ],
- "interval": "day",
- "stickinessFilter": {
- "display": "ActionsLineGraph",
- "showLegend": true,
- "showValuesOnSeries": false
- },
- "filterTestAccounts": true
- }
- },
- "order": null,
- "deleted": false,
- "dashboards": [31],
- "dashboard_tiles": [
- {
- "id": 115,
- "dashboard_id": 31,
- "deleted": null
- }
- ],
- "last_refresh": "2024-07-18T18:47:48.359688Z",
- "cache_target_age": "2024-07-18T20:47:48.359688Z",
- "next_allowed_client_refresh": "2024-07-18T19:02:48.359688Z",
- "result": [
- {
- "count": 1,
- "data": [0, 0, 0, 0, 1, 0, 0, 0],
- "days": [1, 2, 3, 4, 5, 6, 7, 8],
- "label": "$pageview",
- "labels": ["1 day", "2 days", "3 days", "4 days", "5 days", "6 days", "7 days", "8 days"]
- },
- {
- "count": 0,
- "data": [0, 0, 0, 0, 0, 0, 0, 0],
- "days": [1, 2, 3, 4, 5, 6, 7, 8],
- "label": "Interacted with file",
- "labels": ["1 day", "2 days", "3 days", "4 days", "5 days", "6 days", "7 days", "8 days"]
- },
- {
- "count": 1,
- "data": [0, 0, 0, 0, 1, 0, 0, 0],
- "days": [1, 2, 3, 4, 5, 6, 7, 8],
- "label": "$pageview",
- "labels": ["1 day", "2 days", "3 days", "4 days", "5 days", "6 days", "7 days", "8 days"]
- }
- ],
- "columns": null,
- "created_at": "2024-07-18T18:47:22.374355Z",
- "created_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "description": "",
- "updated_at": "2024-07-18T18:49:21.665443Z",
- "favorited": false,
- "saved": true,
- "last_modified_at": "2024-07-18T18:49:21.595613Z",
- "last_modified_by": {
- "id": 1,
- "uuid": "018f7216-2154-0000-d286-f7ac40c8c84f",
- "distinct_id": "6yd4X1lQcm4uWP0qdoxl2IJrBU8uxwVd2di0LSIJfg2",
- "first_name": "Employee 427",
- "last_name": "",
- "email": "[email protected]",
- "is_email_verified": null,
- "hedgehog_config": null
- },
- "is_sample": false,
- "timezone": "America/Aruba",
- "is_cached": true,
- "query_status": null,
- "hogql": null,
- "tags": [],
- "filters_hash": "cache_b3bb0a085129f46b8ad135269a13d28e"
- },
- "text": null,
- "layouts": {},
- "color": null,
- "last_refresh": "2024-07-18T18:47:48.359688Z",
- "is_cached": true
- }
- ],
- "tags": []
-}
diff --git a/frontend/src/scenes/dashboard/dashboardLogic.test.ts b/frontend/src/scenes/dashboard/dashboardLogic.test.ts
index 41018621d830..9dd5507750e3 100644
--- a/frontend/src/scenes/dashboard/dashboardLogic.test.ts
+++ b/frontend/src/scenes/dashboard/dashboardLogic.test.ts
@@ -170,6 +170,9 @@ describe('dashboardLogic', () => {
11: {
...dashboardResult(11, [], { date_from: '-24h' }),
},
+ 13: {
+ ...dashboardResult(13, []),
+ },
}
useMocks({
get: {
@@ -184,6 +187,13 @@ describe('dashboardLogic', () => {
'/api/environments/:team_id/dashboards/5/': { ...dashboards[5] },
'/api/environments/:team_id/dashboards/6/': { ...dashboards[6] },
'/api/environments/:team_id/dashboards/7/': () => [500, '💣'],
+ '/api/environments/:team_id/dashboards/13/': () => [404, { detail: 'Not found.' }],
+ '/api/environments/:team_id/dashboards/14/': () => [401, { detail: 'Authentication expired.' }],
+ '/api/environments/:team_id/dashboards/15/': () => [
+ 403,
+ { code: 'permission_denied', detail: 'Access denied.' },
+ ],
+ '/api/environments/:team_id/dashboards/16/': () => [504, { detail: 'Gateway timeout.' }],
'/api/environments/:team_id/dashboards/8/': { ...dashboards[8] },
'/api/environments/:team_id/dashboards/9/': { ...dashboards[9] },
'/api/environments/:team_id/dashboards/10/': { ...dashboards[10] },
@@ -1226,6 +1236,53 @@ describe('dashboardLogic', () => {
dashboardFailedToLoad: true,
})
})
+
+ it.each([
+ { id: 14, accessDenied: false },
+ { id: 15, accessDenied: true },
+ { id: 16, accessDenied: false },
+ ])('classifies dashboard HTTP failures for dashboard $id', async ({ id, accessDenied }) => {
+ logic = dashboardLogic({ id })
+ logic.mount()
+
+ await expectLogic(logic).toFinishAllListeners()
+
+ expect(logic.values.accessDeniedToDashboard).toBe(accessDenied)
+ expect(logic.values.dashboardFailedToLoad).toBe(true)
+ expect(logic.values.error404).toBe(false)
+ })
+
+ it('treats an invalid successful response as a load failure', async () => {
+ jest.spyOn(api, 'getResponse').mockResolvedValueOnce(
+ new Response('<html>Bad gateway</html>', { status: 200 })
+ )
+ logic = dashboardLogic({ id: 17 })
+ logic.mount()
+
+ await expectLogic(logic).toFinishAllListeners()
+
+ expect(logic.values.dashboardFailedToLoad).toBe(true)
+ expect(logic.values.error404).toBe(false)
+ })
+
+ describe('when the dashboard GET returns 404', () => {
+ beforeEach(() => {
+ logic = dashboardLogic({ id: 13 })
+ logic.mount()
+ })
+
+ // The NotFound scene is gated on error404, so the loader must set it once the fetch
+ // settles as a 404 — and must NOT set it before the request has been made.
+ it('sets error404 after a settled 404 and not before', async () => {
+ expect(logic.values.error404).toBe(false)
+
+ await expectLogic(logic).toFinishAllListeners()
+
+ expect(logic.values.dashboard).toBeNull()
+ expect(logic.values.dashboardFailedToLoad).toBe(false)
+ expect(logic.values.error404).toBe(true)
+ })
+ })
})
describe('tile streaming failure classification', () => {
@@ -1264,11 +1321,100 @@ describe('dashboardLogic', () => {
expect(logic.values.error404).toBe(true)
})
+ it('makes a definitive 404 authoritative over an earlier stream failure and stale dashboard', async () => {
+ logic.actions.tileStreamingFailure({ message: 'network dropped mid-connect' })
+ expect(logic.values.dashboardFailedToLoad).toBe(true)
+
+ logic.actions.loadDashboardMetadataSuccess(dashboardResult(5, []))
+ expect(logic.values.dashboard).not.toBeNull()
+
+ logic.actions.setDashboardStreamFailed()
+ logic.actions.tileStreamingFailure({ message: 'gone', status: 404 })
+
+ expect(logic.values.error404).toBe(true)
+ expect(logic.values.dashboardFailedToLoad).toBe(false)
+ expect(logic.values.accessDeniedToDashboard).toBe(false)
+ expect(logic.values.dashboard).toBeNull()
+ })
+
+ it('fails a completed stream without metadata and disposes it on unmount', async () => {
+ await expectLogic(logic).toFinishAllListeners()
+ logic.actions.dashboardNotFound()
+
+ const disposeStream = jest.fn()
+ jest.spyOn(api.dashboards, 'streamTiles').mockImplementation(
+ async (_id, _params, _onMessage, onComplete) => {
+ onComplete()
+ return disposeStream
+ }
+ )
+
+ await expectLogic(logic, () => {
+ logic.actions.loadDashboardStreaming({ action: DashboardLoadAction.InitialLoad })
+ }).toFinishAllListeners()
+
+ expect(logic.values.dashboardFailedToLoad).toBe(true)
+ expect(logic.values.error404).toBe(false)
+
+ logic.unmount()
+ expect(disposeStream).toHaveBeenCalledTimes(1)
+ })
+
+ it('clears NotFound when a streaming retry starts or delivers metadata', async () => {
+ await expectLogic(logic).toFinishAllListeners()
+
+ await expectLogic(logic, () => {
+ logic.actions.tileStreamingFailure({ message: 'gone', status: 404 })
+ }).toFinishAllListeners()
+ expect(logic.values.error404).toBe(true)
+
+ await expectLogic(logic, () => {
+ logic.actions.loadDashboardStreaming({ action: DashboardLoadAction.InitialLoad })
+ }).toFinishAllListeners()
+ expect(logic.values.error404).toBe(false)
+
+ logic.actions.tileStreamingFailure({ message: 'gone', status: 404 })
+ expect(logic.values.error404).toBe(true)
+
+ logic.actions.loadDashboardMetadataSuccess(dashboardResult(5, []))
+ expect(logic.values.error404).toBe(false)
+ })
+
+ it('clears access denied when a streaming retry starts or delivers metadata', async () => {
+ await expectLogic(logic).toFinishAllListeners()
+
+ logic.actions.tileStreamingFailure({
+ message: 'forbidden',
+ status: 403,
+ code: 'permission_denied',
+ })
+ expect(logic.values.accessDeniedToDashboard).toBe(true)
+
+ await expectLogic(logic, () => {
+ logic.actions.loadDashboardStreaming({ action: DashboardLoadAction.InitialLoad })
+ }).toFinishAllListeners()
+ expect(logic.values.accessDeniedToDashboard).toBe(false)
+
+ logic.actions.tileStreamingFailure({
+ message: 'forbidden',
+ status: 403,
+ code: 'permission_denied',
+ })
+ expect(logic.values.accessDeniedToDashboard).toBe(true)
+
+ logic.actions.loadDashboardMetadataSuccess(dashboardResult(5, []))
+ expect(logic.values.accessDeniedToDashboard).toBe(false)
+ })
+
it('routes a 403 status to access denied and other errors to a toast', async () => {
await expectLogic(logic).toFinishAllListeners()
await expectLogic(logic, () => {
- logic.actions.tileStreamingFailure({ message: 'forbidden', status: 403 })
+ logic.actions.tileStreamingFailure({
+ message: 'forbidden',
+ status: 403,
+ code: 'permission_denied',
+ })
}).toFinishAllListeners()
expect(logic.values.accessDeniedToDashboard).toBe(true)
expect(logic.values.error404).toBe(false)
@@ -1277,13 +1423,10 @@ describe('dashboardLogic', () => {
logic.actions.tileStreamingFailure({ message: 'HTTP 500: something broke', status: 500 })
}).toFinishAllListeners()
expect(lemonToastErrorSpy).toHaveBeenCalledWith(expect.stringContaining('something broke'))
+ expect(logic.values.dashboardFailedToLoad).toBe(true)
})
- // The failure that drove the reports: a transient stream error before any metadata arrives leaves
- // dashboard === null. The empty-state gate would then render "Dashboard not found"; instead the
- // load is marked failed so a load-error state shows, and it must NOT be classified as a 404.
it('marks the load failed (not NotFound) when a transient error leaves no dashboard', async () => {
- // Dispatched before the initial load resolves (loaders breakpoint for 200ms), so dashboard is null.
expect(logic.values.dashboard).toBeNull()
await expectLogic(logic, () => {
diff --git a/frontend/src/scenes/dashboard/dashboardLogic.tsx b/frontend/src/scenes/dashboard/dashboardLogic.tsx
index 9868d16ddf66..a465450b7b71 100644
--- a/frontend/src/scenes/dashboard/dashboardLogic.tsx
+++ b/frontend/src/scenes/dashboard/dashboardLogic.tsx
@@ -37,7 +37,7 @@ import {
} from '@posthog/products-dashboards/frontend/widgets/error_tracking/applyWidgetIssueMetadataChange'
import api, { ApiMethodOptions, getJSONOrNull } from 'lib/api'
-import { ApiError } from 'lib/api-error'
+import { ApiError, isAccessDeniedError } from 'lib/api-error'
import { DataColorTheme } from 'lib/colors'
import { OrganizationMembershipLevel } from 'lib/constants'
import { FEATURE_FLAGS } from 'lib/constants'
@@ -1371,12 +1371,16 @@ export const dashboardLogic = kea<dashboardLogicType>([
actions.setInitialLoadResponseBytes(getResponseBytes(dashboardResponse))
+ if (!dashboard || typeof dashboard !== 'object' || typeof dashboard.id !== 'number') {
+ throw new Error('Dashboard response was empty or invalid')
+ }
+
return getQueryBasedDashboard(dashboard)
} catch (error: any) {
if (error.status === 404) {
return null
}
- if (error.status === 403 && error.code === 'permission_denied') {
+ if (isAccessDeniedError(error)) {
actions.setAccessDeniedToDashboard()
}
throw error
@@ -1386,9 +1390,9 @@ export const dashboardLogic = kea<dashboardLogicType>([
actions.loadingDashboardItemsStarted(action)
await breakpoint(200)
actions.resetIntermittentFilters()
+ let metadataReceived = false
- // Start unified streaming - metadata followed by tiles
- api.dashboards.streamTiles(
+ const disposeStream = await api.dashboards.streamTiles(
props.id,
{
layoutSize: values.currentLayoutSize,
@@ -1398,6 +1402,7 @@ export const dashboardLogic = kea<dashboardLogicType>([
// onMessage callback - handles both metadata and tiles
(data) => {
if (data.type === 'metadata') {
+ metadataReceived = true
actions.loadDashboardMetadataSuccess(
getQueryBasedDashboard(data.dashboard as DashboardType<InsightModel>)
)
@@ -1407,7 +1412,13 @@ export const dashboardLogic = kea<dashboardLogicType>([
},
// onComplete callback
() => {
- actions.tileStreamingComplete()
+ if (metadataReceived) {
+ actions.tileStreamingComplete()
+ } else {
+ actions.tileStreamingFailure(
+ new Error('Dashboard stream completed without dashboard metadata.')
+ )
+ }
},
// onError callback
(error) => {
@@ -1415,6 +1426,7 @@ export const dashboardLogic = kea<dashboardLogicType>([
actions.tileStreamingFailure(error)
}
)
+ cache.disposables.add(() => disposeStream, 'dashboardStream', { pauseOnPageHidden: false })
// Return null - metadata will update the dashboard
return null
@@ -1770,16 +1782,24 @@ export const dashboardLogic = kea<dashboardLogicType>([
false,
{
setAccessDeniedToDashboard: () => true,
+ dashboardNotFound: () => false,
+ loadDashboard: () => false,
+ loadDashboardStreaming: () => false,
+ loadDashboardSuccess: () => false,
+ loadDashboardMetadataSuccess: () => false,
},
],
dashboardFailedToLoad: [
false,
{
+ loadDashboard: () => false,
loadDashboardStreaming: () => false,
loadDashboardSuccess: () => false,
// The stream auto-retries after transient errors; delivered metadata means it recovered,
// so clear the load-error state instead of leaving it latched over a loaded dashboard.
loadDashboardMetadataSuccess: () => false,
+ dashboardNotFound: () => false,
+ setAccessDeniedToDashboard: () => false,
loadDashboardFailure: () => true,
setDashboardStreamFailed: () => true,
},
@@ -1837,6 +1857,8 @@ export const dashboardLogic = kea<dashboardLogicType>([
dashboard: [
null as DashboardType<QueryBasedInsightModel> | null,
{
+ dashboardNotFound: () => null,
+ setAccessDeniedToDashboard: () => null,
updateLayouts: (state, { layouts }) => {
const itemLayouts = layoutsByTile(layouts)
@@ -2212,7 +2234,11 @@ export const dashboardLogic = kea<dashboardLogicType>([
false,
{
dashboardNotFound: () => true,
+ setAccessDeniedToDashboard: () => false,
+ loadDashboard: () => false,
+ loadDashboardStreaming: () => false,
loadDashboardSuccess: () => false,
+ loadDashboardMetadataSuccess: () => false,
loadDashboardFailure: () => false,
},
],
@@ -3163,12 +3189,11 @@ export const dashboardLogic = kea<dashboardLogicType>([
})
},
tileStreamingFailure: ({ error }) => {
- // Only a genuine HTTP status from the stream's initial response should flip the scene.
- // Transient network/stream errors carry no status, so a blip no longer masquerades as a
- // missing dashboard — it surfaces as a toast instead of a hard "Dashboard not found".
+ // Only a genuine 404 response means the dashboard is missing. Stream errors can contain
+ // "404" in their message even when the dashboard still exists.
if (error?.status === 404) {
actions.dashboardNotFound()
- } else if (error?.status === 403) {
+ } else if (isAccessDeniedError(error)) {
actions.setAccessDeniedToDashboard()
} else {
// Show error toast for other errors (500s, network issues, etc.)