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): make folder moves reachable and visible on the list (#80648)

posthog[bot]56d025ede6cc
diff --git a/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.test.ts b/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.test.ts
index 7d8540cb4e59..638c247614ef 100644
--- a/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.test.ts
+++ b/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.test.ts
@@ -2,11 +2,15 @@ import { expectLogic } from 'kea-test-utils'
import posthog from 'posthog-js'
import api from 'lib/api'
+import { lemonToast } from 'lib/lemon-ui/LemonToast'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { initKeaTests } from '~/test/init'
-import { projectTreeDataLogic } from './projectTreeDataLogic'
+import { MovedItem, projectTreeDataLogic } from './projectTreeDataLogic'
+
+// pluralize() joins the count to the unit with a non-breaking space, which no reader can see in an assertion.
+const toastText = (message: unknown): string => String(message).replace(/\u00a0/g, ' ')
describe('projectTreeDataLogic', () => {
let logic: ReturnType<typeof projectTreeDataLogic.build>
@@ -112,6 +116,96 @@ describe('projectTreeDataLogic', () => {
eventUsage.unmount()
})
+ it('reports a bulk move once, with an undo that reverts every item', async () => {
+ const success = jest.spyOn(lemonToast, 'success').mockReturnValue('' as any)
+ const move = jest.spyOn(api.fileSystem, 'move').mockResolvedValue({} as any)
+ const items = [
+ { id: 'fs-1', type: 'dashboard', path: 'Marketing/A', ref: '1' },
+ { id: 'fs-2', type: 'dashboard', path: 'Marketing/B', ref: '2' },
+ { id: 'fs-3', type: 'dashboard', path: 'Marketing/C', ref: '3' },
+ ]
+
+ await expectLogic(logic, () => {
+ logic.actions.moveItems(
+ items.map((item) => ({ item: item as any, newPath: `Product/${item.path.slice(-1)}` })),
+ true,
+ 'test'
+ )
+ })
+ // One announcement carrying everything that landed, so a consumer whose work is worth doing once
+ // per operation (a refetch) reads the boundary off the action instead of inferring it from a timer.
+ .toDispatchActions([
+ ({ type, payload }) =>
+ type === logic.actionTypes.movesSettled &&
+ payload.moved.map(({ item }: MovedItem) => item.id).join() === 'fs-1,fs-2,fs-3',
+ ])
+ .toFinishAllListeners()
+
+ expect(move).toHaveBeenCalledTimes(3)
+ // movesSettled rides in the same branch as this toast, so one toast is one announcement.
+ expect(success).toHaveBeenCalledTimes(1)
+ expect(toastText(success.mock.calls[0][0])).toEqual('Moved 3 items')
+
+ // Undo has to carry the whole batch: the per-item toast it replaced could only revert one item.
+ move.mockClear()
+ success.mock.calls[0][1]?.button?.action?.()
+ await expectLogic(logic).toFinishAllListeners()
+ expect(move.mock.calls).toEqual([
+ ['fs-1', 'Marketing/A'],
+ ['fs-2', 'Marketing/B'],
+ ['fs-3', 'Marketing/C'],
+ ])
+ })
+
+ it('reports a partly failed bulk move as what moved plus what did not', async () => {
+ const success = jest.spyOn(lemonToast, 'success').mockReturnValue('' as any)
+ const error = jest.spyOn(lemonToast, 'error').mockReturnValue('' as any)
+ jest.spyOn(api.fileSystem, 'move')
+ .mockResolvedValueOnce({} as any)
+ .mockRejectedValueOnce(new Error('nope'))
+ .mockRejectedValueOnce(new Error('nope'))
+ jest.spyOn(console, 'error').mockReturnValue()
+
+ await expectLogic(logic, () => {
+ logic.actions.moveItems(
+ [
+ { item: { id: 'fs-1', type: 'dashboard', path: 'Marketing/A' } as any, newPath: 'Product/A' },
+ { item: { id: 'fs-2', type: 'dashboard', path: 'Marketing/B' } as any, newPath: 'Product/B' },
+ { item: { id: 'fs-3', type: 'dashboard', path: 'Marketing/C' } as any, newPath: 'Product/C' },
+ ],
+ true,
+ 'test'
+ )
+ }).toFinishAllListeners()
+
+ expect(toastText(success.mock.calls[0][0])).toEqual('Moved 1 item')
+ expect(toastText(error.mock.calls[0][0])).toEqual('Could not move 2 items. Try again.')
+
+ // Undo may only revert what landed. Reverting a failed item would move it away from where it still is.
+ const move = jest.mocked(api.fileSystem.move)
+ move.mockClear().mockResolvedValue({} as any)
+ success.mock.calls[0][1]?.button?.action?.()
+ await expectLogic(logic).toFinishAllListeners()
+ expect(move.mock.calls).toEqual([['fs-1', 'Marketing/A']])
+ })
+
+ it('keeps the underlying error on a single failed move', async () => {
+ const error = jest.spyOn(lemonToast, 'error').mockReturnValue('' as any)
+ jest.spyOn(api.fileSystem, 'move').mockRejectedValue(new Error('nope'))
+ jest.spyOn(console, 'error').mockReturnValue()
+
+ await expectLogic(logic, () => {
+ logic.actions.moveItem(
+ { id: 'fs-1', type: 'dashboard', path: 'Marketing/A' } as any,
+ 'Product/A',
+ true,
+ 'test'
+ )
+ }).toFinishAllListeners()
+
+ expect(error).toHaveBeenCalledWith('Error moving item: Error: nope')
+ })
+
it('deleteSavedItem does not crash when the parent folder is not loaded (lazy store)', () => {
// Folders load lazily; deleting an item whose parent folder was never loaded must not throw on
// state[folder].filter (previously "Cannot read properties of undefined (reading 'filter')").
diff --git a/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.tsx b/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.tsx
index 1c63567eefc3..a27874b21edd 100644
--- a/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.tsx
+++ b/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.tsx
@@ -1,5 +1,6 @@
import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
+import posthog from 'posthog-js'
import { IconDocument, IconFolder, IconPlus } from '@posthog/icons'
import { LemonDialog } from '@posthog/lemon-ui'
@@ -34,7 +35,12 @@ import {
escapePath,
formatUrlAsName,
isGroupViewShortcut,
+ isPathUnder,
joinPath,
+ matchesRefType,
+ parentPath,
+ refTypeParams,
+ reparentPath,
sortFilesAndFolders,
splitPath,
} from '~/layout/panel-layout/ProjectTree/utils'
@@ -60,11 +66,36 @@ const DELETE_ALERT_LIMIT = 0
* Success/Failure reducers).
*/
const SHORTCUTS_LOADER_TIMEOUT_MS = 10000
+/**
+ * Upper bound on a single move request. A batch reports only once every one of its moves has settled, so
+ * without this one stalled request would withhold the toast and the Undo from every item that already
+ * succeeded, and leave the batch in `cache.moveBatches` for the logic's lifetime.
+ */
+const MOVE_TIMEOUT_MS = 30000
export const PAGINATION_LIMIT = 100
const PRODUCTS_SHOWN_WITH_SELECTED_PRODUCTS: Record<string, string[]> = {
'LLM analytics': ['MCP analytics'],
}
+// Reporting a move per item would toast N times for a bulk move, and because react-toastify dedupes
+// identical messages the user would see one toast whose Undo reverts only the item it was built for. Every
+// move therefore goes through `moveItems`, as a batch of one or more, and reports when the batch settles.
+export interface MovedItem {
+ item: FileSystemEntry
+ oldPath: string
+ newPath: string
+}
+
+interface MoveBatch {
+ // Emptying this is what tells the batch every move has settled.
+ pending: Set<string>
+ moved: MovedItem[]
+ failed: { error: unknown }[]
+ projectTreeLogicKey: string
+}
+
+let lastMoveBatchId = 0
+
// Returns `shortcuts` reordered to match `orderedIds`. Any shortcut not referenced in
// `orderedIds` is appended at the end so a partial input never silently drops items.
function applyOrder(shortcuts: FileSystemEntry[], orderedIds: string[]): FileSystemEntry[] {
@@ -374,6 +405,15 @@ export interface projectTreeDataLogicActions {
newPath: string
projectTreeLogicKey: string
}
+ moveItems: (
+ moves: { item: FileSystemEntry; newPath: string }[],
+ force: boolean,
+ projectTreeLogicKey: string
+ ) => {
+ force: boolean
+ moves: { item: FileSystemEntry; newPath: string }[]
+ projectTreeLogicKey: string
+ }
movedItem: (
item: FileSystemEntry,
oldPath: string,
@@ -383,6 +423,9 @@ export interface projectTreeDataLogicActions {
newPath: string
oldPath: string
}
+ movesSettled: (moved: MovedItem[]) => {
+ moved: MovedItem[]
+ }
pruneClosedFolders: (expandedFolders: string[]) => {
expandedFolders: string[]
}
@@ -578,7 +621,20 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
force,
projectTreeLogicKey,
}),
+ // Prefer this over looping `moveItem`, which would report each move separately (see MoveBatch).
+ moveItems: (
+ moves: { item: FileSystemEntry; newPath: string }[],
+ force: boolean,
+ projectTreeLogicKey: string
+ ) => ({
+ moves,
+ force,
+ projectTreeLogicKey,
+ }),
movedItem: (item: FileSystemEntry, oldPath: string, newPath: string) => ({ item, oldPath, newPath }),
+ // Sits beside `movedItem` rather than replacing it: that one re-paths a single row as it lands, this
+ // one is for work worth doing once per operation, such as a refetch.
+ movesSettled: (moved: MovedItem[]) => ({ moved }),
// Emitted after an undo-delete restores items, so consumers (e.g. the dashboards tree) can refetch.
restoredItems: true,
queueAction: (action: ProjectTreeAction, projectTreeLogicKey: string) => ({ action, projectTreeLogicKey }),
@@ -603,7 +659,7 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
pruneClosedFolders: (expandedFolders: string[]) => ({ expandedFolders }),
}),
- loaders(({ actions, values }) => ({
+ loaders(({ actions, values, cache }) => ({
unfiledItems: [
false as boolean,
{
@@ -628,6 +684,48 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
false,
{
queueAction: async ({ action, projectTreeLogicKey }) => {
+ // Undo has to revert every item that landed, so the batch reports only once none are left
+ // in flight.
+ const settleMoveBatch = (settle: (batch: MoveBatch) => void): void => {
+ const batch: MoveBatch | undefined = action.batchId
+ ? cache.moveBatches?.get(action.batchId)
+ : undefined
+ if (!batch || !action.item.id || !batch.pending.delete(action.item.id)) {
+ return
+ }
+ settle(batch)
+ if (batch.pending.size > 0) {
+ return
+ }
+ cache.moveBatches.delete(action.batchId)
+ if (batch.moved.length > 0) {
+ // Every `movedItem` has already patched its row; this marks the operation boundary.
+ actions.movesSettled(batch.moved)
+ lemonToast.success(`Moved ${pluralize(batch.moved.length, 'item')}`, {
+ button: {
+ label: 'Undo',
+ dataAttr: 'undo-project-tree-move',
+ action: () => {
+ actions.moveItems(
+ batch.moved.map(({ item, oldPath, newPath }) => ({
+ item: { ...item, path: newPath },
+ newPath: oldPath,
+ })),
+ false,
+ batch.projectTreeLogicKey
+ )
+ },
+ },
+ })
+ }
+ if (batch.failed.length === 1) {
+ // A lone failure keeps the underlying error, which is the only place a user (or a
+ // support ticket) can see why the move was rejected.
+ lemonToast.error(`Error moving item: ${batch.failed[0].error}`)
+ } else if (batch.failed.length > 1) {
+ lemonToast.error(`Could not move ${pluralize(batch.failed.length, 'item')}. Try again.`)
+ }
+ }
if ((action.type === 'prepare-move' || action.type === 'prepare-link') && action.newPath) {
const verb = action.type === 'prepare-link' ? 'link' : 'move'
const verbing = action.type === 'prepare-link' ? 'linking' : 'moving'
@@ -637,20 +735,31 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
if (response && response.count > MOVE_ALERT_LIMIT) {
const confirmMessage = `You're about to ${verb} ${response.count} items. Are you sure?`
if (!confirm(confirmMessage)) {
+ // Nothing will land for this item, so settling it as neither moved nor
+ // failed keeps the rest of the batch from waiting on it.
+ settleMoveBatch(() => {})
return false
}
}
actions.queueAction({ ...action, type: verb }, projectTreeLogicKey)
} catch (error) {
console.error(`Error ${verbing} item:`, error)
- lemonToast.error(`Error ${verbing} item: ${error}`)
+ if (action.type === 'prepare-link') {
+ lemonToast.error(`Error ${verbing} item: ${error}`)
+ } else {
+ settleMoveBatch((batch) => batch.failed.push({ error }))
+ }
actions.removeQueuedAction(action)
}
} else if (action.type === 'move' && action.newPath) {
try {
const oldPath = action.item.path
const newPath = action.newPath
- await api.fileSystem.move(action.item.id, newPath)
+ await withTimeout(
+ () => api.fileSystem.move(action.item.id, newPath),
+ MOVE_TIMEOUT_MS,
+ `projectTreeDataLogic: moving ${action.item.type} timed out`
+ )
actions.removeQueuedAction(action)
actions.movedItem(action.item, oldPath, newPath)
if (action.item.type === 'dashboard') {
@@ -668,23 +777,21 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
toUnfiled: newPath.startsWith('Unfiled/'),
})
}
- lemonToast.success('Item moved successfully', {
- button: {
- label: 'Undo',
- dataAttr: 'undo-project-tree-move',
- action: () => {
- actions.moveItem(
- { ...action.item, path: newPath },
- oldPath,
- false,
- projectTreeLogicKey
- )
- },
- },
- })
+ settleMoveBatch((batch) => batch.moved.push({ item: action.item, oldPath, newPath }))
} catch (error) {
- console.error('Error moving item:', error)
- lemonToast.error(`Error moving item: ${error}`)
+ // The batch toast can only report a count, so the item and its batch have to reach
+ // error tracking here or a failed bulk move leaves nothing to diagnose from.
+ console.error('Error moving item:', error, {
+ itemId: action.item.id,
+ itemType: action.item.type,
+ batchId: action.batchId,
+ })
+ posthog.captureException(error, {
+ item_id: action.item.id,
+ item_type: action.item.type,
+ move_batch_id: action.batchId,
+ })
+ settleMoveBatch((batch) => batch.failed.push({ error }))
actions.removeQueuedAction(action)
}
} else if (action.type === 'link' && action.newPath) {
@@ -800,9 +907,7 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
}))
)
const foldersToReload = new Set(
- undoableEntries.map((entry) =>
- joinPath(splitPath(entry.path || '').slice(0, -1))
- )
+ undoableEntries.map((entry) => parentPath(entry.path))
)
for (const folder of foldersToReload) {
actions.loadFolder(folder, true)
@@ -945,7 +1050,7 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
},
addLoadedResults: (state, { results }) => appendResultsToFolders(results, state),
createSavedItem: (state, { savedItem }) => {
- const folder = joinPath(splitPath(savedItem.path).slice(0, -1))
+ const folder = parentPath(savedItem.path)
return {
...state,
[folder]: (state[folder] || []).find((f) => f.id === savedItem.id)
@@ -954,7 +1059,7 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
}
},
deleteSavedItem: (state, { savedItem }) => {
- const folder = joinPath(splitPath(savedItem.path).slice(0, -1))
+ const folder = parentPath(savedItem.path)
const newState = { ...state }
// The parent folder may not be loaded into the store yet (folders load lazily); only
// prune it when it's present — otherwise state[folder] is undefined and .filter throws.
@@ -963,7 +1068,7 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
}
if (savedItem.type === 'folder') {
for (const folder of Object.keys(newState)) {
- if (folder === savedItem.path || folder.startsWith(savedItem.path + '/')) {
+ if (isPathUnder(folder, savedItem.path)) {
delete newState[folder]
}
}
@@ -973,17 +1078,9 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
deleteTypeAndRef: (state, { type, ref }) => {
const newState = { ...state }
for (const [folder, files] of Object.entries(newState)) {
- if (
- files.some(
- (file) =>
- (type.endsWith('/') ? file.type?.startsWith(type) : file.type === type) &&
- file.ref === ref
- )
- ) {
+ if (files.some((file) => matchesRefType(file.type, type) && file.ref === ref)) {
newState[folder] = files.filter(
- (file) =>
- (type.endsWith('/') ? !file.type?.startsWith(type) : file.type !== type) ||
- file.ref !== ref
+ (file) => !matchesRefType(file.type, type) || file.ref !== ref
)
}
}
@@ -991,22 +1088,24 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
},
movedItem: (state, { oldPath, newPath, item }) => {
const newState = { ...state }
- const oldParentFolder = joinPath(splitPath(oldPath).slice(0, -1))
+ const oldParentFolder = parentPath(oldPath)
for (const folder of Object.keys(newState)) {
if (folder === oldParentFolder) {
newState[folder] = newState[folder].filter((i) => i.id !== item.id)
- const newParentFolder = joinPath(splitPath(newPath).slice(0, -1))
+ const newParentFolder = parentPath(newPath)
newState[newParentFolder] = [
...(newState[newParentFolder] ?? []),
{ ...item, path: newPath },
]
- } else if (folder === oldPath || folder.startsWith(oldPath + '/')) {
- const newFolder = newPath + folder.slice(oldPath.length)
+ continue
+ }
+ const newFolder = reparentPath(folder, oldPath, newPath)
+ if (newFolder !== null) {
newState[newFolder] = [
...(newState[newFolder] ?? []),
- ...newState[folder].map((item) => ({
- ...item,
- path: newFolder + item.path.slice(folder.length),
+ ...newState[folder].map((entry) => ({
+ ...entry,
+ path: reparentPath(entry.path, folder, newFolder) ?? entry.path,
})),
]
delete newState[folder]
@@ -1320,11 +1419,9 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
if (!projectTreeRef || !projectTreeRef.type || !projectTreeRef.ref) {
return null
}
- const treeItem = projectTreeRef.type.endsWith('/')
- ? sortedItems.find(
- (item) => item.type?.startsWith(projectTreeRef.type) && item.ref === projectTreeRef.ref
- )
- : sortedItems.find((item) => item.type === projectTreeRef.type && item.ref === projectTreeRef.ref)
+ const treeItem = sortedItems.find(
+ (item) => matchesRefType(item.type, projectTreeRef.type) && item.ref === projectTreeRef.ref
+ )
return treeItem ?? null
},
],
@@ -1593,7 +1690,7 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
},
],
}),
- listeners(({ actions, values }) => ({
+ listeners(({ actions, values, cache }) => ({
reorderShortcutByDrag: ({ activeTreeId, overTreeId, position }) => {
const map = values.shortcutEntryIdMap
const activeEntryId = map.get(activeTreeId)
@@ -1662,9 +1759,7 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
}
},
syncTypeAndRef: async ({ type, ref }) => {
- const items = await (type.endsWith('/')
- ? api.fileSystem.list({ type__startswith: type, ref })
- : api.fileSystem.list({ type, ref }))
+ const items = await api.fileSystem.list({ ...refTypeParams(type), ref })
if (items.users?.length > 0) {
actions.addLoadedUsers(items.users)
}
@@ -1691,23 +1786,43 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
projectTreeLogicKey
)
},
- moveItem: async ({ item, newPath, force, projectTreeLogicKey }) => {
- if (newPath === item.path) {
+ moveItem: ({ item, newPath, force, projectTreeLogicKey }) => {
+ actions.moveItems([{ item, newPath }], force, projectTreeLogicKey)
+ },
+ moveItems: ({ moves, force, projectTreeLogicKey }) => {
+ const moving = moves.filter(({ item, newPath }) => {
+ if (newPath === item.path) {
+ return false
+ }
+ if (!item.id) {
+ lemonToast.error("Sorry, can't move an unsaved item (no id)")
+ return false
+ }
+ return true
+ })
+ if (moving.length === 0) {
return
}
- if (!item.id) {
- lemonToast.error("Sorry, can't move an unsaved item (no id)")
- return
+ const batchId = String(++lastMoveBatchId)
+ cache.moveBatches = cache.moveBatches ?? new Map<string, MoveBatch>()
+ cache.moveBatches.set(batchId, {
+ pending: new Set(moving.map(({ item }) => item.id as string)),
+ moved: [],
+ failed: [],
+ projectTreeLogicKey,
+ })
+ for (const { item, newPath } of moving) {
+ actions.queueAction(
+ {
+ type: !force && item.type === 'folder' ? 'prepare-move' : 'move',
+ item,
+ path: item.path,
+ newPath,
+ batchId,
+ },
+ projectTreeLogicKey
+ )
}
- actions.queueAction(
- {
- type: !force && item.type === 'folder' ? 'prepare-move' : 'move',
- item,
- path: item.path,
- newPath: newPath,
- },
- projectTreeLogicKey
- )
},
linkItem: async ({ oldPath, newPath, force, projectTreeLogicKey }) => {
if (newPath === oldPath) {
diff --git a/frontend/src/layout/panel-layout/ProjectTree/projectTreeLogic.tsx b/frontend/src/layout/panel-layout/ProjectTree/projectTreeLogic.tsx
index d47650ee5519..7b16c93e85ba 100644
--- a/frontend/src/layout/panel-layout/ProjectTree/projectTreeLogic.tsx
+++ b/frontend/src/layout/panel-layout/ProjectTree/projectTreeLogic.tsx
@@ -37,7 +37,10 @@ import {
convertFileSystemEntryToTreeDataItem,
findInProjectTree,
formatUrlAsName,
+ calculateMovePath,
joinPath,
+ matchesRefType,
+ refTypeParams,
sortFilesAndFolders,
splitPath,
splitProtocolPath,
@@ -213,6 +216,15 @@ export interface projectTreeLogicActions {
newPath: string
projectTreeLogicKey: string
} // projectTreeDataLogic
+ moveItems: (
+ moves: { item: FileSystemEntry; newPath: string }[],
+ force: boolean,
+ projectTreeLogicKey: string
+ ) => {
+ force: boolean
+ moves: { item: FileSystemEntry; newPath: string }[]
+ projectTreeLogicKey: string
+ } // projectTreeDataLogic
movedItem: (
item: FileSystemEntry,
oldPath: string,
@@ -530,6 +542,7 @@ export const projectTreeLogic = kea<projectTreeLogicType>([
'queueAction',
'deleteItem',
'moveItem',
+ 'moveItems',
'linkItem',
'pruneClosedFolders',
],
@@ -686,11 +699,7 @@ export const projectTreeLogic = kea<projectTreeLogicType>([
deleteTypeAndRef: (state, { type, ref }) => {
return {
...state,
- results: state.results.filter(
- (file) =>
- (type.endsWith('/') ? !file.type?.startsWith(type) : file.type !== type) ||
- file.ref !== ref
- ),
+ results: state.results.filter((file) => !matchesRefType(file.type, type) || file.ref !== ref),
}
},
addLoadedResults: (state, { results }) => {
@@ -736,11 +745,7 @@ export const projectTreeLogic = kea<projectTreeLogicType>([
deleteTypeAndRef: (state, { type, ref }) => {
return {
...state,
- results: state.results.filter(
- (file) =>
- (type.endsWith('/') ? !file.type?.startsWith(type) : file.type !== type) ||
- file.ref !== ref
- ),
+ results: state.results.filter((file) => !matchesRefType(file.type, type) || file.ref !== ref),
}
},
createSavedItem: (state, { savedItem }) => {
@@ -1367,9 +1372,9 @@ export const projectTreeLogic = kea<projectTreeLogicType>([
moveCheckedItems: ({ path }) => {
const { checkedItems } = values
let skipInFolder: string | null = null
- // Count only the moves actually issued — descendants of a moved folder are skipped,
- // so the checked count would overstate how many items moved.
- let movedCount = 0
+ // Descendants of a moved folder are skipped, so the checked count would overstate how many
+ // items actually moved.
+ const moves: { item: FileSystemEntry; newPath: string }[] = []
for (const item of values.sortedItems) {
if (skipInFolder !== null) {
if (item.path.startsWith(skipInFolder + '/')) {
@@ -1380,16 +1385,19 @@ export const projectTreeLogic = kea<projectTreeLogicType>([
}
const itemId = item.type === 'folder' ? `project://${item.path}` : `project/${item.id}`
if (checkedItems[itemId]) {
- actions.moveItem(item, joinPath([...splitPath(path), ...splitPath(item.path).slice(-1)]), true, key)
- movedCount++
+ const { newPath, isValidMove } = calculateMovePath(item, path)
+ if (isValidMove) {
+ moves.push({ item, newPath })
+ }
if (item.type === 'folder') {
skipInFolder = item.path
}
}
}
+ actions.moveItems(moves, true, key)
posthog.capture('project tree items moved', {
root: props.root ?? 'project://',
- count: movedCount,
+ count: moves.length,
is_bulk: true,
})
},
@@ -1563,22 +1571,17 @@ export const projectTreeLogic = kea<projectTreeLogicType>([
return
}
- const treeItem = projectTreeRef.type.endsWith('/')
- ? values.viableItems.find(
- (item) => item.type?.startsWith(projectTreeRef.type) && item.ref === projectTreeRef.ref
- )
- : values.viableItems.find(
- (item) => item.type === projectTreeRef.type && item.ref === projectTreeRef.ref
- )
+ const treeItem = values.viableItems.find(
+ (item) => matchesRefType(item.type, projectTreeRef.type) && item.ref === projectTreeRef.ref
+ )
let path: string | undefined
if (treeItem) {
path = treeItem.path
} else if (projectTreeRef.ref !== null) {
- const resp = await api.fileSystem.list(
- projectTreeRef.type.endsWith('/')
- ? { ref: projectTreeRef.ref, type__startswith: projectTreeRef.type }
- : { ref: projectTreeRef.ref, type: projectTreeRef.type }
- )
+ const resp = await api.fileSystem.list({
+ ref: projectTreeRef.ref,
+ ...refTypeParams(projectTreeRef.type),
+ })
breakpoint() // bail if we opened some other item in the meanwhile
if (resp.users?.length > 0) {
actions.addLoadedUsers(resp.users)
diff --git a/frontend/src/layout/panel-layout/ProjectTree/types.ts b/frontend/src/layout/panel-layout/ProjectTree/types.ts
index 6bb2e58350b0..1489a8cbc41b 100644
--- a/frontend/src/layout/panel-layout/ProjectTree/types.ts
+++ b/frontend/src/layout/panel-layout/ProjectTree/types.ts
@@ -22,6 +22,11 @@ export interface ProjectTreeAction {
item: FileSystemEntry
path: string
newPath?: string
+ /**
+ * Ties a move to the `moveItems` batch that issued it. It rides on the action because a folder move
+ * settles in a second, re-queued action (`prepare-move` becomes `move`) that must still find its batch.
+ */
+ batchId?: string
}
export type FolderState = 'loading' | 'loaded' | 'has-more' | 'error'
diff --git a/frontend/src/layout/panel-layout/ProjectTree/utils.test.ts b/frontend/src/layout/panel-layout/ProjectTree/utils.test.ts
index 73f9cb2ef69c..1949b60e9c49 100644
--- a/frontend/src/layout/panel-layout/ProjectTree/utils.test.ts
+++ b/frontend/src/layout/panel-layout/ProjectTree/utils.test.ts
@@ -1,4 +1,4 @@
-import { escapePath, joinPath, splitPath } from './utils'
+import { escapePath, joinPath, matchesRefType, reparentPath, splitPath } from './utils'
describe('project tree utils', () => {
describe('escapePath', () => {
@@ -38,4 +38,47 @@ describe('project tree utils', () => {
expect(joinPath([])).toEqual('')
})
})
+
+ describe('reparentPath', () => {
+ it('rewrites the moved folder and everything under it', () => {
+ expect(reparentPath('Revenue', 'Revenue', 'Finance/Revenue')).toEqual('Finance/Revenue')
+ expect(reparentPath('Revenue/Q3', 'Revenue', 'Finance/Revenue')).toEqual('Finance/Revenue/Q3')
+ })
+
+ it('leaves a sibling whose name merely starts the same', () => {
+ expect(reparentPath('Revenue archive', 'Revenue', 'Finance/Revenue')).toBeNull()
+ })
+
+ it('leaves paths outside the moved folder', () => {
+ expect(reparentPath('Marketing/Q3', 'Revenue', 'Finance/Revenue')).toBeNull()
+ expect(reparentPath(undefined, 'Revenue', 'Finance')).toBeNull()
+ })
+
+ it('treats an escaped separator as part of a name, not a boundary', () => {
+ // "Revenue\/Q3" is one folder literally named "Revenue/Q3", not Q3 inside Revenue.
+ expect(reparentPath('Revenue\\/Q3', 'Revenue', 'Finance')).toBeNull()
+ })
+
+ it('moves a folder to the project root', () => {
+ expect(reparentPath('Revenue/Q3', 'Revenue', 'Revenue2')).toEqual('Revenue2/Q3')
+ })
+ })
+
+ describe('matchesRefType', () => {
+ it('matches an exact type', () => {
+ expect(matchesRefType('dashboard', 'dashboard')).toBe(true)
+ expect(matchesRefType('insight', 'dashboard')).toBe(false)
+ })
+
+ it('treats a trailing slash as a prefix over internal types', () => {
+ expect(matchesRefType('hog/site_destination', 'hog/')).toBe(true)
+ expect(matchesRefType('hog/transformation', 'hog/')).toBe(true)
+ expect(matchesRefType('dashboard', 'hog/')).toBe(false)
+ })
+
+ it('does not match a row with no type', () => {
+ expect(matchesRefType(undefined, 'hog/')).toBe(false)
+ expect(matchesRefType(undefined, 'dashboard')).toBe(false)
+ })
+ })
})
diff --git a/frontend/src/layout/panel-layout/ProjectTree/utils.tsx b/frontend/src/layout/panel-layout/ProjectTree/utils.tsx
index c2ac5dd3dc39..4710b47bb564 100644
--- a/frontend/src/layout/panel-layout/ProjectTree/utils.tsx
+++ b/frontend/src/layout/panel-layout/ProjectTree/utils.tsx
@@ -263,7 +263,7 @@ export function convertFileSystemEntryToTreeDataItem({
const node = itemToTreeDataItem(item)
if (checkedItems[nodeId]) {
- markIndeterminateFolders(joinPath(splitPath(item.path).slice(0, -1)))
+ markIndeterminateFolders(parentPath(item.path))
}
// Place the item in the current (deepest) folder.
@@ -405,7 +405,7 @@ export function convertFileSystemEntryToTreeDataItem({
* - splitPath("a") => ["a"]
* - splitPath("") => []
*/
-export function splitPath(path: string | undefined): string[] {
+export function splitPath(path: string | null | undefined): string[] {
if (!path) {
return []
}
@@ -427,6 +427,44 @@ export function splitPath(path: string | undefined): string[] {
return segments.filter((s) => s !== '')
}
+/**
+ * Returns null when `path` sat outside the moved folder. Compares segment by segment, so a sibling whose
+ * name merely starts with the moved folder's name is left alone and an escaped separator inside a name is
+ * not mistaken for one.
+ */
+export function reparentPath(path: string | null | undefined, oldPath: string, newPath: string): string | null {
+ if (!isPathUnder(path, oldPath)) {
+ return null
+ }
+ return joinPath([...splitPath(newPath), ...splitPath(path).slice(splitPath(oldPath).length)])
+}
+
+/**
+ * True for `ancestor` itself as well as anything beneath it. Compares whole segments, so a sibling whose
+ * name merely starts the same does not match and an escaped separator is not read as a boundary.
+ */
+export function isPathUnder(path: string | null | undefined, ancestor: string): boolean {
+ const segments = splitPath(path)
+ const under = splitPath(ancestor)
+ return segments.length >= under.length && under.every((segment, index) => segments[index] === segment)
+}
+
+export function parentPath(path: string | null | undefined): string {
+ return joinPath(splitPath(path).slice(0, -1))
+}
+
+/**
+ * Whether a file system row is of `type`. A trailing slash makes `type` a prefix covering several
+ * internal types, e.g. "hog/" matches "hog/site_destination" (see `ProjectTreeRef`).
+ */
+export function matchesRefType(rowType: string | undefined, type: string): boolean {
+ return type.endsWith('/') ? !!rowType?.startsWith(type) : rowType === type
+}
+
+export function refTypeParams(type: string): { type?: string; type__startswith?: string } {
+ return type.endsWith('/') ? { type__startswith: type } : { type }
+}
+
export function joinPath(path: string[]): string {
return path.map(escapePath).join('/')
}
@@ -509,7 +547,7 @@ export function appendResultsToFolders(
}
processedIds.add(result.id)
- const folder = joinPath(splitPath(result.path).slice(0, -1))
+ const folder = parentPath(result.path)
if (newState[folder]) {
const existingItem = newState[folder].find((item) => item.id === result.id)
if (existingItem) {
diff --git a/frontend/src/lib/components/FileSystem/LinkTo/linkToLogic.tsx b/frontend/src/lib/components/FileSystem/LinkTo/linkToLogic.tsx
index b0e63cb7550c..c6fb8c2d4a1d 100644
--- a/frontend/src/lib/components/FileSystem/LinkTo/linkToLogic.tsx
+++ b/frontend/src/lib/components/FileSystem/LinkTo/linkToLogic.tsx
@@ -7,7 +7,7 @@ import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { PROJECT_TREE_KEY } from '~/layout/panel-layout/ProjectTree/ProjectTree'
import { projectTreeDataLogic } from '~/layout/panel-layout/ProjectTree/projectTreeDataLogic'
import { projectTreeLogic } from '~/layout/panel-layout/ProjectTree/projectTreeLogic'
-import { calculateMovePath, joinPath, splitPath } from '~/layout/panel-layout/ProjectTree/utils'
+import { calculateMovePath, parentPath } from '~/layout/panel-layout/ProjectTree/utils'
import { FileSystemEntry } from '~/queries/schema/schema-general'
import type { ProjectTreeRef } from '../../../../types'
@@ -164,7 +164,7 @@ export const linkToLogic = kea<linkToLogicType>([
actions.setFormValue('folder', values.lastNewFolder)
} else {
const itemPath = items[0].path
- const itemFolder = joinPath(splitPath(itemPath).slice(0, -1))
+ const itemFolder = parentPath(itemPath)
actions.setFormValue('folder', itemFolder)
}
},
diff --git a/frontend/src/lib/components/FileSystem/MoveTo/moveToLogic.tsx b/frontend/src/lib/components/FileSystem/MoveTo/moveToLogic.tsx
index f8b3bf788671..bc87b4a17a65 100644
--- a/frontend/src/lib/components/FileSystem/MoveTo/moveToLogic.tsx
+++ b/frontend/src/lib/components/FileSystem/MoveTo/moveToLogic.tsx
@@ -7,7 +7,7 @@ import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { PROJECT_TREE_KEY } from '~/layout/panel-layout/ProjectTree/ProjectTree'
import { projectTreeDataLogic } from '~/layout/panel-layout/ProjectTree/projectTreeDataLogic'
import { projectTreeLogic } from '~/layout/panel-layout/ProjectTree/projectTreeLogic'
-import { calculateMovePath, joinPath, splitPath } from '~/layout/panel-layout/ProjectTree/utils'
+import { calculateMovePath, parentPath } from '~/layout/panel-layout/ProjectTree/utils'
import { FileSystemEntry } from '~/queries/schema/schema-general'
import type { ProjectTreeRef } from '../../../../types'
@@ -49,15 +49,13 @@ export interface moveToLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface moveToLogicActions {
- moveItem: (
- item: FileSystemEntry,
- newPath: string,
+ moveItems: (
+ moves: { item: FileSystemEntry; newPath: string }[],
force: boolean,
projectTreeLogicKey: string
) => {
force: boolean
- item: FileSystemEntry
- newPath: string
+ moves: { item: FileSystemEntry; newPath: string }[]
projectTreeLogicKey: string
} // projectTreeDataLogic
setLastNewFolder: (folder: string | null) => {
@@ -132,7 +130,7 @@ export const moveToLogic = kea<moveToLogicType>([
featureFlagLogic,
['featureFlags'],
],
- actions: [projectTreeDataLogic, ['setLastNewFolder', 'moveItem']],
+ actions: [projectTreeDataLogic, ['setLastNewFolder', 'moveItems']],
})),
actions({
openMoveToModal: (items: FileSystemEntry[]) => ({ items }),
@@ -164,7 +162,7 @@ export const moveToLogic = kea<moveToLogicType>([
actions.setFormValue('folder', values.lastNewFolder)
} else {
const itemPath = items[0].path
- const itemFolder = joinPath(splitPath(itemPath).slice(0, -1))
+ const itemFolder = parentPath(itemPath)
actions.setFormValue('folder', itemFolder)
}
},
@@ -187,13 +185,13 @@ export const moveToLogic = kea<moveToLogicType>([
values.movingItems.some((item) => item.id === values.projectTreeRefEntry?.id)
? values.projectTreeRef
: null
- if (values.movingItems.length > 0) {
- for (const item of values.movingItems) {
- const { newPath, isValidMove } = calculateMovePath(item, formValues.folder || '')
- if (isValidMove) {
- actions.moveItem(item, newPath, false, PROJECT_TREE_KEY)
- }
- }
+ // One batch for the whole selection, so it reports and undoes as a single move.
+ const moves = values.movingItems
+ .map((item) => ({ item, ...calculateMovePath(item, formValues.folder || '') }))
+ .filter(({ isValidMove }) => isValidMove)
+ .map(({ item, newPath }) => ({ item, newPath }))
+ if (moves.length > 0) {
+ actions.moveItems(moves, false, PROJECT_TREE_KEY)
}
// Clear the moving items and close the modal
diff --git a/frontend/src/models/dashboardsModel.test.ts b/frontend/src/models/dashboardsModel.test.ts
index 43a88c5a2afb..fc045614e73a 100644
--- a/frontend/src/models/dashboardsModel.test.ts
+++ b/frontend/src/models/dashboardsModel.test.ts
@@ -186,6 +186,51 @@ describe('the dashboards model', () => {
})
})
+ describe('updating folders after a move', () => {
+ beforeEach(async () => {
+ await expectLogic(logic, () => logic.actions.loadDashboards()).toFinishAllListeners()
+ })
+
+ it('files a dashboard at its new path, and derives the folder from it', async () => {
+ logic.actions.patchDashboardFolders({ 1: 'Revenue/Q3/Growth', 2: 'At the root' })
+ expect(logic.values.rawDashboards[1].file_system_path).toEqual('Revenue/Q3/Growth')
+ expect(logic.values.rawDashboards[1].folder).toEqual('Revenue/Q3')
+ // A dashboard at the project root has no folder above it
+ expect(logic.values.rawDashboards[2].folder).toEqual('')
+ })
+
+ it('ignores ids it does not hold', async () => {
+ const before = logic.values.rawDashboards
+ logic.actions.patchDashboardFolders({ 99999: 'Revenue/Missing' })
+ expect(logic.values.rawDashboards).toBe(before)
+ })
+
+ it('re-parents everything under a moved folder, sparing similarly named siblings', async () => {
+ logic.actions.patchDashboardFolders({
+ 1: 'Revenue/One',
+ 2: 'Revenue/Q3/Two',
+ 3: 'Revenue archive/Three',
+ })
+ logic.actions.reparentDashboardFolders('Revenue', 'Finance/Revenue')
+ expect(logic.values.rawDashboards[1].folder).toEqual('Finance/Revenue')
+ expect(logic.values.rawDashboards[2].folder).toEqual('Finance/Revenue/Q3')
+ // 'Revenue archive' merely starts with the moved folder's name, so it stays put
+ expect(logic.values.rawDashboards[3].folder).toEqual('Revenue archive')
+ })
+
+ it('keeps the path in step with the folder, so a second move starts from the right place', async () => {
+ logic.actions.patchDashboardFolders({ 1: 'Revenue/Growth' })
+ logic.actions.reparentDashboardFolders('Revenue', 'Finance/Revenue')
+ expect(logic.values.rawDashboards[1].file_system_path).toEqual('Finance/Revenue/Growth')
+ })
+
+ it('leaves the map alone when nothing sits under the moved folder', async () => {
+ const before = logic.values.rawDashboards
+ logic.actions.reparentDashboardFolders('Nowhere', 'Elsewhere')
+ expect(logic.values.rawDashboards).toBe(before)
+ })
+ })
+
it('clears primary_dashboard from team when deleting the primary dashboard', async () => {
const primaryDashboardId = 42
initKeaTests(true, { ...MOCK_DEFAULT_TEAM, primary_dashboard: primaryDashboardId })
diff --git a/frontend/src/models/dashboardsModel.tsx b/frontend/src/models/dashboardsModel.tsx
index 3d80b6638125..74bc7d7a48d4 100644
--- a/frontend/src/models/dashboardsModel.tsx
+++ b/frontend/src/models/dashboardsModel.tsx
@@ -14,12 +14,18 @@ import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
import { deleteFromTree, refreshTreeItem } from '~/layout/panel-layout/ProjectTree/projectTreeLogic'
+import { parentPath, reparentPath } from '~/layout/panel-layout/ProjectTree/utils'
import { tagsModel } from '~/models/tagsModel'
import { getQueryBasedDashboard } from '~/queries/nodes/InsightViz/utils'
import { DashboardBasicType, DashboardTile, DashboardType, InsightShortId, QueryBasedInsightModel } from '~/types'
import type { Node } from '../queries/schema/schema-general'
+/** A dashboard's folder is its file system path without the dashboard's own name, so the two move together. */
+function filedAt<T extends DashboardBasicType | DashboardType<QueryBasedInsightModel>>(dashboard: T, path: string): T {
+ return { ...dashboard, file_system_path: path, folder: parentPath(path) }
+}
+
export function mergeTileTextUpdatesIntoDashboard(
dashboard: DashboardType<QueryBasedInsightModel>,
tilesPayload: Partial<DashboardTile>[] | undefined
@@ -185,6 +191,9 @@ export interface dashboardsModelActions {
}
payload?: string
}
+ patchDashboardFolders: (paths: Record<string, string>) => {
+ paths: Record<string, string>
+ }
pinDashboard: (
id: number,
source: DashboardEventSource
@@ -212,6 +221,13 @@ export interface dashboardsModelActions {
source: DashboardEventSource
}
}
+ reparentDashboardFolders: (
+ oldPath: string,
+ newPath: string
+ ) => {
+ newPath: string
+ oldPath: string
+ }
restoreDashboard: ({ id }: any) => any
restoreDashboardFailure: (
error: string,
@@ -344,6 +360,8 @@ export const dashboardsModel = kea<dashboardsModelType>([
// we page through the dashboards and need to manually track when that is finished
dashboardsFullyLoaded: true,
delayedDeleteDashboard: (id: number) => ({ id }),
+ patchDashboardFolders: (paths: Record<string, string>) => ({ paths }),
+ reparentDashboardFolders: (oldPath: string, newPath: string) => ({ oldPath, newPath }),
setDiveSourceId: (id: InsightShortId | null) => ({ id }),
addDashboardSuccess: (dashboard: DashboardType<QueryBasedInsightModel>) => ({ dashboard }),
/**
@@ -594,6 +612,26 @@ export const dashboardsModel = kea<dashboardsModelType>([
...state,
[dashboard.id]: { ...dashboard, _highlight: true },
}),
+ patchDashboardFolders: (state, { paths }) => {
+ const patched = Object.entries(paths).filter(([id]) => state[id])
+ if (patched.length === 0) {
+ return state
+ }
+ return {
+ ...state,
+ ...Object.fromEntries(patched.map(([id, path]) => [id, filedAt(state[id], path)])),
+ }
+ },
+ reparentDashboardFolders: (state, { oldPath, newPath }) => {
+ const moved: typeof state = {}
+ for (const dashboard of Object.values(state)) {
+ const path = reparentPath(dashboard.file_system_path, oldPath, newPath)
+ if (path !== null) {
+ moved[dashboard.id] = filedAt(dashboard, path)
+ }
+ }
+ return Object.keys(moved).length === 0 ? state : { ...state, ...moved }
+ },
},
],
}),
diff --git a/frontend/src/scenes/dashboard/dashboardActivityDescriber.tsx b/frontend/src/scenes/dashboard/dashboardActivityDescriber.tsx
index bb5b45986083..33ca00f5ba8a 100644
--- a/frontend/src/scenes/dashboard/dashboardActivityDescriber.tsx
+++ b/frontend/src/scenes/dashboard/dashboardActivityDescriber.tsx
@@ -149,6 +149,8 @@ const dashboardActionsMapping: Record<
data_color_theme_id: () => null,
last_accessed_at: () => null,
folder: () => null,
+ file_system_id: () => null,
+ file_system_path: () => null,
is_shared: () => null,
creation_mode: () => null,
user_access_level: () => null,
diff --git a/frontend/src/scenes/dashboard/dashboards/DashboardsTable.test.tsx b/frontend/src/scenes/dashboard/dashboards/DashboardsTable.test.tsx
index 43396c4e4b72..1badc3fb9bb3 100644
--- a/frontend/src/scenes/dashboard/dashboards/DashboardsTable.test.tsx
+++ b/frontend/src/scenes/dashboard/dashboards/DashboardsTable.test.tsx
@@ -3,25 +3,34 @@ import '@testing-library/jest-dom'
import { cleanup, fireEvent, render, screen } from '@testing-library/react'
import { useActions, useValues } from 'kea'
+import { AccessControlLevel } from '~/types'
+
import { DashboardsTable } from './DashboardsTable'
jest.mock('kea', () => ({ ...jest.requireActual('kea'), useValues: jest.fn(), useActions: jest.fn() }))
-// BulkUpdateTagsButton pulls its own logic/deps that are irrelevant to the bulk-move button under test.
+// BulkUpdateTagsButton pulls its own logic/deps that are irrelevant to the move affordances under test.
jest.mock('lib/components/BulkActions/BulkUpdateTagsButton', () => ({ BulkUpdateTagsButton: () => null }))
// The filters bar reads tag state from dashboardsLogic that this test doesn't mock; it's not under test.
jest.mock('./DashboardsFiltersBar', () => ({ DashboardsFiltersBar: () => null }))
+// Render the row menu's overlay inline, so the row actions are assertable without driving a popover open.
+jest.mock('lib/lemon-ui/LemonButton/More', () => ({ More: ({ overlay }: any) => <div>{overlay}</div> }))
-// Stub LemonTable to render only the bulk-action bar, driven by a controllable selection context. The
-// per-row column renders never run (no rows), so the test stays focused on the bulk Move affordance.
-let mockCtx: { selectedKeys: number[]; clearSelection: jest.Mock }
+let mockCtx: { selectedKeys: number[]; clearSelection: jest.Mock; setSelectedKeys: jest.Mock }
jest.mock('lib/lemon-ui/LemonTable', () => ({
- LemonTable: ({ bulkSelection }: any) => (bulkSelection ? <div>{bulkSelection.renderActions(mockCtx)}</div> : null),
+ LemonTable: ({ bulkSelection, columns, dataSource }: any) => (
+ <div>
+ {bulkSelection ? bulkSelection.renderActions(mockCtx) : null}
+ {dataSource.map((row: any) => (
+ <div key={row.id}>{columns.at(-1).render(undefined, row)}</div>
+ ))}
+ </div>
+ ),
}))
-describe('DashboardsTable bulk move', () => {
- const openMoveToModal = jest.fn()
- const reportDashboardMoveInitiated = jest.fn()
+describe('DashboardsTable move to folder', () => {
+ const moveDashboardsToFolder = jest.fn()
const clearSelection = jest.fn()
+ const setSelectedKeys = jest.fn()
afterEach(cleanup)
@@ -33,61 +42,61 @@ describe('DashboardsTable bulk move', () => {
tableSortingChanged: jest.fn(),
showDuplicateDashboardModal: jest.fn(),
showDeleteDashboardModal: jest.fn(),
- openMoveToModal,
- reportDashboardMoveInitiated,
+ moveDashboardsToFolder,
})
+ })
+
+ const renderTable = (rows: number[], selectedKeys: number[] = [], filedRows: number[] = rows): void => {
;(useValues as jest.Mock).mockReturnValue({
tableSorting: null,
filters: { search: '' },
currentTeam: { id: 1 },
- itemsByRef: {},
+ filedDashboardIds: new Set(filedRows),
})
- })
-
- // resolvable maps a dashboard id -> whether the tree arm's entry source resolves it (the rest fall through
- // to the empty itemsByRef and are therefore unmovable).
- const renderTable = (selectedKeys: number[], resolvable: Record<number, boolean>): void => {
- mockCtx = { selectedKeys, clearSelection }
+ mockCtx = { selectedKeys, clearSelection, setSelectedKeys }
render(
<DashboardsTable
- dashboards={[] as any}
- dashboardsLoading={false}
- dashboardFsEntry={(id) =>
- resolvable[id]
- ? ({ id: `fs-${id}`, type: 'dashboard', ref: String(id), path: 'Marketing' } as any)
- : undefined
+ dashboards={
+ rows.map((id) => ({
+ id,
+ name: `Dashboard ${id}`,
+ user_access_level: AccessControlLevel.Editor,
+ })) as any
}
+ dashboardsLoading={false}
/>
)
}
- it('does not move anything when no selected dashboard resolves to an entry', () => {
- renderTable([1, 2], {})
- // The button still renders (labelled plainly), but the disabled state means a click is a no-op.
- fireEvent.click(screen.getByText('Move to folder').closest('button')!)
- expect(openMoveToModal).not.toHaveBeenCalled()
- expect(reportDashboardMoveInitiated).not.toHaveBeenCalled()
+ it('offers the per-row move action and moves that dashboard', () => {
+ renderTable([1])
+ fireEvent.click(screen.getByText('Move to another folder'))
+ expect(moveDashboardsToFolder).toHaveBeenCalledWith([1], 'single')
})
- it('reflects the resolvable count in the label when only some selected dashboards can be moved', () => {
- renderTable([1, 2, 3], { 1: true })
- expect(screen.getByText('Move 1 to folder')).toBeInTheDocument()
+ it('offers the bulk move action and moves the whole selection', () => {
+ renderTable([1, 2], [1, 2])
+ fireEvent.click(screen.getByText('Move to folder'))
+ expect(moveDashboardsToFolder).toHaveBeenCalledWith([1, 2], 'bulk', setSelectedKeys)
+ // Clicking hands the deselect callback over without calling it; when it does get called is
+ // dashboardsLogic's business, and its tests cover that.
+ expect(setSelectedKeys).not.toHaveBeenCalled()
})
- it('moves every resolvable entry and reports the bulk event on click', () => {
- renderTable([1, 2], { 1: true, 2: true })
- fireEvent.click(screen.getByText('Move to folder').closest('button')!)
- expect(reportDashboardMoveInitiated).toHaveBeenCalledWith('bulk', 2)
- expect(openMoveToModal).toHaveBeenCalledTimes(1)
- expect(openMoveToModal.mock.calls[0][0]).toHaveLength(2)
- expect(clearSelection).toHaveBeenCalled()
+ it('says why a dashboard with no file system entry cannot be moved', () => {
+ renderTable([1], [], [])
+ fireEvent.click(screen.getByText('Move to another folder'))
+ expect(moveDashboardsToFolder).not.toHaveBeenCalled()
+ })
+
+ it('says how many of the selection will be left behind', () => {
+ renderTable([1, 2, 3], [1, 2, 3], [1])
+ expect(screen.getByText('Move 1 to folder')).toBeInTheDocument()
})
- it('does not render the bulk move button in the control arm (no entry source)', () => {
- // Control passes no dashboardFsEntry, so the bulk "Move to folder" button must not appear — its
- // entry source is the mostly-empty sidebar store and it would render perpetually disabled.
- mockCtx = { selectedKeys: [1, 2], clearSelection }
- render(<DashboardsTable dashboards={[] as any} dashboardsLoading={false} />)
- expect(screen.queryByText('Move to folder')).not.toBeInTheDocument()
+ it('disables the bulk move when nothing selected is filed anywhere', () => {
+ renderTable([1, 2], [1, 2], [])
+ fireEvent.click(screen.getByText('Move to folder'))
+ expect(moveDashboardsToFolder).not.toHaveBeenCalled()
})
})
diff --git a/frontend/src/scenes/dashboard/dashboards/DashboardsTable.tsx b/frontend/src/scenes/dashboard/dashboards/DashboardsTable.tsx
index d30c1a38b257..a336c5749cc9 100644
--- a/frontend/src/scenes/dashboard/dashboards/DashboardsTable.tsx
+++ b/frontend/src/scenes/dashboard/dashboards/DashboardsTable.tsx
@@ -4,7 +4,6 @@ import { IconFolder, IconHome, IconLock, IconPin, IconPinFilled, IconShare } fro
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { BulkUpdateTagsButton } from 'lib/components/BulkActions/BulkUpdateTagsButton'
-import { moveToLogic } from 'lib/components/FileSystem/MoveTo/moveToLogic'
import { ObjectTags } from 'lib/components/ObjectTags/ObjectTags'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { More } from 'lib/lemon-ui/LemonButton/More'
@@ -16,7 +15,7 @@ import { LemonTableLink } from 'lib/lemon-ui/LemonTable/LemonTableLink'
import { Link } from 'lib/lemon-ui/Link'
import { Tooltip } from 'lib/lemon-ui/Tooltip'
import { accessLevelSatisfied } from 'lib/utils/accessControlUtils'
-import { DashboardEventSource, eventUsageLogic } from 'lib/utils/eventUsageLogic'
+import { DashboardEventSource } from 'lib/utils/eventUsageLogic'
import { dashboardLogic } from 'scenes/dashboard/dashboardLogic'
import { dashboardsLogic } from 'scenes/dashboard/dashboards/dashboardsLogic'
import { deleteDashboardLogic } from 'scenes/dashboard/deleteDashboardLogic'
@@ -24,9 +23,7 @@ import { duplicateDashboardLogic } from 'scenes/dashboard/duplicateDashboardLogi
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
-import { projectTreeDataLogic } from '~/layout/panel-layout/ProjectTree/projectTreeDataLogic'
import { dashboardsModel, nameCompareFunction } from '~/models/dashboardsModel'
-import { FileSystemEntry } from '~/queries/schema/schema-general'
import {
AccessControlLevel,
AccessControlResourceType,
@@ -39,6 +36,35 @@ import { UNFILED_DASHBOARDS_FOLDER } from '../dashboardConstants'
import { DASHBOARD_CANNOT_EDIT_MESSAGE } from '../DashboardHeader'
import { DashboardsFiltersBar } from './DashboardsFiltersBar'
+function BulkMoveToFolderButton({
+ ctx,
+ filedIds,
+ onMove,
+}: {
+ ctx: { selectedKeys: ReadonlyArray<number>; setSelectedKeys: (keys: ReadonlyArray<number>) => void }
+ filedIds: Set<number>
+ onMove: (ids: number[], method: 'single' | 'bulk', onStillSelected?: (ids: number[]) => void) => void
+}): JSX.Element {
+ const movable = ctx.selectedKeys.filter((key) => filedIds.has(key))
+ const skipped = ctx.selectedKeys.length - movable.length
+ return (
+ <LemonButton
+ size="small"
+ type="secondary"
+ onClick={() => onMove([...ctx.selectedKeys], 'bulk', ctx.setSelectedKeys)}
+ disabledReason={movable.length === 0 ? 'None of the selected dashboards are filed anywhere yet' : undefined}
+ tooltip={
+ skipped > 0 && movable.length > 0
+ ? `${skipped} of the ${ctx.selectedKeys.length} selected are not filed anywhere yet, so they stay put`
+ : undefined
+ }
+ data-attr="dashboards-bulk-move-to-folder"
+ >
+ {skipped > 0 && movable.length > 0 ? `Move ${movable.length} to folder` : 'Move to folder'}
+ </LemonButton>
+ )
+}
+
export function DashboardsTableContainer(): JSX.Element {
const { dashboardsLoading } = useValues(dashboardsModel)
const { dashboards } = useValues(dashboardsLogic)
@@ -51,10 +77,6 @@ interface DashboardsTableProps {
dashboardsLoading: boolean
extraActions?: JSX.Element | JSX.Element[]
hideActions?: boolean
- // Tree arm: resolves a dashboard's FileSystem entry for "Move to another folder". The sidebar-backed
- // itemsByRef only holds lazily-loaded folders, so it's missing for most dashboards (the Move action then
- // never appears). The tree arm passes its complete entryByRef so every dashboard is movable.
- dashboardFsEntry?: (id: number) => FileSystemEntry | undefined
}
export function DashboardsTable({
@@ -62,11 +84,10 @@ export function DashboardsTable({
dashboardsLoading,
extraActions,
hideActions,
- dashboardFsEntry,
}: DashboardsTableProps): JSX.Element {
const { unpinDashboard, pinDashboard } = useActions(dashboardsModel)
- const { tableSortingChanged, setFilters } = useActions(dashboardsLogic)
- const { tableSorting, filters } = useValues(dashboardsLogic)
+ const { tableSortingChanged, setFilters, moveDashboardsToFolder } = useActions(dashboardsLogic)
+ const { tableSorting, filters, filedDashboardIds } = useValues(dashboardsLogic)
// Server-side fuzzy search ranks results by relevance; re-sorting alphabetically by name
// would push the exact match below partial matches. Suppress the persisted column sort
// while the user has an active search term.
@@ -74,19 +95,6 @@ export function DashboardsTable({
const { currentTeam } = useValues(teamLogic)
const { showDuplicateDashboardModal } = useActions(duplicateDashboardLogic)
const { showDeleteDashboardModal } = useActions(deleteDashboardLogic)
- const { openMoveToModal } = useActions(moveToLogic)
- const { reportDashboardMoveInitiated } = useActions(eventUsageLogic)
- const { itemsByRef } = useValues(projectTreeDataLogic)
-
- // Prefer the tree arm's complete entryByRef over the sidebar's lazily-loaded itemsByRef, so every
- // dashboard is movable even before the sidebar has populated.
- const fsEntryFor = (id: number): FileSystemEntry | undefined =>
- dashboardFsEntry?.(id) ?? itemsByRef[`dashboard::${id}`]
-
- // The tree arm is the only caller that supplies a complete entry source. Control falls back to the
- // sidebar's lazily-loaded itemsByRef, which is mostly empty here — so the bulk "Move to folder" button
- // would render perpetually disabled. Gate it on the tree arm so control's bulk bar is unchanged.
- const isTreeArm = !!dashboardFsEntry
const columns: LemonTableColumns<DashboardType> = [
{
@@ -212,7 +220,6 @@ export function DashboardsTable({
width: 48,
render: function RenderActions(_, dashboard: DashboardType) {
const { id, name, user_access_level } = dashboard
- const moveEntry = fsEntryFor(id)
return (
<More
overlay={
@@ -260,24 +267,24 @@ export function DashboardsTable({
Duplicate
</LemonButton>
- {moveEntry && (
- <AccessControlAction
- resourceType={AccessControlResourceType.Dashboard}
- minAccessLevel={AccessControlLevel.Editor}
- userAccessLevel={user_access_level}
+ <AccessControlAction
+ resourceType={AccessControlResourceType.Dashboard}
+ minAccessLevel={AccessControlLevel.Editor}
+ userAccessLevel={user_access_level}
+ >
+ <LemonButton
+ onClick={() => moveDashboardsToFolder([id], 'single')}
+ disabledReason={
+ filedDashboardIds.has(id)
+ ? undefined
+ : 'This dashboard is not filed anywhere yet'
+ }
+ fullWidth
+ data-attr="dashboard-move-to-folder"
>
- <LemonButton
- onClick={() => {
- reportDashboardMoveInitiated('single', 1)
- openMoveToModal([moveEntry as any])
- }}
- fullWidth
- data-attr="dashboard-move-to-folder"
- >
- Move to another folder
- </LemonButton>
- </AccessControlAction>
- )}
+ Move to another folder
+ </LemonButton>
+ </AccessControlAction>
<LemonDivider />
@@ -345,54 +352,23 @@ export function DashboardsTable({
: { disabledReason: DASHBOARD_CANNOT_EDIT_MESSAGE },
rowAriaLabel: (dashboard: DashboardType) => `Select dashboard ${dashboard.name}`,
headerAriaLabel: 'Select all dashboards on this page',
- renderActions: (ctx) => {
- // Move the whole selection at once, resolving each id's entry the same way the per-row
- // Move does. Some rows may not resolve (e.g. unfiled dashboards the sidebar hasn't
- // loaded) — surface that count rather than silently dropping them from the move.
- // Tree arm only: in control the entry source is mostly empty, so the button would be
- // perpetually disabled — leave control's bulk bar exactly as it was.
- const moveEntries = isTreeArm
- ? ctx.selectedKeys.map(fsEntryFor).filter((entry): entry is FileSystemEntry => !!entry)
- : []
- const unmovable = ctx.selectedKeys.length - moveEntries.length
- const partial = unmovable > 0 && moveEntries.length > 0
- return (
- <>
- {isTreeArm && (
- <LemonButton
- size="small"
- type="secondary"
- onClick={() => {
- reportDashboardMoveInitiated('bulk', moveEntries.length)
- openMoveToModal(moveEntries)
- ctx.clearSelection()
- }}
- disabledReason={
- moveEntries.length === 0
- ? 'None of the selected dashboards can be moved to a folder'
- : undefined
- }
- tooltip={
- partial
- ? `Only ${moveEntries.length} of ${ctx.selectedKeys.length} selected can be moved to a folder`
- : undefined
- }
- data-attr="dashboards-bulk-move-to-folder"
- >
- {partial ? `Move ${moveEntries.length} to folder` : 'Move to folder'}
- </LemonButton>
- )}
- <BulkUpdateTagsButton
- resource="dashboards"
- selectedIds={ctx.selectedKeys}
- onSuccess={() => {
- ctx.clearSelection()
- dashboardsModel.actions.loadDashboards()
- }}
- />
- </>
- )
- },
+ renderActions: (ctx) => (
+ <>
+ <BulkMoveToFolderButton
+ ctx={ctx}
+ filedIds={filedDashboardIds}
+ onMove={moveDashboardsToFolder}
+ />
+ <BulkUpdateTagsButton
+ resource="dashboards"
+ selectedIds={ctx.selectedKeys}
+ onSuccess={() => {
+ ctx.clearSelection()
+ dashboardsModel.actions.loadDashboards()
+ }}
+ />
+ </>
+ ),
}}
/>
</>
diff --git a/frontend/src/scenes/dashboard/dashboards/dashboardsLogic.test.ts b/frontend/src/scenes/dashboard/dashboards/dashboardsLogic.test.ts
index 87a465d4b0f6..8f749c189109 100644
--- a/frontend/src/scenes/dashboard/dashboards/dashboardsLogic.test.ts
+++ b/frontend/src/scenes/dashboard/dashboards/dashboardsLogic.test.ts
@@ -3,12 +3,14 @@ import { MOCK_DEFAULT_USER } from 'lib/api.mock'
import { router } from 'kea-router'
import { expectLogic, truth } from 'kea-test-utils'
+import { moveToLogic } from 'lib/components/FileSystem/MoveTo/moveToLogic'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { DashboardsFilters, DashboardsTab, dashboardsLogic } from 'scenes/dashboard/dashboards/dashboardsLogic'
import { sceneLogic } from 'scenes/sceneLogic'
import { Scene } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
+import { projectTreeDataLogic } from '~/layout/panel-layout/ProjectTree/projectTreeDataLogic'
import { useMocks } from '~/mocks/jest'
import { dashboardsModel } from '~/models/dashboardsModel'
import { initKeaTests } from '~/test/init'
@@ -47,12 +49,21 @@ describe('dashboardsLogic', () => {
pinned: true,
}),
},
- { ...dashboard({ created_by: CURRENT_USER, folder: 'Marketing/Website' }) },
+ {
+ ...dashboard({
+ created_by: CURRENT_USER,
+ folder: 'Marketing/Website',
+ file_system_id: 'fs-filed',
+ file_system_path: 'Marketing/Website/Filed',
+ }),
+ },
{
...dashboard({
created_by: OTHER_USER,
name: 'needle',
folder: 'Marketing/Website',
+ file_system_id: 'fs-needle',
+ file_system_path: 'Marketing/Website/needle',
}),
},
{
@@ -64,6 +75,7 @@ describe('dashboardsLogic', () => {
]
beforeEach(async () => {
+ jest.clearAllMocks()
window.POSTHOG_APP_CONTEXT = { current_user: MOCK_DEFAULT_USER } as unknown as AppContext
useMocks({
@@ -87,6 +99,68 @@ describe('dashboardsLogic', () => {
logic.mount()
})
+ describe('reflecting a completed move', () => {
+ it('updates the moved dashboard to its new folder', async () => {
+ await expectLogic(logic, () => {
+ projectTreeDataLogic.actions.movedItem(
+ { id: 'fs-1', type: 'dashboard', ref: String(dashboardId), path: 'Marketing/A' } as any,
+ 'Marketing/A',
+ 'Revenue/Q3/A'
+ )
+ }).toDispatchActions([
+ dashboardsModel.actionCreators.patchDashboardFolders({ [dashboardId]: 'Revenue/Q3/A' }),
+ ])
+ })
+
+ it('moves a dashboard to the project root', async () => {
+ await expectLogic(logic, () => {
+ projectTreeDataLogic.actions.movedItem(
+ { id: 'fs-1', type: 'dashboard', ref: String(dashboardId), path: 'Marketing/A' } as any,
+ 'Marketing/A',
+ 'A'
+ )
+ }).toDispatchActions([dashboardsModel.actionCreators.patchDashboardFolders({ [dashboardId]: 'A' })])
+ })
+
+ it('hands a moved folder to the model to re-parent', async () => {
+ await expectLogic(logic, () => {
+ projectTreeDataLogic.actions.movedItem(
+ { id: 'fs-3', type: 'folder', path: 'Marketing' } as any,
+ 'Marketing',
+ 'Revenue/Marketing'
+ )
+ }).toDispatchActions([
+ dashboardsModel.actionCreators.reparentDashboardFolders('Marketing', 'Revenue/Marketing'),
+ ])
+ })
+
+ it('ignores a moved shortcut, which only points at the dashboard', async () => {
+ const before = dashboardsModel.values.rawDashboards
+ projectTreeDataLogic.actions.movedItem(
+ {
+ id: 'fs-4',
+ type: 'dashboard',
+ ref: String(dashboardId),
+ path: 'Marketing/A',
+ shortcut: true,
+ } as any,
+ 'Marketing/A',
+ 'Revenue/A'
+ )
+ expect(dashboardsModel.values.rawDashboards).toBe(before)
+ })
+
+ it('ignores moves of other item types', async () => {
+ const before = dashboardsModel.values.rawDashboards
+ projectTreeDataLogic.actions.movedItem(
+ { id: 'fs-2', type: 'insight', ref: String(dashboardId), path: 'Marketing/An insight' } as any,
+ 'Marketing/An insight',
+ 'Revenue/An insight'
+ )
+ expect(dashboardsModel.values.rawDashboards).toBe(before)
+ })
+ })
+
it('shows all dashboards when no filters', async () => {
expect(logic.values.dashboards).toHaveLength(allDashboards.length)
})
@@ -412,6 +486,85 @@ describe('dashboardsLogic', () => {
expect(lastRequestUrl!.searchParams.getAll('tags')).toEqual(['finance'])
})
+ it('opens the move modal with the entry the list already carries', async () => {
+ moveToLogic.mount()
+ const filed = logic.values.dashboards.find((d) => d.file_system_id)!
+
+ logic.actions.moveDashboardsToFolder([filed.id], 'single')
+
+ expect(moveToLogic.values.movingItems).toEqual([
+ expect.objectContaining({ id: filed.file_system_id, path: filed.file_system_path }),
+ ])
+ expect(moveToLogic.values.isOpen).toBe(true)
+ })
+
+ it('moves a dashboard the search returned that the model never loaded', async () => {
+ moveToLogic.mount()
+ const filed = logic.values.dashboards.find((d) => d.file_system_id)!
+ // A dashboard created after this page loaded is reachable through search but absent from the model
+ delete (dashboardsModel.values.rawDashboards as Record<string, unknown>)[filed.id]
+
+ logic.actions.moveDashboardsToFolder([filed.id], 'single')
+
+ expect(moveToLogic.values.isOpen).toBe(true)
+ })
+
+ it('carries the href the project tree needs to keep the moved row clickable', async () => {
+ moveToLogic.mount()
+ const filed = logic.values.dashboards.find((d) => d.file_system_id)!
+
+ logic.actions.moveDashboardsToFolder([filed.id], 'single')
+
+ expect(moveToLogic.values.movingItems[0]).toEqual(expect.objectContaining({ href: urls.dashboard(filed.id) }))
+ })
+
+ it('does nothing for a dashboard that is not filed anywhere', async () => {
+ moveToLogic.mount()
+ const unfiled = logic.values.dashboards.find((d) => !d.file_system_id)!
+
+ logic.actions.moveDashboardsToFolder([unfiled.id], 'single')
+
+ expect(moveToLogic.values.isOpen).toBe(false)
+ })
+
+ it('deselects a dashboard only once its move lands, leaving the rest ticked', async () => {
+ moveToLogic.mount()
+ const [first, second] = logic.values.dashboards.filter((d) => d.file_system_id)
+ const onStillSelected = jest.fn()
+
+ logic.actions.moveDashboardsToFolder([first.id, second.id], 'bulk', onStillSelected)
+
+ // The modal is open; nothing has moved yet, so nothing is deselected.
+ expect(onStillSelected).not.toHaveBeenCalled()
+
+ projectTreeDataLogic.actions.movedItem(
+ { id: first.file_system_id, type: 'dashboard', ref: String(first.id), path: first.file_system_path } as any,
+ first.file_system_path!,
+ 'Revenue/Filed'
+ )
+
+ expect(onStillSelected).toHaveBeenCalledWith([second.id])
+ })
+
+ it('stops tracking a move once the modal is dismissed', async () => {
+ moveToLogic.mount()
+ const [first, second] = logic.values.dashboards.filter((d) => d.file_system_id)
+ const onStillSelected = jest.fn()
+
+ logic.actions.moveDashboardsToFolder([first.id, second.id], 'bulk', onStillSelected)
+ moveToLogic.actions.closeMoveToModal()
+
+ // movedItem fires for moves made anywhere in the project tree. Once the modal is gone, one of those
+ // must not rewrite the table's selection from the abandoned bulk action.
+ projectTreeDataLogic.actions.movedItem(
+ { id: first.file_system_id, type: 'dashboard', ref: String(first.id), path: first.file_system_path } as any,
+ first.file_system_path!,
+ 'Revenue/Filed'
+ )
+
+ expect(onStillSelected).not.toHaveBeenCalled()
+ })
+
it('does not refetch when toggling pinned while a search is active on the /dashboard URL', async () => {
// Toggling pinned writes ?pinned=true to the URL, which round-trips back through
// urlToAction. The guard there must not re-dispatch setSearch and trigger a redundant
diff --git a/frontend/src/scenes/dashboard/dashboards/dashboardsLogic.ts b/frontend/src/scenes/dashboard/dashboards/dashboardsLogic.ts
index 6b88aa31cef2..2679f421023e 100644
--- a/frontend/src/scenes/dashboard/dashboards/dashboardsLogic.ts
+++ b/frontend/src/scenes/dashboard/dashboards/dashboardsLogic.ts
@@ -3,17 +3,21 @@ import { loaders } from 'kea-loaders'
import { router, urlToAction } from 'kea-router'
import api, { PaginatedResponse } from 'lib/api'
+import { moveToLogic } from 'lib/components/FileSystem/MoveTo/moveToLogic'
import { Sorting } from 'lib/lemon-ui/LemonTable/sorting'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { trackedActionToUrl } from 'lib/logic/scenes/trackedActionToUrl'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { objectClean, objectsEqual } from 'lib/utils/objects'
import { teamLogic } from 'scenes/teamLogic'
+import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'
import { SIDE_PANEL_CONTEXT_KEY, SidePanelSceneContext } from '~/layout/navigation-3000/sidepanel/types'
+import { projectTreeDataLogic } from '~/layout/panel-layout/ProjectTree/projectTreeDataLogic'
import { dashboardsModel } from '~/models/dashboardsModel'
import { tagsModel } from '~/models/tagsModel'
+import { FileSystemEntry } from '~/queries/schema/schema-general'
import { ActivityScope, Breadcrumb, DashboardBasicType } from '~/types'
import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
@@ -47,6 +51,19 @@ export const DEFAULT_FILTERS: DashboardsFilters = {
folder: null,
}
+function moveTargetFor(dashboard: DashboardBasicType | undefined): FileSystemEntry | null {
+ if (!dashboard?.file_system_id || !dashboard.file_system_path) {
+ return null
+ }
+ return {
+ id: dashboard.file_system_id,
+ path: dashboard.file_system_path,
+ type: 'dashboard',
+ ref: String(dashboard.id),
+ href: urls.dashboard(dashboard.id),
+ }
+}
+
/** Router may coerce numeric-looking query values to numbers; search text must stay a string. */
function urlSearchParamToString(value: unknown): string {
return `${value ?? ''}`
@@ -60,6 +77,8 @@ export interface dashboardsLogicValues {
breadcrumbs: Breadcrumb[]
currentTab: DashboardsTab
dashboards: DashboardBasicType[]
+ dashboardsById: Record<string, DashboardBasicType>
+ filedDashboardIds: Set<number>
filteredTags: string[]
filters: DashboardsFilters
isFiltering: boolean
@@ -73,6 +92,25 @@ export interface dashboardsLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface dashboardsLogicActions {
+ reportDashboardMoveInitiated: (
+ method: 'bulk' | 'single',
+ count: number
+ ) => {
+ count: number
+ method: 'bulk' | 'single'
+ } // eventUsageLogic
+ openMoveToModal: (items: FileSystemEntry[]) => {
+ items: FileSystemEntry[]
+ } // moveToLogic
+ movedItem: (
+ item: FileSystemEntry,
+ oldPath: string,
+ newPath: string
+ ) => {
+ item: FileSystemEntry
+ newPath: string
+ oldPath: string
+ } // projectTreeDataLogic
loadSearchedDashboards: ({ search, tags, folder }: { folder: string | null; search: string; tags: string[] }) => {
search: string
tags: string[]
@@ -100,6 +138,15 @@ export interface dashboardsLogicActions {
folder: string | null
}
}
+ moveDashboardsToFolder: (
+ ids: number[],
+ method: 'bulk' | 'single',
+ onStillSelected?: (ids: number[]) => void
+ ) => {
+ ids: number[]
+ method: 'bulk' | 'single'
+ onStillSelected: ((ids: number[]) => void) | undefined
+ }
setCurrentTab: (tab: DashboardsTab) => {
tab: DashboardsTab
}
@@ -130,7 +177,7 @@ export interface dashboardsLogicMeta {
| DashboardBasicType
| import('~/types').DashboardType<
import('~/types').QueryBasedInsightModel<
- import('../../../queries/schema').Node<Record<string, any>>
+ import('~/queries/schema/schema-general').Node<Record<string, any>>
>
>
)[],
@@ -139,7 +186,7 @@ export interface dashboardsLogicMeta {
| DashboardBasicType
| import('~/types').DashboardType<
import('~/types').QueryBasedInsightModel<
- import('../../../queries/schema').Node<Record<string, any>>
+ import('~/queries/schema/schema-general').Node<Record<string, any>>
>
>
>,
@@ -148,6 +195,8 @@ export interface dashboardsLogicMeta {
currentTab: DashboardsTab,
user: UserType | null
) => DashboardBasicType[]
+ dashboardsById: (dashboards: DashboardBasicType[]) => Record<string, DashboardBasicType>
+ filedDashboardIds: (dashboards: DashboardBasicType[]) => Set<number>
}
}
@@ -162,8 +211,21 @@ export const dashboardsLogic = kea<dashboardsLogicType>([
path(['scenes', 'dashboard', 'dashboardsLogic']),
connect(() => ({
values: [userLogic, ['user'], featureFlagLogic, ['featureFlags'], tagsModel, ['tags']],
+ actions: [
+ moveToLogic,
+ ['openMoveToModal'],
+ eventUsageLogic,
+ ['reportDashboardMoveInitiated'],
+ projectTreeDataLogic,
+ ['movedItem'],
+ ],
})),
actions({
+ moveDashboardsToFolder: (
+ ids: number[],
+ method: 'single' | 'bulk',
+ onStillSelected?: (ids: number[]) => void
+ ) => ({ ids, method, onStillSelected }),
setCurrentTab: (tab: DashboardsTab) => ({ tab }),
setSearch: (search: string) => ({ search }),
setFilters: (filters: Partial<DashboardsFilters>) => ({
@@ -346,6 +408,17 @@ export const dashboardsLogic = kea<dashboardsLogicType>([
},
],
+ dashboardsById: [
+ (s) => [s.dashboards],
+ (dashboards: DashboardBasicType[]): Record<string, DashboardBasicType> =>
+ Object.fromEntries(dashboards.map((dashboard) => [dashboard.id, dashboard])),
+ ],
+ filedDashboardIds: [
+ (s) => [s.dashboards],
+ (dashboards: DashboardBasicType[]): Set<number> =>
+ new Set(dashboards.filter((dashboard) => moveTargetFor(dashboard)).map(({ id }) => id)),
+ ],
+
breadcrumbs: [
() => [],
(): Breadcrumb[] => [
@@ -477,7 +550,39 @@ export const dashboardsLogic = kea<dashboardsLogicType>([
}
},
})),
- listeners(({ actions, values }) => ({
+ listeners(({ actions, values, cache }) => ({
+ movedItem: ({ item, oldPath, newPath }) => {
+ if (item.type === 'folder') {
+ dashboardsModel.actions.reparentDashboardFolders(oldPath, newPath)
+ return
+ }
+ // A shortcut carries the ref of the dashboard it points at, but moving it moves only the shortcut.
+ if (item.type !== 'dashboard' || !item.ref || item.shortcut) {
+ return
+ }
+ dashboardsModel.actions.patchDashboardFolders({ [item.ref]: newPath })
+ // Only rows that actually landed lose their tick, so a failed move keeps its selection.
+ const awaiting = cache.awaitingMove
+ if (awaiting?.ids.delete(Number(item.ref))) {
+ awaiting.onStillSelected?.([...awaiting.ids])
+ }
+ },
+ moveDashboardsToFolder: ({ ids, method, onStillSelected }) => {
+ const moving = ids
+ .map((id) => moveTargetFor(values.dashboardsById[id]))
+ .filter((entry): entry is FileSystemEntry => !!entry)
+ if (moving.length === 0) {
+ return
+ }
+ actions.reportDashboardMoveInitiated(method, moving.length)
+ actions.openMoveToModal(moving)
+ cache.awaitingMove = { ids: new Set(ids), onStillSelected }
+ },
+ // Only the dismiss path dispatches this. Submitting goes straight to closedMoveToModal, so clearing
+ // on that one instead would drop the ticks before any move had landed.
+ [moveToLogic.actionTypes.closeMoveToModal]: () => {
+ cache.awaitingMove = undefined
+ },
setSearch: ({ search }) => {
actions.loadSearchedDashboards({
search,
diff --git a/frontend/src/types.ts b/frontend/src/types.ts
index 4f82bacdad1a..ff4e7588b3ee 100644
--- a/frontend/src/types.ts
+++ b/frontend/src/types.ts
@@ -2653,6 +2653,10 @@ export interface DashboardBasicType extends WithAccessControl {
tags?: string[]
/** Project-tree folder the dashboard is filed under, e.g. 'Unfiled/Dashboards'. Empty string is the project root; null means no file system entry. */
folder?: string | null
+ /** Null when the dashboard was never filed, which is the case that cannot be moved. */
+ file_system_id?: string | null
+ /** Unlike `folder`, keeps the dashboard's own name as the last segment, which a move needs to compute the destination. */
+ file_system_path?: string | null
/** Purely local value to determine whether the dashboard should be highlighted, e.g. as a fresh duplicate. */
_highlight?: boolean
/**
diff --git a/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr b/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr
index f584b847ab1f..93e8f8106962 100644
--- a/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr
+++ b/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr
@@ -930,6 +930,18 @@
AND U0."shortcut" IS NOT NULL))
ORDER BY U0."id" ASC
LIMIT 1) AS "_folder_path",
+
+ (SELECT U0."id" AS "id"
+ FROM "posthog_filesystem" U0
+ WHERE ((U0."surface" IS NULL
+ OR U0."surface" = 'web')
+ AND U0."ref" = ("posthog_dashboard"."id")::varchar
+ AND U0."team_id" = ("posthog_dashboard"."team_id")
+ AND U0."type" = 'dashboard'
+ AND NOT (U0."shortcut"
+ AND U0."shortcut" IS NOT NULL))
+ ORDER BY 1 ASC
+ LIMIT 1) AS "_folder_id",
T6."id",
T6."password",
T6."last_login",
@@ -3403,6 +3415,18 @@
AND U0."shortcut" IS NOT NULL))
ORDER BY U0."id" ASC
LIMIT 1) AS "_folder_path",
+
+ (SELECT U0."id" AS "id"
+ FROM "posthog_filesystem" U0
+ WHERE ((U0."surface" IS NULL
+ OR U0."surface" = 'web')
+ AND U0."ref" = ("posthog_dashboard"."id")::varchar
+ AND U0."team_id" = ("posthog_dashboard"."team_id")
+ AND U0."type" = 'dashboard'
+ AND NOT (U0."shortcut"
+ AND U0."shortcut" IS NOT NULL))
+ ORDER BY 1 ASC
+ LIMIT 1) AS "_folder_id",
T6."id",
T6."password",
T6."last_login",
@@ -3936,6 +3960,224 @@
'''
# ---
# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.100
+ '''
+ SELECT "posthog_team"."id",
+ "posthog_team"."uuid",
+ "posthog_team"."organization_id",
+ "posthog_team"."parent_team_id",
+ "posthog_team"."project_id",
+ "posthog_team"."api_token",
+ "posthog_team"."app_urls",
+ "posthog_team"."name",
+ "posthog_team"."slack_incoming_webhook",
+ "posthog_team"."created_at",
+ "posthog_team"."updated_at",
+ "posthog_team"."anonymize_ips",
+ "posthog_team"."completed_snippet_onboarding",
+ "posthog_team"."has_completed_onboarding_for",
+ "posthog_team"."onboarding_tasks",
+ "posthog_team"."ingested_event",
+ "posthog_team"."ingested_production_event",
+ "posthog_team"."ingested_production_event_last_checked_at",
+ "posthog_team"."person_processing_opt_out",
+ "posthog_team"."secret_api_token",
+ "posthog_team"."secret_api_token_backup",
+ "posthog_team"."session_recording_opt_in",
+ "posthog_team"."session_recording_sample_rate",
+ "posthog_team"."session_recording_minimum_duration_milliseconds",
+ "posthog_team"."session_recording_linked_flag",
+ "posthog_team"."session_recording_network_payload_capture_config",
+ "posthog_team"."session_recording_masking_config",
+ "posthog_team"."session_recording_url_trigger_config",
+ "posthog_team"."session_recording_url_blocklist_config",
+ "posthog_team"."session_recording_event_trigger_config",
+ "posthog_team"."session_recording_trigger_match_type_config",
+ "posthog_team"."session_recording_trigger_groups",
+ "posthog_team"."session_replay_config",
+ "posthog_team"."session_recording_retention_period",
+ "posthog_team"."event_retention_months",
+ "posthog_team"."conversations_enabled",
+ "posthog_team"."conversations_settings",
+ "posthog_team"."proactive_tasks_enabled",
+ "posthog_team"."survey_config",
+ "posthog_team"."surveys_opt_in",
+ "posthog_team"."product_tours_opt_in",
+ "posthog_team"."capture_console_log_opt_in",
+ "posthog_team"."capture_performance_opt_in",
+ "posthog_team"."capture_dead_clicks",
+ "posthog_team"."autocapture_opt_out",
+ "posthog_team"."autocapture_web_vitals_opt_in",
+ "posthog_team"."autocapture_web_vitals_allowed_metrics",
+ "posthog_team"."autocapture_exceptions_opt_in",
+ "posthog_team"."autocapture_exceptions_errors_to_ignore",
+ "posthog_team"."logs_settings",
+ "posthog_team"."llm_gateway_enabled_at",
+ "posthog_team"."llm_gateway_revoked_at",
+ "posthog_team"."llm_gateway_overspend_allowance_usd",
+ "posthog_team"."heatmaps_opt_in",
+ "posthog_team"."receive_org_level_activity_logs",
+ "posthog_team"."web_analytics_pre_aggregated_tables_enabled",
+ "posthog_team"."web_analytics_pre_aggregated_tables_version",
+ "posthog_team"."flags_persistence_default",
+ "posthog_team"."feature_flag_confirmation_enabled",
+ "posthog_team"."feature_flag_confirmation_message",
+ "posthog_team"."default_evaluation_environments_enabled",
+ "posthog_team"."require_evaluation_environment_tags",
+ "posthog_team"."default_evaluation_contexts_enabled",
+ "posthog_team"."require_evaluation_contexts",
+ "posthog_team"."session_recording_version",
+ "posthog_team"."signup_token",
+ "posthog_team"."is_demo",
+ "posthog_team"."access_control",
+ "posthog_team"."week_start_day",
+ "posthog_team"."inject_web_apps",
+ "posthog_team"."test_account_filters",
+ "posthog_team"."test_account_filters_default_checked",
+ "posthog_team"."path_cleaning_filters",
+ "posthog_team"."timezone",
+ "posthog_team"."data_attributes",
+ "posthog_team"."person_display_name_properties",
+ "posthog_team"."live_events_columns",
+ "posthog_team"."recording_domains",
+ "posthog_team"."human_friendly_comparison_periods",
+ "posthog_team"."cookieless_server_hash_mode",
+ "posthog_team"."primary_dashboard_id",
+ "posthog_team"."default_data_theme",
+ "posthog_team"."extra_settings",
+ "posthog_team"."modifiers",
+ "posthog_team"."correlation_config",
+ "posthog_team"."session_recording_retention_period_days",
+ "posthog_team"."external_data_workspace_id",
+ "posthog_team"."external_data_workspace_last_synced_at",
+ "posthog_team"."api_query_rate_limit",
+ "posthog_team"."drop_events_older_than",
+ "posthog_team"."base_currency",
+ "posthog_team"."experiment_recalculation_time",
+ "posthog_team"."default_experiment_confidence_level",
+ "posthog_team"."default_experiment_stats_method",
+ "posthog_team"."business_model"
+ FROM "posthog_team"
+ WHERE "posthog_team"."id" = 99999
+ LIMIT 21
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.101
+ '''
+ SELECT "posthog_dashboardtile"."id",
+ "posthog_dashboardtile"."dashboard_id",
+ "posthog_dashboardtile"."insight_id",
+ "posthog_dashboardtile"."text_id",
+ "posthog_dashboardtile"."button_tile_id",
+ "posthog_dashboardtile"."widget_id",
+ "posthog_dashboardtile"."team_id",
+ "posthog_dashboardtile"."layouts",
+ "posthog_dashboardtile"."color",
+ "posthog_dashboardtile"."filters_hash",
+ "posthog_dashboardtile"."last_refresh",
+ "posthog_dashboardtile"."refreshing",
+ "posthog_dashboardtile"."refresh_attempt",
+ "posthog_dashboardtile"."filters_overrides",
+ "posthog_dashboardtile"."show_description",
+ "posthog_dashboardtile"."transparent_background",
+ "posthog_dashboardtile"."deleted"
+ FROM "posthog_dashboardtile"
+ INNER JOIN "posthog_dashboard" ON ("posthog_dashboardtile"."dashboard_id" = "posthog_dashboard"."id")
+ WHERE (NOT ("posthog_dashboardtile"."deleted"
+ AND "posthog_dashboardtile"."deleted" IS NOT NULL)
+ AND NOT ("posthog_dashboard"."deleted")
+ AND "posthog_dashboardtile"."insight_id" = 99999)
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.102
+ '''
+ SELECT "posthog_dashboardtile"."id",
+ "posthog_dashboardtile"."dashboard_id",
+ "posthog_dashboardtile"."insight_id",
+ "posthog_dashboardtile"."text_id",
+ "posthog_dashboardtile"."button_tile_id",
+ "posthog_dashboardtile"."widget_id",
+ "posthog_dashboardtile"."team_id",
+ "posthog_dashboardtile"."layouts",
+ "posthog_dashboardtile"."color",
+ "posthog_dashboardtile"."filters_hash",
+ "posthog_dashboardtile"."last_refresh",
+ "posthog_dashboardtile"."refreshing",
+ "posthog_dashboardtile"."refresh_attempt",
+ "posthog_dashboardtile"."filters_overrides",
+ "posthog_dashboardtile"."show_description",
+ "posthog_dashboardtile"."transparent_background",
+ "posthog_dashboardtile"."deleted"
+ FROM "posthog_dashboardtile"
+ INNER JOIN "posthog_dashboard" ON ("posthog_dashboardtile"."dashboard_id" = "posthog_dashboard"."id")
+ WHERE (NOT ("posthog_dashboardtile"."deleted"
+ AND "posthog_dashboardtile"."deleted" IS NOT NULL)
+ AND NOT ("posthog_dashboard"."deleted")
+ AND "posthog_dashboardtile"."insight_id" = 99999)
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.103
+ '''
+ SELECT "posthog_insightvariable"."created_by_id",
+ "posthog_insightvariable"."created_at",
+ "posthog_insightvariable"."updated_at",
+ "posthog_insightvariable"."id",
+ "posthog_insightvariable"."team_id",
+ "posthog_insightvariable"."name",
+ "posthog_insightvariable"."code_name",
+ "posthog_insightvariable"."type",
+ "posthog_insightvariable"."default_value",
+ "posthog_insightvariable"."values",
+ "posthog_insightvariable"."is_multi",
+ "posthog_insightvariable"."values_query",
+ "posthog_insightvariable"."values_query_connection_id"
+ FROM "posthog_insightvariable"
+ WHERE "posthog_insightvariable"."team_id" = 99999
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.104
+ '''
+ SELECT "posthog_dashboardtile"."dashboard_id" AS "dashboard_id"
+ FROM "posthog_dashboardtile"
+ INNER JOIN "posthog_dashboard" ON ("posthog_dashboardtile"."dashboard_id" = "posthog_dashboard"."id")
+ WHERE (NOT ("posthog_dashboardtile"."deleted"
+ AND "posthog_dashboardtile"."deleted" IS NOT NULL)
+ AND NOT ("posthog_dashboard"."deleted")
+ AND "posthog_dashboardtile"."insight_id" = 99999)
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.105
+ '''
+ SELECT "posthog_dashboard"."id",
+ "posthog_dashboard"."name",
+ "posthog_dashboard"."description",
+ "posthog_dashboard"."team_id",
+ "posthog_dashboard"."pinned",
+ "posthog_dashboard"."created_at",
+ "posthog_dashboard"."created_by_id",
+ "posthog_dashboard"."deleted",
+ "posthog_dashboard"."last_accessed_at",
+ "posthog_dashboard"."last_refresh",
+ "posthog_dashboard"."filters",
+ "posthog_dashboard"."variables",
+ "posthog_dashboard"."breakdown_colors",
+ "posthog_dashboard"."data_color_theme_id",
+ "posthog_dashboard"."creation_mode",
+ "posthog_dashboard"."restriction_level",
+ "posthog_dashboard"."quick_filter_ids",
+ "posthog_dashboard"."deprecated_tags",
+ "posthog_dashboard"."tags",
+ "posthog_dashboard"."share_token",
+ "posthog_dashboard"."is_shared"
+ FROM "posthog_dashboard"
+ WHERE (NOT ("posthog_dashboard"."deleted")
+ AND "posthog_dashboard"."id" IN (1,
+ 2,
+ 3,
+ 4,
+ 5 /* ... */))
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.106
'''
SELECT "posthog_tag"."name" AS "tag__name"
FROM "posthog_taggeditem"
@@ -3943,7 +4185,7 @@
WHERE "posthog_taggeditem"."insight_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.101
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.107
'''
SELECT "posthog_user"."id",
"posthog_user"."password",
@@ -3989,7 +4231,7 @@
AND "posthog_user"."id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.102
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.108
'''
SELECT "posthog_organization"."id",
"posthog_organization"."name",
@@ -4033,7 +4275,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.103
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.109
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -4173,7 +4415,19 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.104
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.11
+ '''
+ SELECT COUNT(*) AS "__count"
+ FROM "posthog_dashboardtile"
+ INNER JOIN "posthog_dashboard" ON ("posthog_dashboardtile"."dashboard_id" = "posthog_dashboard"."id")
+ WHERE (NOT ("posthog_dashboardtile"."deleted"
+ AND "posthog_dashboardtile"."deleted" IS NOT NULL)
+ AND NOT ("posthog_dashboard"."deleted")
+ AND "posthog_dashboardtile"."dashboard_id" = 99999
+ AND NOT ("posthog_dashboardtile"."insight_id" IS NULL))
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.110
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -4226,7 +4480,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.105
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.111
'''
SELECT "ee_accesscontrol"."id",
"ee_accesscontrol"."team_id",
@@ -4251,7 +4505,7 @@
AND "ee_accesscontrol"."team_id" = 99999))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.106
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.112
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -4302,7 +4556,7 @@
WHERE "posthog_organizationmembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.107
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.113
'''
SELECT "ee_accesscontrol"."team_id" AS "team_id",
"ee_accesscontrol"."resource_id" AS "resource_id",
@@ -4315,7 +4569,7 @@
AND "posthog_team"."organization_id" IN ('00000000-0000-0000-0000-000000000000'::uuid))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.108
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.114
'''
SELECT "ee_role"."organization_id" AS "role__organization_id",
"ee_rolemembership"."role_id" AS "role_id"
@@ -4324,7 +4578,7 @@
WHERE "ee_rolemembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.109
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.115
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -4361,19 +4615,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.11
- '''
- SELECT COUNT(*) AS "__count"
- FROM "posthog_dashboardtile"
- INNER JOIN "posthog_dashboard" ON ("posthog_dashboardtile"."dashboard_id" = "posthog_dashboard"."id")
- WHERE (NOT ("posthog_dashboardtile"."deleted"
- AND "posthog_dashboardtile"."deleted" IS NOT NULL)
- AND NOT ("posthog_dashboard"."deleted")
- AND "posthog_dashboardtile"."dashboard_id" = 99999
- AND NOT ("posthog_dashboardtile"."insight_id" IS NULL))
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.110
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.116
'''
SELECT COUNT(*) AS "__count"
FROM "posthog_dashboardtile"
@@ -4386,7 +4628,7 @@
AND "posthog_dashboardtile"."deleted" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.111
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.117
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -4418,7 +4660,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.112
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.118
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -4520,7 +4762,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.113
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.119
'''
SELECT "posthog_filesystem"."team_id",
"posthog_filesystem"."id",
@@ -4545,7 +4787,26 @@
AND "posthog_filesystem"."shortcut" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.114
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.12
+ '''
+ SELECT "posthog_sharingconfiguration"."id",
+ "posthog_sharingconfiguration"."team_id",
+ "posthog_sharingconfiguration"."dashboard_id",
+ "posthog_sharingconfiguration"."insight_id",
+ "posthog_sharingconfiguration"."recording_id",
+ "posthog_sharingconfiguration"."notebook_id",
+ "posthog_sharingconfiguration"."interviewee_context_id",
+ "posthog_sharingconfiguration"."created_at",
+ "posthog_sharingconfiguration"."enabled",
+ "posthog_sharingconfiguration"."access_token",
+ "posthog_sharingconfiguration"."expires_at",
+ "posthog_sharingconfiguration"."settings",
+ "posthog_sharingconfiguration"."password_required"
+ FROM "posthog_sharingconfiguration"
+ WHERE "posthog_sharingconfiguration"."dashboard_id" = 99999
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.120
'''
SELECT "posthog_organization"."id",
"posthog_organization"."name",
@@ -4589,7 +4850,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.115
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.121
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -4691,7 +4952,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.116
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.122
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -4718,7 +4979,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.117
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.123
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -4745,7 +5006,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.118
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.124
'''
SELECT "posthog_insightvariable"."created_by_id",
"posthog_insightvariable"."created_at",
@@ -4764,7 +5025,7 @@
WHERE "posthog_insightvariable"."team_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.119
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.125
'''
SELECT "posthog_dashboardtile"."dashboard_id" AS "dashboard_id"
FROM "posthog_dashboardtile"
@@ -4775,26 +5036,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.12
- '''
- SELECT "posthog_sharingconfiguration"."id",
- "posthog_sharingconfiguration"."team_id",
- "posthog_sharingconfiguration"."dashboard_id",
- "posthog_sharingconfiguration"."insight_id",
- "posthog_sharingconfiguration"."recording_id",
- "posthog_sharingconfiguration"."notebook_id",
- "posthog_sharingconfiguration"."interviewee_context_id",
- "posthog_sharingconfiguration"."created_at",
- "posthog_sharingconfiguration"."enabled",
- "posthog_sharingconfiguration"."access_token",
- "posthog_sharingconfiguration"."expires_at",
- "posthog_sharingconfiguration"."settings",
- "posthog_sharingconfiguration"."password_required"
- FROM "posthog_sharingconfiguration"
- WHERE "posthog_sharingconfiguration"."dashboard_id" = 99999
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.120
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.126
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -4826,7 +5068,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.121
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.127
'''
SELECT "posthog_tag"."name" AS "tag__name"
FROM "posthog_taggeditem"
@@ -4834,7 +5076,7 @@
WHERE "posthog_taggeditem"."insight_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.122
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.128
'''
SELECT "posthog_user"."id",
"posthog_user"."password",
@@ -4880,7 +5122,7 @@
AND "posthog_user"."id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.123
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.129
'''
SELECT "posthog_organization"."id",
"posthog_organization"."name",
@@ -4924,7 +5166,14 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.124
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.13
+ '''
+ SELECT COUNT(*) AS "__count"
+ FROM "posthog_taggeditem"
+ WHERE "posthog_taggeditem"."dashboard_id" = 99999
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.130
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -5064,7 +5313,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.125
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.131
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -5117,7 +5366,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.126
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.132
'''
SELECT "ee_accesscontrol"."id",
"ee_accesscontrol"."team_id",
@@ -5142,7 +5391,7 @@
AND "ee_accesscontrol"."team_id" = 99999))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.127
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.133
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -5193,7 +5442,7 @@
WHERE "posthog_organizationmembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.128
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.134
'''
SELECT "ee_accesscontrol"."team_id" AS "team_id",
"ee_accesscontrol"."resource_id" AS "resource_id",
@@ -5206,7 +5455,7 @@
AND "posthog_team"."organization_id" IN ('00000000-0000-0000-0000-000000000000'::uuid))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.129
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.135
'''
SELECT "ee_role"."organization_id" AS "role__organization_id",
"ee_rolemembership"."role_id" AS "role_id"
@@ -5215,14 +5464,7 @@
WHERE "ee_rolemembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.13
- '''
- SELECT COUNT(*) AS "__count"
- FROM "posthog_taggeditem"
- WHERE "posthog_taggeditem"."dashboard_id" = 99999
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.130
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.136
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -5259,6 +5501,18 @@
AND U0."shortcut" IS NOT NULL))
ORDER BY U0."id" ASC
LIMIT 1) AS "_folder_path",
+
+ (SELECT U0."id" AS "id"
+ FROM "posthog_filesystem" U0
+ WHERE ((U0."surface" IS NULL
+ OR U0."surface" = 'web')
+ AND U0."ref" = ("posthog_dashboard"."id")::varchar
+ AND U0."team_id" = ("posthog_dashboard"."team_id")
+ AND U0."type" = 'dashboard'
+ AND NOT (U0."shortcut"
+ AND U0."shortcut" IS NOT NULL))
+ ORDER BY 1 ASC
+ LIMIT 1) AS "_folder_id",
T6."id",
T6."password",
T6."last_login",
@@ -5312,7 +5566,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.131
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.137
'''
SELECT "posthog_sharingconfiguration"."id",
"posthog_sharingconfiguration"."team_id",
@@ -5335,7 +5589,7 @@
5 /* ... */)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.132
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.138
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -5698,7 +5952,7 @@
ORDER BY "posthog_dashboarditem"."order" ASC
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.133
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.139
'''
SELECT ("posthog_dashboardtile"."insight_id") AS "_prefetch_related_val_insight_id",
"posthog_dashboard"."id",
@@ -5739,7 +5993,23 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.134
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.14
+ '''
+ SELECT "posthog_filesystem"."id" AS "id",
+ "posthog_filesystem"."path" AS "path"
+ FROM "posthog_filesystem"
+ WHERE (("posthog_filesystem"."surface" IS NULL
+ OR "posthog_filesystem"."surface" = 'web')
+ AND "posthog_filesystem"."ref" = '0001'
+ AND "posthog_filesystem"."team_id" = 99999
+ AND "posthog_filesystem"."type" = 'dashboard'
+ AND NOT ("posthog_filesystem"."shortcut"
+ AND "posthog_filesystem"."shortcut" IS NOT NULL))
+ ORDER BY 1 ASC
+ LIMIT 1
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.140
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -5770,7 +6040,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.135
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.141
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -5798,7 +6068,7 @@
2)/* ... */)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.136
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.142
'''
SELECT "posthog_taggeditem"."id",
"posthog_taggeditem"."tag_id",
@@ -5824,7 +6094,7 @@
5 /* ... */)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.137
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.143
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -5926,7 +6196,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.138
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.144
'''
SELECT "posthog_filesystem"."team_id",
"posthog_filesystem"."id",
@@ -5951,7 +6221,7 @@
AND "posthog_filesystem"."shortcut" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.139
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.145
'''
SELECT "posthog_filesystemshortcut"."id",
"posthog_filesystemshortcut"."team_id",
@@ -5974,26 +6244,7 @@
AND "posthog_filesystemshortcut"."href" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.14
- '''
- SELECT "posthog_sharingconfiguration"."id",
- "posthog_sharingconfiguration"."team_id",
- "posthog_sharingconfiguration"."dashboard_id",
- "posthog_sharingconfiguration"."insight_id",
- "posthog_sharingconfiguration"."recording_id",
- "posthog_sharingconfiguration"."notebook_id",
- "posthog_sharingconfiguration"."interviewee_context_id",
- "posthog_sharingconfiguration"."created_at",
- "posthog_sharingconfiguration"."enabled",
- "posthog_sharingconfiguration"."access_token",
- "posthog_sharingconfiguration"."expires_at",
- "posthog_sharingconfiguration"."settings",
- "posthog_sharingconfiguration"."password_required"
- FROM "posthog_sharingconfiguration"
- WHERE "posthog_sharingconfiguration"."dashboard_id" = 99999
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.140
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.146
'''
SELECT "posthog_insightvariable"."created_by_id",
"posthog_insightvariable"."created_at",
@@ -6012,7 +6263,7 @@
WHERE "posthog_insightvariable"."team_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.141
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.147
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -6376,7 +6627,7 @@
ORDER BY "posthog_dashboarditem"."order" ASC
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.142
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.148
'''
SELECT ("posthog_dashboardtile"."insight_id") AS "_prefetch_related_val_insight_id",
"posthog_dashboard"."id",
@@ -6417,7 +6668,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.143
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.149
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -6448,7 +6699,23 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.144
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.15
+ '''
+ SELECT "posthog_filesystem"."id" AS "id",
+ "posthog_filesystem"."path" AS "path"
+ FROM "posthog_filesystem"
+ WHERE (("posthog_filesystem"."surface" IS NULL
+ OR "posthog_filesystem"."surface" = 'web')
+ AND "posthog_filesystem"."ref" = '0001'
+ AND "posthog_filesystem"."team_id" = 99999
+ AND "posthog_filesystem"."type" = 'dashboard'
+ AND NOT ("posthog_filesystem"."shortcut"
+ AND "posthog_filesystem"."shortcut" IS NOT NULL))
+ ORDER BY 1 ASC
+ LIMIT 1
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.150
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -6476,7 +6743,7 @@
2)/* ... */)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.145
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.151
'''
SELECT "posthog_taggeditem"."id",
"posthog_taggeditem"."tag_id",
@@ -6502,7 +6769,7 @@
5 /* ... */)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.146
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.152
'''
SELECT "posthog_alertconfiguration"."created_by_id",
"posthog_alertconfiguration"."created_at",
@@ -6583,7 +6850,7 @@
5 /* ... */)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.147
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.153
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -6615,7 +6882,42 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.15
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.16
+ '''
+ SELECT "posthog_filesystem"."id" AS "id",
+ "posthog_filesystem"."path" AS "path"
+ FROM "posthog_filesystem"
+ WHERE (("posthog_filesystem"."surface" IS NULL
+ OR "posthog_filesystem"."surface" = 'web')
+ AND "posthog_filesystem"."ref" = '0001'
+ AND "posthog_filesystem"."team_id" = 99999
+ AND "posthog_filesystem"."type" = 'dashboard'
+ AND NOT ("posthog_filesystem"."shortcut"
+ AND "posthog_filesystem"."shortcut" IS NOT NULL))
+ ORDER BY 1 ASC
+ LIMIT 1
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.17
+ '''
+ SELECT "posthog_sharingconfiguration"."id",
+ "posthog_sharingconfiguration"."team_id",
+ "posthog_sharingconfiguration"."dashboard_id",
+ "posthog_sharingconfiguration"."insight_id",
+ "posthog_sharingconfiguration"."recording_id",
+ "posthog_sharingconfiguration"."notebook_id",
+ "posthog_sharingconfiguration"."interviewee_context_id",
+ "posthog_sharingconfiguration"."created_at",
+ "posthog_sharingconfiguration"."enabled",
+ "posthog_sharingconfiguration"."access_token",
+ "posthog_sharingconfiguration"."expires_at",
+ "posthog_sharingconfiguration"."settings",
+ "posthog_sharingconfiguration"."password_required"
+ FROM "posthog_sharingconfiguration"
+ WHERE "posthog_sharingconfiguration"."dashboard_id" = 99999
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.18
'''
SELECT "posthog_insightvariable"."created_by_id",
"posthog_insightvariable"."created_at",
@@ -6634,7 +6936,7 @@
WHERE "posthog_insightvariable"."team_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.16
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.19
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -6992,105 +7294,7 @@
ORDER BY "posthog_dashboarditem"."order" ASC
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.17
- '''
- SELECT "posthog_tag"."name" AS "tag__name"
- FROM "posthog_taggeditem"
- INNER JOIN "posthog_tag" ON ("posthog_taggeditem"."tag_id" = "posthog_tag"."id")
- WHERE "posthog_taggeditem"."dashboard_id" = 99999
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.18
- '''
- SELECT "posthog_user"."id",
- "posthog_user"."password",
- "posthog_user"."last_login",
- "posthog_user"."first_name",
- "posthog_user"."last_name",
- "posthog_user"."is_staff",
- "posthog_user"."date_joined",
- "posthog_user"."uuid",
- "posthog_user"."current_organization_id",
- "posthog_user"."current_team_id",
- "posthog_user"."email",
- "posthog_user"."pending_email",
- "posthog_user"."distinct_id",
- "posthog_user"."is_email_verified",
- "posthog_user"."credentials_reviewed_at",
- "posthog_user"."requested_2fa_reset_at",
- "posthog_user"."has_seen_product_intro_for",
- "posthog_user"."strapi_id",
- "posthog_user"."is_active",
- "posthog_user"."role_at_organization",
- "posthog_user"."theme_mode",
- "posthog_user"."partial_notification_settings",
- "posthog_user"."anonymize_data",
- "posthog_user"."allow_impersonation",
- "posthog_user"."toolbar_mode",
- "posthog_user"."hedgehog_config",
- "posthog_user"."allow_sidebar_suggestions",
- "posthog_user"."shortcut_position",
- "posthog_user"."passkeys_enabled_for_2fa",
- "posthog_user"."hide_mcp_hints",
- "posthog_user"."ui_configuration",
- "posthog_user"."onboarding_skipped_at",
- "posthog_user"."onboarding_skipped_reason",
- "posthog_user"."onboarding_skipped_organization_id",
- "posthog_user"."onboarding_delegated_to_invite_id",
- "posthog_user"."onboarding_delegated_to_organization_id",
- "posthog_user"."onboarding_delegation_accepted_at",
- "posthog_user"."events_column_config",
- "posthog_user"."email_opt_in"
- FROM "posthog_user"
- WHERE ("posthog_user"."is_active"
- AND "posthog_user"."id" = 99999)
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.19
- '''
- SELECT "posthog_organization"."id",
- "posthog_organization"."name",
- "posthog_organization"."slug",
- "posthog_organization"."logo_media_id",
- "posthog_organization"."created_at",
- "posthog_organization"."updated_at",
- "posthog_organization"."is_active",
- "posthog_organization"."is_not_active_reason",
- "posthog_organization"."session_cookie_age",
- "posthog_organization"."is_member_join_email_enabled",
- "posthog_organization"."is_ai_data_processing_approved",
- "posthog_organization"."is_ai_training_opted_in",
- "posthog_organization"."is_ai_training_locked",
- "posthog_organization"."is_ai_training_cta_shown",
- "posthog_organization"."enforce_2fa",
- "posthog_organization"."enforce_verified_domains",
- "posthog_organization"."members_can_invite",
- "posthog_organization"."members_can_create_projects",
- "posthog_organization"."members_can_use_personal_api_keys",
- "posthog_organization"."members_can_see_org_members",
- "posthog_organization"."allow_publicly_shared_resources",
- "posthog_organization"."default_role_id",
- "posthog_organization"."plugins_access_level",
- "posthog_organization"."for_internal_metrics",
- "posthog_organization"."default_experiment_stats_method",
- "posthog_organization"."default_anonymize_ips",
- "posthog_organization"."is_hipaa",
- "posthog_organization"."is_pending_deletion",
- "posthog_organization"."customer_id",
- "posthog_organization"."available_product_features",
- "posthog_organization"."usage",
- "posthog_organization"."never_drop_data",
- "posthog_organization"."customer_trust_scores",
- "posthog_organization"."setup_section_2_completed",
- "posthog_organization"."personalization",
- "posthog_organization"."domain_whitelist",
- "posthog_organization"."is_platform"
- FROM "posthog_organization"
- WHERE "posthog_organization"."id" = '00000000-0000-0000-0000-000000000000'::uuid
- LIMIT 21
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.2
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.2
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -7231,6 +7435,104 @@
'''
# ---
# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.20
+ '''
+ SELECT "posthog_tag"."name" AS "tag__name"
+ FROM "posthog_taggeditem"
+ INNER JOIN "posthog_tag" ON ("posthog_taggeditem"."tag_id" = "posthog_tag"."id")
+ WHERE "posthog_taggeditem"."dashboard_id" = 99999
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.21
+ '''
+ SELECT "posthog_user"."id",
+ "posthog_user"."password",
+ "posthog_user"."last_login",
+ "posthog_user"."first_name",
+ "posthog_user"."last_name",
+ "posthog_user"."is_staff",
+ "posthog_user"."date_joined",
+ "posthog_user"."uuid",
+ "posthog_user"."current_organization_id",
+ "posthog_user"."current_team_id",
+ "posthog_user"."email",
+ "posthog_user"."pending_email",
+ "posthog_user"."distinct_id",
+ "posthog_user"."is_email_verified",
+ "posthog_user"."credentials_reviewed_at",
+ "posthog_user"."requested_2fa_reset_at",
+ "posthog_user"."has_seen_product_intro_for",
+ "posthog_user"."strapi_id",
+ "posthog_user"."is_active",
+ "posthog_user"."role_at_organization",
+ "posthog_user"."theme_mode",
+ "posthog_user"."partial_notification_settings",
+ "posthog_user"."anonymize_data",
+ "posthog_user"."allow_impersonation",
+ "posthog_user"."toolbar_mode",
+ "posthog_user"."hedgehog_config",
+ "posthog_user"."allow_sidebar_suggestions",
+ "posthog_user"."shortcut_position",
+ "posthog_user"."passkeys_enabled_for_2fa",
+ "posthog_user"."hide_mcp_hints",
+ "posthog_user"."ui_configuration",
+ "posthog_user"."onboarding_skipped_at",
+ "posthog_user"."onboarding_skipped_reason",
+ "posthog_user"."onboarding_skipped_organization_id",
+ "posthog_user"."onboarding_delegated_to_invite_id",
+ "posthog_user"."onboarding_delegated_to_organization_id",
+ "posthog_user"."onboarding_delegation_accepted_at",
+ "posthog_user"."events_column_config",
+ "posthog_user"."email_opt_in"
+ FROM "posthog_user"
+ WHERE ("posthog_user"."is_active"
+ AND "posthog_user"."id" = 99999)
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.22
+ '''
+ SELECT "posthog_organization"."id",
+ "posthog_organization"."name",
+ "posthog_organization"."slug",
+ "posthog_organization"."logo_media_id",
+ "posthog_organization"."created_at",
+ "posthog_organization"."updated_at",
+ "posthog_organization"."is_active",
+ "posthog_organization"."is_not_active_reason",
+ "posthog_organization"."session_cookie_age",
+ "posthog_organization"."is_member_join_email_enabled",
+ "posthog_organization"."is_ai_data_processing_approved",
+ "posthog_organization"."is_ai_training_opted_in",
+ "posthog_organization"."is_ai_training_locked",
+ "posthog_organization"."is_ai_training_cta_shown",
+ "posthog_organization"."enforce_2fa",
+ "posthog_organization"."enforce_verified_domains",
+ "posthog_organization"."members_can_invite",
+ "posthog_organization"."members_can_create_projects",
+ "posthog_organization"."members_can_use_personal_api_keys",
+ "posthog_organization"."members_can_see_org_members",
+ "posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."default_role_id",
+ "posthog_organization"."plugins_access_level",
+ "posthog_organization"."for_internal_metrics",
+ "posthog_organization"."default_experiment_stats_method",
+ "posthog_organization"."default_anonymize_ips",
+ "posthog_organization"."is_hipaa",
+ "posthog_organization"."is_pending_deletion",
+ "posthog_organization"."customer_id",
+ "posthog_organization"."available_product_features",
+ "posthog_organization"."usage",
+ "posthog_organization"."never_drop_data",
+ "posthog_organization"."customer_trust_scores",
+ "posthog_organization"."setup_section_2_completed",
+ "posthog_organization"."personalization",
+ "posthog_organization"."domain_whitelist",
+ "posthog_organization"."is_platform"
+ FROM "posthog_organization"
+ WHERE "posthog_organization"."id" = '00000000-0000-0000-0000-000000000000'::uuid
+ LIMIT 21
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.23
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -7370,7 +7672,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.21
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.24
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -7423,7 +7725,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.22
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.25
'''
SELECT "ee_accesscontrol"."id",
"ee_accesscontrol"."team_id",
@@ -7448,7 +7750,7 @@
AND "ee_accesscontrol"."team_id" = 99999))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.23
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.26
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -7499,7 +7801,7 @@
WHERE "posthog_organizationmembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.24
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.27
'''
SELECT "ee_accesscontrol"."team_id" AS "team_id",
"ee_accesscontrol"."resource_id" AS "resource_id",
@@ -7512,7 +7814,7 @@
AND "posthog_team"."organization_id" IN ('00000000-0000-0000-0000-000000000000'::uuid))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.25
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.28
'''
SELECT "ee_role"."organization_id" AS "role__organization_id",
"ee_rolemembership"."role_id" AS "role_id"
@@ -7521,7 +7823,7 @@
WHERE "ee_rolemembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.26
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.29
'''
SELECT COUNT(*) AS "__count"
FROM "posthog_dashboard"
@@ -7537,7 +7839,60 @@
AND NOT "posthog_dashboard"."deleted")
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.27
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.3
+ '''
+ SELECT "posthog_organizationmembership"."id",
+ "posthog_organizationmembership"."organization_id",
+ "posthog_organizationmembership"."user_id",
+ "posthog_organizationmembership"."level",
+ "posthog_organizationmembership"."joined_at",
+ "posthog_organizationmembership"."updated_at",
+ "posthog_organizationmembership"."invited_by_id",
+ "posthog_organization"."id",
+ "posthog_organization"."name",
+ "posthog_organization"."slug",
+ "posthog_organization"."logo_media_id",
+ "posthog_organization"."created_at",
+ "posthog_organization"."updated_at",
+ "posthog_organization"."is_active",
+ "posthog_organization"."is_not_active_reason",
+ "posthog_organization"."session_cookie_age",
+ "posthog_organization"."is_member_join_email_enabled",
+ "posthog_organization"."is_ai_data_processing_approved",
+ "posthog_organization"."is_ai_training_opted_in",
+ "posthog_organization"."is_ai_training_locked",
+ "posthog_organization"."is_ai_training_cta_shown",
+ "posthog_organization"."enforce_2fa",
+ "posthog_organization"."enforce_verified_domains",
+ "posthog_organization"."members_can_invite",
+ "posthog_organization"."members_can_create_projects",
+ "posthog_organization"."members_can_use_personal_api_keys",
+ "posthog_organization"."members_can_see_org_members",
+ "posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."default_role_id",
+ "posthog_organization"."plugins_access_level",
+ "posthog_organization"."for_internal_metrics",
+ "posthog_organization"."default_experiment_stats_method",
+ "posthog_organization"."default_anonymize_ips",
+ "posthog_organization"."is_hipaa",
+ "posthog_organization"."is_pending_deletion",
+ "posthog_organization"."customer_id",
+ "posthog_organization"."available_product_features",
+ "posthog_organization"."usage",
+ "posthog_organization"."never_drop_data",
+ "posthog_organization"."customer_trust_scores",
+ "posthog_organization"."setup_section_2_completed",
+ "posthog_organization"."personalization",
+ "posthog_organization"."domain_whitelist",
+ "posthog_organization"."is_platform"
+ FROM "posthog_organizationmembership"
+ INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")
+ WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
+ AND "posthog_organizationmembership"."user_id" = 99999)
+ LIMIT 21
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.30
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -7639,7 +7994,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.28
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.31
'''
SELECT "posthog_filesystem"."team_id",
"posthog_filesystem"."id",
@@ -7664,7 +8019,7 @@
AND "posthog_filesystem"."shortcut" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.29
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.32
'''
SELECT COUNT(*) AS "__count"
FROM "posthog_dashboardtile"
@@ -7676,60 +8031,7 @@
AND NOT ("posthog_dashboardtile"."insight_id" IS NULL))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.3
- '''
- SELECT "posthog_organizationmembership"."id",
- "posthog_organizationmembership"."organization_id",
- "posthog_organizationmembership"."user_id",
- "posthog_organizationmembership"."level",
- "posthog_organizationmembership"."joined_at",
- "posthog_organizationmembership"."updated_at",
- "posthog_organizationmembership"."invited_by_id",
- "posthog_organization"."id",
- "posthog_organization"."name",
- "posthog_organization"."slug",
- "posthog_organization"."logo_media_id",
- "posthog_organization"."created_at",
- "posthog_organization"."updated_at",
- "posthog_organization"."is_active",
- "posthog_organization"."is_not_active_reason",
- "posthog_organization"."session_cookie_age",
- "posthog_organization"."is_member_join_email_enabled",
- "posthog_organization"."is_ai_data_processing_approved",
- "posthog_organization"."is_ai_training_opted_in",
- "posthog_organization"."is_ai_training_locked",
- "posthog_organization"."is_ai_training_cta_shown",
- "posthog_organization"."enforce_2fa",
- "posthog_organization"."enforce_verified_domains",
- "posthog_organization"."members_can_invite",
- "posthog_organization"."members_can_create_projects",
- "posthog_organization"."members_can_use_personal_api_keys",
- "posthog_organization"."members_can_see_org_members",
- "posthog_organization"."allow_publicly_shared_resources",
- "posthog_organization"."default_role_id",
- "posthog_organization"."plugins_access_level",
- "posthog_organization"."for_internal_metrics",
- "posthog_organization"."default_experiment_stats_method",
- "posthog_organization"."default_anonymize_ips",
- "posthog_organization"."is_hipaa",
- "posthog_organization"."is_pending_deletion",
- "posthog_organization"."customer_id",
- "posthog_organization"."available_product_features",
- "posthog_organization"."usage",
- "posthog_organization"."never_drop_data",
- "posthog_organization"."customer_trust_scores",
- "posthog_organization"."setup_section_2_completed",
- "posthog_organization"."personalization",
- "posthog_organization"."domain_whitelist",
- "posthog_organization"."is_platform"
- FROM "posthog_organizationmembership"
- INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")
- WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
- AND "posthog_organizationmembership"."user_id" = 99999)
- LIMIT 21
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.30
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.33
'''
SELECT "posthog_sharingconfiguration"."id",
"posthog_sharingconfiguration"."team_id",
@@ -7748,14 +8050,62 @@
WHERE "posthog_sharingconfiguration"."dashboard_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.31
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.34
'''
SELECT COUNT(*) AS "__count"
FROM "posthog_taggeditem"
WHERE "posthog_taggeditem"."dashboard_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.32
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.35
+ '''
+ SELECT "posthog_filesystem"."id" AS "id",
+ "posthog_filesystem"."path" AS "path"
+ FROM "posthog_filesystem"
+ WHERE (("posthog_filesystem"."surface" IS NULL
+ OR "posthog_filesystem"."surface" = 'web')
+ AND "posthog_filesystem"."ref" = '0001'
+ AND "posthog_filesystem"."team_id" = 99999
+ AND "posthog_filesystem"."type" = 'dashboard'
+ AND NOT ("posthog_filesystem"."shortcut"
+ AND "posthog_filesystem"."shortcut" IS NOT NULL))
+ ORDER BY 1 ASC
+ LIMIT 1
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.36
+ '''
+ SELECT "posthog_filesystem"."id" AS "id",
+ "posthog_filesystem"."path" AS "path"
+ FROM "posthog_filesystem"
+ WHERE (("posthog_filesystem"."surface" IS NULL
+ OR "posthog_filesystem"."surface" = 'web')
+ AND "posthog_filesystem"."ref" = '0001'
+ AND "posthog_filesystem"."team_id" = 99999
+ AND "posthog_filesystem"."type" = 'dashboard'
+ AND NOT ("posthog_filesystem"."shortcut"
+ AND "posthog_filesystem"."shortcut" IS NOT NULL))
+ ORDER BY 1 ASC
+ LIMIT 1
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.37
+ '''
+ SELECT "posthog_filesystem"."id" AS "id",
+ "posthog_filesystem"."path" AS "path"
+ FROM "posthog_filesystem"
+ WHERE (("posthog_filesystem"."surface" IS NULL
+ OR "posthog_filesystem"."surface" = 'web')
+ AND "posthog_filesystem"."ref" = '0001'
+ AND "posthog_filesystem"."team_id" = 99999
+ AND "posthog_filesystem"."type" = 'dashboard'
+ AND NOT ("posthog_filesystem"."shortcut"
+ AND "posthog_filesystem"."shortcut" IS NOT NULL))
+ ORDER BY 1 ASC
+ LIMIT 1
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.38
'''
SELECT "posthog_sharingconfiguration"."id",
"posthog_sharingconfiguration"."team_id",
@@ -7774,7 +8124,7 @@
WHERE "posthog_sharingconfiguration"."dashboard_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.33
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.39
'''
SELECT "posthog_insightvariable"."created_by_id",
"posthog_insightvariable"."created_at",
@@ -7793,7 +8143,32 @@
WHERE "posthog_insightvariable"."team_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.34
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.4
+ '''
+ SELECT "ee_accesscontrol"."id",
+ "ee_accesscontrol"."team_id",
+ "ee_accesscontrol"."access_level",
+ "ee_accesscontrol"."resource",
+ "ee_accesscontrol"."resource_id",
+ "ee_accesscontrol"."organization_member_id",
+ "ee_accesscontrol"."role_id",
+ "ee_accesscontrol"."created_by_id",
+ "ee_accesscontrol"."created_at",
+ "ee_accesscontrol"."updated_at",
+ "posthog_team"."organization_id" AS "_team_organization_id"
+ FROM "ee_accesscontrol"
+ INNER JOIN "posthog_team" ON ("ee_accesscontrol"."team_id" = "posthog_team"."id")
+ LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id")
+ WHERE (("ee_accesscontrol"."organization_member_id" IS NULL
+ AND "ee_accesscontrol"."role_id" IS NULL
+ AND "ee_accesscontrol"."team_id" = 99999)
+ OR ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
+ AND "posthog_organizationmembership"."user_id" = 99999
+ AND "ee_accesscontrol"."role_id" IS NULL
+ AND "ee_accesscontrol"."team_id" = 99999))
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.40
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -8151,7 +8526,7 @@
ORDER BY "posthog_dashboarditem"."order" ASC
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.35
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.41
'''
SELECT "posthog_tag"."name" AS "tag__name"
FROM "posthog_taggeditem"
@@ -8159,7 +8534,7 @@
WHERE "posthog_taggeditem"."dashboard_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.36
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.42
'''
SELECT "posthog_user"."id",
"posthog_user"."password",
@@ -8205,7 +8580,7 @@
AND "posthog_user"."id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.37
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.43
'''
SELECT "posthog_organization"."id",
"posthog_organization"."name",
@@ -8249,7 +8624,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.38
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.44
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -8389,7 +8764,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.39
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.45
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -8442,32 +8817,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.4
- '''
- SELECT "ee_accesscontrol"."id",
- "ee_accesscontrol"."team_id",
- "ee_accesscontrol"."access_level",
- "ee_accesscontrol"."resource",
- "ee_accesscontrol"."resource_id",
- "ee_accesscontrol"."organization_member_id",
- "ee_accesscontrol"."role_id",
- "ee_accesscontrol"."created_by_id",
- "ee_accesscontrol"."created_at",
- "ee_accesscontrol"."updated_at",
- "posthog_team"."organization_id" AS "_team_organization_id"
- FROM "ee_accesscontrol"
- INNER JOIN "posthog_team" ON ("ee_accesscontrol"."team_id" = "posthog_team"."id")
- LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id")
- WHERE (("ee_accesscontrol"."organization_member_id" IS NULL
- AND "ee_accesscontrol"."role_id" IS NULL
- AND "ee_accesscontrol"."team_id" = 99999)
- OR ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
- AND "posthog_organizationmembership"."user_id" = 99999
- AND "ee_accesscontrol"."role_id" IS NULL
- AND "ee_accesscontrol"."team_id" = 99999))
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.40
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.46
'''
SELECT "ee_accesscontrol"."id",
"ee_accesscontrol"."team_id",
@@ -8492,7 +8842,7 @@
AND "ee_accesscontrol"."team_id" = 99999))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.41
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.47
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -8543,7 +8893,7 @@
WHERE "posthog_organizationmembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.42
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.48
'''
SELECT "ee_accesscontrol"."team_id" AS "team_id",
"ee_accesscontrol"."resource_id" AS "resource_id",
@@ -8556,7 +8906,7 @@
AND "posthog_team"."organization_id" IN ('00000000-0000-0000-0000-000000000000'::uuid))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.43
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.49
'''
SELECT "ee_role"."organization_id" AS "role__organization_id",
"ee_rolemembership"."role_id" AS "role_id"
@@ -8565,7 +8915,58 @@
WHERE "ee_rolemembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.44
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.5
+ '''
+ SELECT "posthog_organizationmembership"."id",
+ "posthog_organizationmembership"."organization_id",
+ "posthog_organizationmembership"."user_id",
+ "posthog_organizationmembership"."level",
+ "posthog_organizationmembership"."joined_at",
+ "posthog_organizationmembership"."updated_at",
+ "posthog_organizationmembership"."invited_by_id",
+ "posthog_organization"."id",
+ "posthog_organization"."name",
+ "posthog_organization"."slug",
+ "posthog_organization"."logo_media_id",
+ "posthog_organization"."created_at",
+ "posthog_organization"."updated_at",
+ "posthog_organization"."is_active",
+ "posthog_organization"."is_not_active_reason",
+ "posthog_organization"."session_cookie_age",
+ "posthog_organization"."is_member_join_email_enabled",
+ "posthog_organization"."is_ai_data_processing_approved",
+ "posthog_organization"."is_ai_training_opted_in",
+ "posthog_organization"."is_ai_training_locked",
+ "posthog_organization"."is_ai_training_cta_shown",
+ "posthog_organization"."enforce_2fa",
+ "posthog_organization"."enforce_verified_domains",
+ "posthog_organization"."members_can_invite",
+ "posthog_organization"."members_can_create_projects",
+ "posthog_organization"."members_can_use_personal_api_keys",
+ "posthog_organization"."members_can_see_org_members",
+ "posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."default_role_id",
+ "posthog_organization"."plugins_access_level",
+ "posthog_organization"."for_internal_metrics",
+ "posthog_organization"."default_experiment_stats_method",
+ "posthog_organization"."default_anonymize_ips",
+ "posthog_organization"."is_hipaa",
+ "posthog_organization"."is_pending_deletion",
+ "posthog_organization"."customer_id",
+ "posthog_organization"."available_product_features",
+ "posthog_organization"."usage",
+ "posthog_organization"."never_drop_data",
+ "posthog_organization"."customer_trust_scores",
+ "posthog_organization"."setup_section_2_completed",
+ "posthog_organization"."personalization",
+ "posthog_organization"."domain_whitelist",
+ "posthog_organization"."is_platform"
+ FROM "posthog_organizationmembership"
+ INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")
+ WHERE "posthog_organizationmembership"."user_id" = 99999
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.50
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -8602,7 +9003,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.45
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.51
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -8639,7 +9040,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.46
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.52
'''
SELECT COUNT(*) AS "__count"
FROM "posthog_dashboardtile"
@@ -8652,7 +9053,7 @@
AND "posthog_dashboardtile"."deleted" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.47
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.53
'''
SELECT COUNT(*) AS "__count"
FROM "posthog_dashboardtile"
@@ -8665,7 +9066,7 @@
AND "posthog_dashboardtile"."deleted" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.48
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.54
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -8697,7 +9098,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.49
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.55
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -8799,85 +9200,34 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.5
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.56
'''
- SELECT "posthog_organizationmembership"."id",
- "posthog_organizationmembership"."organization_id",
- "posthog_organizationmembership"."user_id",
- "posthog_organizationmembership"."level",
- "posthog_organizationmembership"."joined_at",
- "posthog_organizationmembership"."updated_at",
- "posthog_organizationmembership"."invited_by_id",
- "posthog_organization"."id",
- "posthog_organization"."name",
- "posthog_organization"."slug",
- "posthog_organization"."logo_media_id",
- "posthog_organization"."created_at",
- "posthog_organization"."updated_at",
- "posthog_organization"."is_active",
- "posthog_organization"."is_not_active_reason",
- "posthog_organization"."session_cookie_age",
- "posthog_organization"."is_member_join_email_enabled",
- "posthog_organization"."is_ai_data_processing_approved",
- "posthog_organization"."is_ai_training_opted_in",
- "posthog_organization"."is_ai_training_locked",
- "posthog_organization"."is_ai_training_cta_shown",
- "posthog_organization"."enforce_2fa",
- "posthog_organization"."enforce_verified_domains",
- "posthog_organization"."members_can_invite",
- "posthog_organization"."members_can_create_projects",
- "posthog_organization"."members_can_use_personal_api_keys",
- "posthog_organization"."members_can_see_org_members",
- "posthog_organization"."allow_publicly_shared_resources",
- "posthog_organization"."default_role_id",
- "posthog_organization"."plugins_access_level",
- "posthog_organization"."for_internal_metrics",
- "posthog_organization"."default_experiment_stats_method",
- "posthog_organization"."default_anonymize_ips",
- "posthog_organization"."is_hipaa",
- "posthog_organization"."is_pending_deletion",
- "posthog_organization"."customer_id",
- "posthog_organization"."available_product_features",
- "posthog_organization"."usage",
- "posthog_organization"."never_drop_data",
- "posthog_organization"."customer_trust_scores",
- "posthog_organization"."setup_section_2_completed",
- "posthog_organization"."personalization",
- "posthog_organization"."domain_whitelist",
- "posthog_organization"."is_platform"
- FROM "posthog_organizationmembership"
- INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")
- WHERE "posthog_organizationmembership"."user_id" = 99999
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.50
- '''
- SELECT "posthog_filesystem"."team_id",
- "posthog_filesystem"."id",
- "posthog_filesystem"."path",
- "posthog_filesystem"."depth",
- "posthog_filesystem"."type",
- "posthog_filesystem"."ref",
- "posthog_filesystem"."href",
- "posthog_filesystem"."shortcut",
- "posthog_filesystem"."meta",
- "posthog_filesystem"."created_at",
- "posthog_filesystem"."created_by_id",
- "posthog_filesystem"."surface",
- "posthog_filesystem"."project_id"
- FROM "posthog_filesystem"
- WHERE (("posthog_filesystem"."surface" IS NULL
- OR "posthog_filesystem"."surface" = 'web')
- AND "posthog_filesystem"."ref" = '0001'
- AND "posthog_filesystem"."team_id" = 99999
- AND "posthog_filesystem"."type" = 'insight'
- AND NOT ("posthog_filesystem"."shortcut"
- AND "posthog_filesystem"."shortcut" IS NOT NULL))
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.51
- '''
- SELECT "posthog_organization"."id",
+ SELECT "posthog_filesystem"."team_id",
+ "posthog_filesystem"."id",
+ "posthog_filesystem"."path",
+ "posthog_filesystem"."depth",
+ "posthog_filesystem"."type",
+ "posthog_filesystem"."ref",
+ "posthog_filesystem"."href",
+ "posthog_filesystem"."shortcut",
+ "posthog_filesystem"."meta",
+ "posthog_filesystem"."created_at",
+ "posthog_filesystem"."created_by_id",
+ "posthog_filesystem"."surface",
+ "posthog_filesystem"."project_id"
+ FROM "posthog_filesystem"
+ WHERE (("posthog_filesystem"."surface" IS NULL
+ OR "posthog_filesystem"."surface" = 'web')
+ AND "posthog_filesystem"."ref" = '0001'
+ AND "posthog_filesystem"."team_id" = 99999
+ AND "posthog_filesystem"."type" = 'insight'
+ AND NOT ("posthog_filesystem"."shortcut"
+ AND "posthog_filesystem"."shortcut" IS NOT NULL))
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.57
+ '''
+ SELECT "posthog_organization"."id",
"posthog_organization"."name",
"posthog_organization"."slug",
"posthog_organization"."logo_media_id",
@@ -8919,7 +9269,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.52
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.58
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -9021,7 +9371,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.53
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.59
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -9048,7 +9398,20 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.54
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.6
+ '''
+ SELECT "ee_accesscontrol"."team_id" AS "team_id",
+ "ee_accesscontrol"."resource_id" AS "resource_id",
+ "ee_accesscontrol"."organization_member_id" AS "organization_member_id",
+ "ee_accesscontrol"."role_id" AS "role_id",
+ "ee_accesscontrol"."access_level" AS "access_level"
+ FROM "ee_accesscontrol"
+ INNER JOIN "posthog_team" ON ("ee_accesscontrol"."team_id" = "posthog_team"."id")
+ WHERE ("ee_accesscontrol"."resource" = 'project'
+ AND "posthog_team"."organization_id" IN ('00000000-0000-0000-0000-000000000000'::uuid))
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.60
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -9075,7 +9438,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.55
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.61
'''
SELECT "posthog_insightvariable"."created_by_id",
"posthog_insightvariable"."created_at",
@@ -9094,7 +9457,7 @@
WHERE "posthog_insightvariable"."team_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.56
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.62
'''
SELECT "posthog_dashboardtile"."dashboard_id" AS "dashboard_id"
FROM "posthog_dashboardtile"
@@ -9105,7 +9468,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.57
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.63
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -9137,7 +9500,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.58
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.64
'''
SELECT "posthog_tag"."name" AS "tag__name"
FROM "posthog_taggeditem"
@@ -9145,7 +9508,7 @@
WHERE "posthog_taggeditem"."insight_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.59
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.65
'''
SELECT "posthog_user"."id",
"posthog_user"."password",
@@ -9191,20 +9554,7 @@
AND "posthog_user"."id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.6
- '''
- SELECT "ee_accesscontrol"."team_id" AS "team_id",
- "ee_accesscontrol"."resource_id" AS "resource_id",
- "ee_accesscontrol"."organization_member_id" AS "organization_member_id",
- "ee_accesscontrol"."role_id" AS "role_id",
- "ee_accesscontrol"."access_level" AS "access_level"
- FROM "ee_accesscontrol"
- INNER JOIN "posthog_team" ON ("ee_accesscontrol"."team_id" = "posthog_team"."id")
- WHERE ("ee_accesscontrol"."resource" = 'project'
- AND "posthog_team"."organization_id" IN ('00000000-0000-0000-0000-000000000000'::uuid))
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.60
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.66
'''
SELECT "posthog_organization"."id",
"posthog_organization"."name",
@@ -9248,7 +9598,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.61
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.67
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -9388,7 +9738,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.62
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.68
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -9441,7 +9791,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.63
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.69
'''
SELECT "ee_accesscontrol"."id",
"ee_accesscontrol"."team_id",
@@ -9466,7 +9816,16 @@
AND "ee_accesscontrol"."team_id" = 99999))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.64
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.7
+ '''
+ SELECT "ee_role"."organization_id" AS "role__organization_id",
+ "ee_rolemembership"."role_id" AS "role_id"
+ FROM "ee_rolemembership"
+ INNER JOIN "ee_role" ON ("ee_rolemembership"."role_id" = "ee_role"."id")
+ WHERE "ee_rolemembership"."user_id" = 99999
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.70
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -9517,7 +9876,7 @@
WHERE "posthog_organizationmembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.65
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.71
'''
SELECT "ee_accesscontrol"."team_id" AS "team_id",
"ee_accesscontrol"."resource_id" AS "resource_id",
@@ -9530,7 +9889,7 @@
AND "posthog_team"."organization_id" IN ('00000000-0000-0000-0000-000000000000'::uuid))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.66
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.72
'''
SELECT "ee_role"."organization_id" AS "role__organization_id",
"ee_rolemembership"."role_id" AS "role_id"
@@ -9539,7 +9898,7 @@
WHERE "ee_rolemembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.67
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.73
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -9576,7 +9935,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.68
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.74
'''
SELECT COUNT(*) AS "__count"
FROM "posthog_dashboardtile"
@@ -9589,7 +9948,7 @@
AND "posthog_dashboardtile"."deleted" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.69
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.75
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -9621,16 +9980,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.7
- '''
- SELECT "ee_role"."organization_id" AS "role__organization_id",
- "ee_rolemembership"."role_id" AS "role_id"
- FROM "ee_rolemembership"
- INNER JOIN "ee_role" ON ("ee_rolemembership"."role_id" = "ee_role"."id")
- WHERE "ee_rolemembership"."user_id" = 99999
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.70
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.76
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -9732,7 +10082,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.71
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.77
'''
SELECT "posthog_filesystem"."team_id",
"posthog_filesystem"."id",
@@ -9757,7 +10107,7 @@
AND "posthog_filesystem"."shortcut" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.72
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.78
'''
SELECT "posthog_organization"."id",
"posthog_organization"."name",
@@ -9801,7 +10151,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.73
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.79
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -9903,7 +10253,23 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.74
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.8
+ '''
+ SELECT COUNT(*) AS "__count"
+ FROM "posthog_dashboard"
+ INNER JOIN "posthog_team" ON ("posthog_dashboard"."team_id" = "posthog_team"."id")
+ WHERE (NOT ("posthog_dashboard"."deleted")
+ AND ("posthog_dashboard"."team_id" =
+ (SELECT U0."parent_team_id" AS "parent_team_id"
+ FROM "posthog_team" U0
+ WHERE U0."id" = 99999
+ LIMIT 1)
+ OR ("posthog_team"."parent_team_id" IS NULL
+ AND "posthog_dashboard"."team_id" = 99999))
+ AND NOT "posthog_dashboard"."deleted")
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.80
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -9930,7 +10296,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.75
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.81
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -9957,7 +10323,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.76
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.82
'''
SELECT "posthog_insightvariable"."created_by_id",
"posthog_insightvariable"."created_at",
@@ -9976,7 +10342,7 @@
WHERE "posthog_insightvariable"."team_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.77
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.83
'''
SELECT "posthog_dashboardtile"."dashboard_id" AS "dashboard_id"
FROM "posthog_dashboardtile"
@@ -9987,7 +10353,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.78
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.84
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -10019,7 +10385,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.79
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.85
'''
SELECT "posthog_tag"."name" AS "tag__name"
FROM "posthog_taggeditem"
@@ -10027,23 +10393,7 @@
WHERE "posthog_taggeditem"."insight_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.8
- '''
- SELECT COUNT(*) AS "__count"
- FROM "posthog_dashboard"
- INNER JOIN "posthog_team" ON ("posthog_dashboard"."team_id" = "posthog_team"."id")
- WHERE (NOT ("posthog_dashboard"."deleted")
- AND ("posthog_dashboard"."team_id" =
- (SELECT U0."parent_team_id" AS "parent_team_id"
- FROM "posthog_team" U0
- WHERE U0."id" = 99999
- LIMIT 1)
- OR ("posthog_team"."parent_team_id" IS NULL
- AND "posthog_dashboard"."team_id" = 99999))
- AND NOT "posthog_dashboard"."deleted")
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.80
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.86
'''
SELECT "posthog_user"."id",
"posthog_user"."password",
@@ -10089,7 +10439,7 @@
AND "posthog_user"."id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.81
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.87
'''
SELECT "posthog_organization"."id",
"posthog_organization"."name",
@@ -10133,7 +10483,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.82
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.88
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -10273,7 +10623,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.83
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.89
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -10326,155 +10676,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.84
- '''
- SELECT "ee_accesscontrol"."id",
- "ee_accesscontrol"."team_id",
- "ee_accesscontrol"."access_level",
- "ee_accesscontrol"."resource",
- "ee_accesscontrol"."resource_id",
- "ee_accesscontrol"."organization_member_id",
- "ee_accesscontrol"."role_id",
- "ee_accesscontrol"."created_by_id",
- "ee_accesscontrol"."created_at",
- "ee_accesscontrol"."updated_at",
- "posthog_team"."organization_id" AS "_team_organization_id"
- FROM "ee_accesscontrol"
- INNER JOIN "posthog_team" ON ("ee_accesscontrol"."team_id" = "posthog_team"."id")
- LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id")
- WHERE (("ee_accesscontrol"."organization_member_id" IS NULL
- AND "ee_accesscontrol"."role_id" IS NULL
- AND "ee_accesscontrol"."team_id" = 99999)
- OR ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
- AND "posthog_organizationmembership"."user_id" = 99999
- AND "ee_accesscontrol"."role_id" IS NULL
- AND "ee_accesscontrol"."team_id" = 99999))
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.85
- '''
- SELECT "posthog_organizationmembership"."id",
- "posthog_organizationmembership"."organization_id",
- "posthog_organizationmembership"."user_id",
- "posthog_organizationmembership"."level",
- "posthog_organizationmembership"."joined_at",
- "posthog_organizationmembership"."updated_at",
- "posthog_organizationmembership"."invited_by_id",
- "posthog_organization"."id",
- "posthog_organization"."name",
- "posthog_organization"."slug",
- "posthog_organization"."logo_media_id",
- "posthog_organization"."created_at",
- "posthog_organization"."updated_at",
- "posthog_organization"."is_active",
- "posthog_organization"."is_not_active_reason",
- "posthog_organization"."session_cookie_age",
- "posthog_organization"."is_member_join_email_enabled",
- "posthog_organization"."is_ai_data_processing_approved",
- "posthog_organization"."is_ai_training_opted_in",
- "posthog_organization"."is_ai_training_locked",
- "posthog_organization"."is_ai_training_cta_shown",
- "posthog_organization"."enforce_2fa",
- "posthog_organization"."enforce_verified_domains",
- "posthog_organization"."members_can_invite",
- "posthog_organization"."members_can_create_projects",
- "posthog_organization"."members_can_use_personal_api_keys",
- "posthog_organization"."members_can_see_org_members",
- "posthog_organization"."allow_publicly_shared_resources",
- "posthog_organization"."default_role_id",
- "posthog_organization"."plugins_access_level",
- "posthog_organization"."for_internal_metrics",
- "posthog_organization"."default_experiment_stats_method",
- "posthog_organization"."default_anonymize_ips",
- "posthog_organization"."is_hipaa",
- "posthog_organization"."is_pending_deletion",
- "posthog_organization"."customer_id",
- "posthog_organization"."available_product_features",
- "posthog_organization"."usage",
- "posthog_organization"."never_drop_data",
- "posthog_organization"."customer_trust_scores",
- "posthog_organization"."setup_section_2_completed",
- "posthog_organization"."personalization",
- "posthog_organization"."domain_whitelist",
- "posthog_organization"."is_platform"
- FROM "posthog_organizationmembership"
- INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")
- WHERE "posthog_organizationmembership"."user_id" = 99999
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.86
- '''
- SELECT "ee_accesscontrol"."team_id" AS "team_id",
- "ee_accesscontrol"."resource_id" AS "resource_id",
- "ee_accesscontrol"."organization_member_id" AS "organization_member_id",
- "ee_accesscontrol"."role_id" AS "role_id",
- "ee_accesscontrol"."access_level" AS "access_level"
- FROM "ee_accesscontrol"
- INNER JOIN "posthog_team" ON ("ee_accesscontrol"."team_id" = "posthog_team"."id")
- WHERE ("ee_accesscontrol"."resource" = 'project'
- AND "posthog_team"."organization_id" IN ('00000000-0000-0000-0000-000000000000'::uuid))
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.87
- '''
- SELECT "ee_role"."organization_id" AS "role__organization_id",
- "ee_rolemembership"."role_id" AS "role_id"
- FROM "ee_rolemembership"
- INNER JOIN "ee_role" ON ("ee_rolemembership"."role_id" = "ee_role"."id")
- WHERE "ee_rolemembership"."user_id" = 99999
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.88
- '''
- SELECT "posthog_dashboard"."id",
- "posthog_dashboard"."name",
- "posthog_dashboard"."description",
- "posthog_dashboard"."team_id",
- "posthog_dashboard"."pinned",
- "posthog_dashboard"."created_at",
- "posthog_dashboard"."created_by_id",
- "posthog_dashboard"."deleted",
- "posthog_dashboard"."last_accessed_at",
- "posthog_dashboard"."last_refresh",
- "posthog_dashboard"."filters",
- "posthog_dashboard"."variables",
- "posthog_dashboard"."breakdown_colors",
- "posthog_dashboard"."data_color_theme_id",
- "posthog_dashboard"."creation_mode",
- "posthog_dashboard"."restriction_level",
- "posthog_dashboard"."quick_filter_ids",
- "posthog_dashboard"."deprecated_tags",
- "posthog_dashboard"."tags",
- "posthog_dashboard"."share_token",
- "posthog_dashboard"."is_shared"
- FROM "posthog_dashboard"
- INNER JOIN "posthog_team" ON ("posthog_dashboard"."team_id" = "posthog_team"."id")
- WHERE (NOT ("posthog_dashboard"."deleted")
- AND ("posthog_dashboard"."team_id" =
- (SELECT U0."parent_team_id" AS "parent_team_id"
- FROM "posthog_team" U0
- WHERE U0."id" = 99999
- LIMIT 1)
- OR ("posthog_team"."parent_team_id" IS NULL
- AND "posthog_dashboard"."team_id" = 99999))
- AND "posthog_dashboard"."id" = 99999)
- LIMIT 21
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.89
- '''
- SELECT COUNT(*) AS "__count"
- FROM "posthog_dashboardtile"
- INNER JOIN "posthog_dashboard" ON ("posthog_dashboardtile"."dashboard_id" = "posthog_dashboard"."id")
- WHERE (NOT ("posthog_dashboardtile"."deleted"
- AND "posthog_dashboardtile"."deleted" IS NOT NULL)
- AND NOT ("posthog_dashboard"."deleted")
- AND "posthog_dashboardtile"."dashboard_id" = 99999
- AND NOT ("posthog_dashboardtile"."deleted"
- AND "posthog_dashboardtile"."deleted" IS NOT NULL))
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.9
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.9
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -10578,166 +10780,39 @@
# ---
# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.90
'''
- SELECT "posthog_dashboard"."id",
- "posthog_dashboard"."name",
- "posthog_dashboard"."description",
- "posthog_dashboard"."team_id",
- "posthog_dashboard"."pinned",
- "posthog_dashboard"."created_at",
- "posthog_dashboard"."created_by_id",
- "posthog_dashboard"."deleted",
- "posthog_dashboard"."last_accessed_at",
- "posthog_dashboard"."last_refresh",
- "posthog_dashboard"."filters",
- "posthog_dashboard"."variables",
- "posthog_dashboard"."breakdown_colors",
- "posthog_dashboard"."data_color_theme_id",
- "posthog_dashboard"."creation_mode",
- "posthog_dashboard"."restriction_level",
- "posthog_dashboard"."quick_filter_ids",
- "posthog_dashboard"."deprecated_tags",
- "posthog_dashboard"."tags",
- "posthog_dashboard"."share_token",
- "posthog_dashboard"."is_shared"
- FROM "posthog_dashboard"
- WHERE (NOT ("posthog_dashboard"."deleted")
- AND "posthog_dashboard"."id" IN (1,
- 2,
- 3,
- 4,
- 5 /* ... */))
+ SELECT "ee_accesscontrol"."id",
+ "ee_accesscontrol"."team_id",
+ "ee_accesscontrol"."access_level",
+ "ee_accesscontrol"."resource",
+ "ee_accesscontrol"."resource_id",
+ "ee_accesscontrol"."organization_member_id",
+ "ee_accesscontrol"."role_id",
+ "ee_accesscontrol"."created_by_id",
+ "ee_accesscontrol"."created_at",
+ "ee_accesscontrol"."updated_at",
+ "posthog_team"."organization_id" AS "_team_organization_id"
+ FROM "ee_accesscontrol"
+ INNER JOIN "posthog_team" ON ("ee_accesscontrol"."team_id" = "posthog_team"."id")
+ LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id")
+ WHERE (("ee_accesscontrol"."organization_member_id" IS NULL
+ AND "ee_accesscontrol"."role_id" IS NULL
+ AND "ee_accesscontrol"."team_id" = 99999)
+ OR ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
+ AND "posthog_organizationmembership"."user_id" = 99999
+ AND "ee_accesscontrol"."role_id" IS NULL
+ AND "ee_accesscontrol"."team_id" = 99999))
'''
# ---
# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.91
'''
- SELECT "posthog_team"."id",
- "posthog_team"."uuid",
- "posthog_team"."organization_id",
- "posthog_team"."parent_team_id",
- "posthog_team"."project_id",
- "posthog_team"."api_token",
- "posthog_team"."app_urls",
- "posthog_team"."name",
- "posthog_team"."slack_incoming_webhook",
- "posthog_team"."created_at",
- "posthog_team"."updated_at",
- "posthog_team"."anonymize_ips",
- "posthog_team"."completed_snippet_onboarding",
- "posthog_team"."has_completed_onboarding_for",
- "posthog_team"."onboarding_tasks",
- "posthog_team"."ingested_event",
- "posthog_team"."ingested_production_event",
- "posthog_team"."ingested_production_event_last_checked_at",
- "posthog_team"."person_processing_opt_out",
- "posthog_team"."secret_api_token",
- "posthog_team"."secret_api_token_backup",
- "posthog_team"."session_recording_opt_in",
- "posthog_team"."session_recording_sample_rate",
- "posthog_team"."session_recording_minimum_duration_milliseconds",
- "posthog_team"."session_recording_linked_flag",
- "posthog_team"."session_recording_network_payload_capture_config",
- "posthog_team"."session_recording_masking_config",
- "posthog_team"."session_recording_url_trigger_config",
- "posthog_team"."session_recording_url_blocklist_config",
- "posthog_team"."session_recording_event_trigger_config",
- "posthog_team"."session_recording_trigger_match_type_config",
- "posthog_team"."session_recording_trigger_groups",
- "posthog_team"."session_replay_config",
- "posthog_team"."session_recording_retention_period",
- "posthog_team"."event_retention_months",
- "posthog_team"."conversations_enabled",
- "posthog_team"."conversations_settings",
- "posthog_team"."proactive_tasks_enabled",
- "posthog_team"."survey_config",
- "posthog_team"."surveys_opt_in",
- "posthog_team"."product_tours_opt_in",
- "posthog_team"."capture_console_log_opt_in",
- "posthog_team"."capture_performance_opt_in",
- "posthog_team"."capture_dead_clicks",
- "posthog_team"."autocapture_opt_out",
- "posthog_team"."autocapture_web_vitals_opt_in",
- "posthog_team"."autocapture_web_vitals_allowed_metrics",
- "posthog_team"."autocapture_exceptions_opt_in",
- "posthog_team"."autocapture_exceptions_errors_to_ignore",
- "posthog_team"."logs_settings",
- "posthog_team"."llm_gateway_enabled_at",
- "posthog_team"."llm_gateway_revoked_at",
- "posthog_team"."llm_gateway_overspend_allowance_usd",
- "posthog_team"."heatmaps_opt_in",
- "posthog_team"."receive_org_level_activity_logs",
- "posthog_team"."web_analytics_pre_aggregated_tables_enabled",
- "posthog_team"."web_analytics_pre_aggregated_tables_version",
- "posthog_team"."flags_persistence_default",
- "posthog_team"."feature_flag_confirmation_enabled",
- "posthog_team"."feature_flag_confirmation_message",
- "posthog_team"."default_evaluation_environments_enabled",
- "posthog_team"."require_evaluation_environment_tags",
- "posthog_team"."default_evaluation_contexts_enabled",
- "posthog_team"."require_evaluation_contexts",
- "posthog_team"."session_recording_version",
- "posthog_team"."signup_token",
- "posthog_team"."is_demo",
- "posthog_team"."access_control",
- "posthog_team"."week_start_day",
- "posthog_team"."inject_web_apps",
- "posthog_team"."test_account_filters",
- "posthog_team"."test_account_filters_default_checked",
- "posthog_team"."path_cleaning_filters",
- "posthog_team"."timezone",
- "posthog_team"."data_attributes",
- "posthog_team"."person_display_name_properties",
- "posthog_team"."live_events_columns",
- "posthog_team"."recording_domains",
- "posthog_team"."human_friendly_comparison_periods",
- "posthog_team"."cookieless_server_hash_mode",
- "posthog_team"."primary_dashboard_id",
- "posthog_team"."default_data_theme",
- "posthog_team"."extra_settings",
- "posthog_team"."modifiers",
- "posthog_team"."correlation_config",
- "posthog_team"."session_recording_retention_period_days",
- "posthog_team"."external_data_workspace_id",
- "posthog_team"."external_data_workspace_last_synced_at",
- "posthog_team"."api_query_rate_limit",
- "posthog_team"."drop_events_older_than",
- "posthog_team"."base_currency",
- "posthog_team"."experiment_recalculation_time",
- "posthog_team"."default_experiment_confidence_level",
- "posthog_team"."default_experiment_stats_method",
- "posthog_team"."business_model"
- FROM "posthog_team"
- WHERE "posthog_team"."id" = 99999
- LIMIT 21
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.92
- '''
- SELECT "posthog_filesystem"."team_id",
- "posthog_filesystem"."id",
- "posthog_filesystem"."path",
- "posthog_filesystem"."depth",
- "posthog_filesystem"."type",
- "posthog_filesystem"."ref",
- "posthog_filesystem"."href",
- "posthog_filesystem"."shortcut",
- "posthog_filesystem"."meta",
- "posthog_filesystem"."created_at",
- "posthog_filesystem"."created_by_id",
- "posthog_filesystem"."surface",
- "posthog_filesystem"."project_id"
- FROM "posthog_filesystem"
- WHERE (("posthog_filesystem"."surface" IS NULL
- OR "posthog_filesystem"."surface" = 'web')
- AND "posthog_filesystem"."ref" = '0001'
- AND "posthog_filesystem"."team_id" = 99999
- AND "posthog_filesystem"."type" = 'insight'
- AND NOT ("posthog_filesystem"."shortcut"
- AND "posthog_filesystem"."shortcut" IS NOT NULL))
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.93
- '''
- SELECT "posthog_organization"."id",
+ SELECT "posthog_organizationmembership"."id",
+ "posthog_organizationmembership"."organization_id",
+ "posthog_organizationmembership"."user_id",
+ "posthog_organizationmembership"."level",
+ "posthog_organizationmembership"."joined_at",
+ "posthog_organizationmembership"."updated_at",
+ "posthog_organizationmembership"."invited_by_id",
+ "posthog_organization"."id",
"posthog_organization"."name",
"posthog_organization"."slug",
"posthog_organization"."logo_media_id",
@@ -10774,12 +10849,116 @@
"posthog_organization"."personalization",
"posthog_organization"."domain_whitelist",
"posthog_organization"."is_platform"
- FROM "posthog_organization"
- WHERE "posthog_organization"."id" = '00000000-0000-0000-0000-000000000000'::uuid
- LIMIT 21
+ FROM "posthog_organizationmembership"
+ INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")
+ WHERE "posthog_organizationmembership"."user_id" = 99999
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.92
+ '''
+ SELECT "ee_accesscontrol"."team_id" AS "team_id",
+ "ee_accesscontrol"."resource_id" AS "resource_id",
+ "ee_accesscontrol"."organization_member_id" AS "organization_member_id",
+ "ee_accesscontrol"."role_id" AS "role_id",
+ "ee_accesscontrol"."access_level" AS "access_level"
+ FROM "ee_accesscontrol"
+ INNER JOIN "posthog_team" ON ("ee_accesscontrol"."team_id" = "posthog_team"."id")
+ WHERE ("ee_accesscontrol"."resource" = 'project'
+ AND "posthog_team"."organization_id" IN ('00000000-0000-0000-0000-000000000000'::uuid))
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.93
+ '''
+ SELECT "ee_role"."organization_id" AS "role__organization_id",
+ "ee_rolemembership"."role_id" AS "role_id"
+ FROM "ee_rolemembership"
+ INNER JOIN "ee_role" ON ("ee_rolemembership"."role_id" = "ee_role"."id")
+ WHERE "ee_rolemembership"."user_id" = 99999
'''
# ---
# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.94
+ '''
+ SELECT "posthog_dashboard"."id",
+ "posthog_dashboard"."name",
+ "posthog_dashboard"."description",
+ "posthog_dashboard"."team_id",
+ "posthog_dashboard"."pinned",
+ "posthog_dashboard"."created_at",
+ "posthog_dashboard"."created_by_id",
+ "posthog_dashboard"."deleted",
+ "posthog_dashboard"."last_accessed_at",
+ "posthog_dashboard"."last_refresh",
+ "posthog_dashboard"."filters",
+ "posthog_dashboard"."variables",
+ "posthog_dashboard"."breakdown_colors",
+ "posthog_dashboard"."data_color_theme_id",
+ "posthog_dashboard"."creation_mode",
+ "posthog_dashboard"."restriction_level",
+ "posthog_dashboard"."quick_filter_ids",
+ "posthog_dashboard"."deprecated_tags",
+ "posthog_dashboard"."tags",
+ "posthog_dashboard"."share_token",
+ "posthog_dashboard"."is_shared"
+ FROM "posthog_dashboard"
+ INNER JOIN "posthog_team" ON ("posthog_dashboard"."team_id" = "posthog_team"."id")
+ WHERE (NOT ("posthog_dashboard"."deleted")
+ AND ("posthog_dashboard"."team_id" =
+ (SELECT U0."parent_team_id" AS "parent_team_id"
+ FROM "posthog_team" U0
+ WHERE U0."id" = 99999
+ LIMIT 1)
+ OR ("posthog_team"."parent_team_id" IS NULL
+ AND "posthog_dashboard"."team_id" = 99999))
+ AND "posthog_dashboard"."id" = 99999)
+ LIMIT 21
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.95
+ '''
+ SELECT COUNT(*) AS "__count"
+ FROM "posthog_dashboardtile"
+ INNER JOIN "posthog_dashboard" ON ("posthog_dashboardtile"."dashboard_id" = "posthog_dashboard"."id")
+ WHERE (NOT ("posthog_dashboardtile"."deleted"
+ AND "posthog_dashboardtile"."deleted" IS NOT NULL)
+ AND NOT ("posthog_dashboard"."deleted")
+ AND "posthog_dashboardtile"."dashboard_id" = 99999
+ AND NOT ("posthog_dashboardtile"."deleted"
+ AND "posthog_dashboardtile"."deleted" IS NOT NULL))
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.96
+ '''
+ SELECT "posthog_dashboard"."id",
+ "posthog_dashboard"."name",
+ "posthog_dashboard"."description",
+ "posthog_dashboard"."team_id",
+ "posthog_dashboard"."pinned",
+ "posthog_dashboard"."created_at",
+ "posthog_dashboard"."created_by_id",
+ "posthog_dashboard"."deleted",
+ "posthog_dashboard"."last_accessed_at",
+ "posthog_dashboard"."last_refresh",
+ "posthog_dashboard"."filters",
+ "posthog_dashboard"."variables",
+ "posthog_dashboard"."breakdown_colors",
+ "posthog_dashboard"."data_color_theme_id",
+ "posthog_dashboard"."creation_mode",
+ "posthog_dashboard"."restriction_level",
+ "posthog_dashboard"."quick_filter_ids",
+ "posthog_dashboard"."deprecated_tags",
+ "posthog_dashboard"."tags",
+ "posthog_dashboard"."share_token",
+ "posthog_dashboard"."is_shared"
+ FROM "posthog_dashboard"
+ WHERE (NOT ("posthog_dashboard"."deleted")
+ AND "posthog_dashboard"."id" IN (1,
+ 2,
+ 3,
+ 4,
+ 5 /* ... */))
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.97
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -10873,128 +11052,81 @@
"posthog_team"."drop_events_older_than",
"posthog_team"."base_currency",
"posthog_team"."experiment_recalculation_time",
- "posthog_team"."default_experiment_confidence_level",
- "posthog_team"."default_experiment_stats_method",
- "posthog_team"."business_model"
- FROM "posthog_team"
- WHERE "posthog_team"."id" = 99999
- LIMIT 21
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.95
- '''
- SELECT "posthog_dashboardtile"."id",
- "posthog_dashboardtile"."dashboard_id",
- "posthog_dashboardtile"."insight_id",
- "posthog_dashboardtile"."text_id",
- "posthog_dashboardtile"."button_tile_id",
- "posthog_dashboardtile"."widget_id",
- "posthog_dashboardtile"."team_id",
- "posthog_dashboardtile"."layouts",
- "posthog_dashboardtile"."color",
- "posthog_dashboardtile"."filters_hash",
- "posthog_dashboardtile"."last_refresh",
- "posthog_dashboardtile"."refreshing",
- "posthog_dashboardtile"."refresh_attempt",
- "posthog_dashboardtile"."filters_overrides",
- "posthog_dashboardtile"."show_description",
- "posthog_dashboardtile"."transparent_background",
- "posthog_dashboardtile"."deleted"
- FROM "posthog_dashboardtile"
- INNER JOIN "posthog_dashboard" ON ("posthog_dashboardtile"."dashboard_id" = "posthog_dashboard"."id")
- WHERE (NOT ("posthog_dashboardtile"."deleted"
- AND "posthog_dashboardtile"."deleted" IS NOT NULL)
- AND NOT ("posthog_dashboard"."deleted")
- AND "posthog_dashboardtile"."insight_id" = 99999)
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.96
- '''
- SELECT "posthog_dashboardtile"."id",
- "posthog_dashboardtile"."dashboard_id",
- "posthog_dashboardtile"."insight_id",
- "posthog_dashboardtile"."text_id",
- "posthog_dashboardtile"."button_tile_id",
- "posthog_dashboardtile"."widget_id",
- "posthog_dashboardtile"."team_id",
- "posthog_dashboardtile"."layouts",
- "posthog_dashboardtile"."color",
- "posthog_dashboardtile"."filters_hash",
- "posthog_dashboardtile"."last_refresh",
- "posthog_dashboardtile"."refreshing",
- "posthog_dashboardtile"."refresh_attempt",
- "posthog_dashboardtile"."filters_overrides",
- "posthog_dashboardtile"."show_description",
- "posthog_dashboardtile"."transparent_background",
- "posthog_dashboardtile"."deleted"
- FROM "posthog_dashboardtile"
- INNER JOIN "posthog_dashboard" ON ("posthog_dashboardtile"."dashboard_id" = "posthog_dashboard"."id")
- WHERE (NOT ("posthog_dashboardtile"."deleted"
- AND "posthog_dashboardtile"."deleted" IS NOT NULL)
- AND NOT ("posthog_dashboard"."deleted")
- AND "posthog_dashboardtile"."insight_id" = 99999)
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.97
- '''
- SELECT "posthog_insightvariable"."created_by_id",
- "posthog_insightvariable"."created_at",
- "posthog_insightvariable"."updated_at",
- "posthog_insightvariable"."id",
- "posthog_insightvariable"."team_id",
- "posthog_insightvariable"."name",
- "posthog_insightvariable"."code_name",
- "posthog_insightvariable"."type",
- "posthog_insightvariable"."default_value",
- "posthog_insightvariable"."values",
- "posthog_insightvariable"."is_multi",
- "posthog_insightvariable"."values_query",
- "posthog_insightvariable"."values_query_connection_id"
- FROM "posthog_insightvariable"
- WHERE "posthog_insightvariable"."team_id" = 99999
+ "posthog_team"."default_experiment_confidence_level",
+ "posthog_team"."default_experiment_stats_method",
+ "posthog_team"."business_model"
+ FROM "posthog_team"
+ WHERE "posthog_team"."id" = 99999
+ LIMIT 21
'''
# ---
# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.98
'''
- SELECT "posthog_dashboardtile"."dashboard_id" AS "dashboard_id"
- FROM "posthog_dashboardtile"
- INNER JOIN "posthog_dashboard" ON ("posthog_dashboardtile"."dashboard_id" = "posthog_dashboard"."id")
- WHERE (NOT ("posthog_dashboardtile"."deleted"
- AND "posthog_dashboardtile"."deleted" IS NOT NULL)
- AND NOT ("posthog_dashboard"."deleted")
- AND "posthog_dashboardtile"."insight_id" = 99999)
+ SELECT "posthog_filesystem"."team_id",
+ "posthog_filesystem"."id",
+ "posthog_filesystem"."path",
+ "posthog_filesystem"."depth",
+ "posthog_filesystem"."type",
+ "posthog_filesystem"."ref",
+ "posthog_filesystem"."href",
+ "posthog_filesystem"."shortcut",
+ "posthog_filesystem"."meta",
+ "posthog_filesystem"."created_at",
+ "posthog_filesystem"."created_by_id",
+ "posthog_filesystem"."surface",
+ "posthog_filesystem"."project_id"
+ FROM "posthog_filesystem"
+ WHERE (("posthog_filesystem"."surface" IS NULL
+ OR "posthog_filesystem"."surface" = 'web')
+ AND "posthog_filesystem"."ref" = '0001'
+ AND "posthog_filesystem"."team_id" = 99999
+ AND "posthog_filesystem"."type" = 'insight'
+ AND NOT ("posthog_filesystem"."shortcut"
+ AND "posthog_filesystem"."shortcut" IS NOT NULL))
'''
# ---
# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.99
'''
- SELECT "posthog_dashboard"."id",
- "posthog_dashboard"."name",
- "posthog_dashboard"."description",
- "posthog_dashboard"."team_id",
- "posthog_dashboard"."pinned",
- "posthog_dashboard"."created_at",
- "posthog_dashboard"."created_by_id",
- "posthog_dashboard"."deleted",
- "posthog_dashboard"."last_accessed_at",
- "posthog_dashboard"."last_refresh",
- "posthog_dashboard"."filters",
- "posthog_dashboard"."variables",
- "posthog_dashboard"."breakdown_colors",
- "posthog_dashboard"."data_color_theme_id",
- "posthog_dashboard"."creation_mode",
- "posthog_dashboard"."restriction_level",
- "posthog_dashboard"."quick_filter_ids",
- "posthog_dashboard"."deprecated_tags",
- "posthog_dashboard"."tags",
- "posthog_dashboard"."share_token",
- "posthog_dashboard"."is_shared"
- FROM "posthog_dashboard"
- WHERE (NOT ("posthog_dashboard"."deleted")
- AND "posthog_dashboard"."id" IN (1,
- 2,
- 3,
- 4,
- 5 /* ... */))
+ SELECT "posthog_organization"."id",
+ "posthog_organization"."name",
+ "posthog_organization"."slug",
+ "posthog_organization"."logo_media_id",
+ "posthog_organization"."created_at",
+ "posthog_organization"."updated_at",
+ "posthog_organization"."is_active",
+ "posthog_organization"."is_not_active_reason",
+ "posthog_organization"."session_cookie_age",
+ "posthog_organization"."is_member_join_email_enabled",
+ "posthog_organization"."is_ai_data_processing_approved",
+ "posthog_organization"."is_ai_training_opted_in",
+ "posthog_organization"."is_ai_training_locked",
+ "posthog_organization"."is_ai_training_cta_shown",
+ "posthog_organization"."enforce_2fa",
+ "posthog_organization"."enforce_verified_domains",
+ "posthog_organization"."members_can_invite",
+ "posthog_organization"."members_can_create_projects",
+ "posthog_organization"."members_can_use_personal_api_keys",
+ "posthog_organization"."members_can_see_org_members",
+ "posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."default_role_id",
+ "posthog_organization"."plugins_access_level",
+ "posthog_organization"."for_internal_metrics",
+ "posthog_organization"."default_experiment_stats_method",
+ "posthog_organization"."default_anonymize_ips",
+ "posthog_organization"."is_hipaa",
+ "posthog_organization"."is_pending_deletion",
+ "posthog_organization"."customer_id",
+ "posthog_organization"."available_product_features",
+ "posthog_organization"."usage",
+ "posthog_organization"."never_drop_data",
+ "posthog_organization"."customer_trust_scores",
+ "posthog_organization"."setup_section_2_completed",
+ "posthog_organization"."personalization",
+ "posthog_organization"."domain_whitelist",
+ "posthog_organization"."is_platform"
+ FROM "posthog_organization"
+ WHERE "posthog_organization"."id" = '00000000-0000-0000-0000-000000000000'::uuid
+ LIMIT 21
'''
# ---
# name: TestDashboard.test_retrieve_dashboard
@@ -12385,6 +12517,18 @@
AND U0."shortcut" IS NOT NULL))
ORDER BY U0."id" ASC
LIMIT 1) AS "_folder_path",
+
+ (SELECT U0."id" AS "id"
+ FROM "posthog_filesystem" U0
+ WHERE ((U0."surface" IS NULL
+ OR U0."surface" = 'web')
+ AND U0."ref" = ("posthog_dashboard"."id")::varchar
+ AND U0."team_id" = ("posthog_dashboard"."team_id")
+ AND U0."type" = 'dashboard'
+ AND NOT (U0."shortcut"
+ AND U0."shortcut" IS NOT NULL))
+ ORDER BY 1 ASC
+ LIMIT 1) AS "_folder_id",
T6."id",
T6."password",
T6."last_login",
@@ -12592,6 +12736,54 @@
'''
# ---
# name: TestDashboard.test_retrieve_dashboard_list.14
+ '''
+ SELECT "posthog_filesystem"."id" AS "id",
+ "posthog_filesystem"."path" AS "path"
+ FROM "posthog_filesystem"
+ WHERE (("posthog_filesystem"."surface" IS NULL
+ OR "posthog_filesystem"."surface" = 'web')
+ AND "posthog_filesystem"."ref" = '0001'
+ AND "posthog_filesystem"."team_id" = 99999
+ AND "posthog_filesystem"."type" = 'dashboard'
+ AND NOT ("posthog_filesystem"."shortcut"
+ AND "posthog_filesystem"."shortcut" IS NOT NULL))
+ ORDER BY 1 ASC
+ LIMIT 1
+ '''
+# ---
+# name: TestDashboard.test_retrieve_dashboard_list.15
+ '''
+ SELECT "posthog_filesystem"."id" AS "id",
+ "posthog_filesystem"."path" AS "path"
+ FROM "posthog_filesystem"
+ WHERE (("posthog_filesystem"."surface" IS NULL
+ OR "posthog_filesystem"."surface" = 'web')
+ AND "posthog_filesystem"."ref" = '0001'
+ AND "posthog_filesystem"."team_id" = 99999
+ AND "posthog_filesystem"."type" = 'dashboard'
+ AND NOT ("posthog_filesystem"."shortcut"
+ AND "posthog_filesystem"."shortcut" IS NOT NULL))
+ ORDER BY 1 ASC
+ LIMIT 1
+ '''
+# ---
+# name: TestDashboard.test_retrieve_dashboard_list.16
+ '''
+ SELECT "posthog_filesystem"."id" AS "id",
+ "posthog_filesystem"."path" AS "path"
+ FROM "posthog_filesystem"
+ WHERE (("posthog_filesystem"."surface" IS NULL
+ OR "posthog_filesystem"."surface" = 'web')
+ AND "posthog_filesystem"."ref" = '0001'
+ AND "posthog_filesystem"."team_id" = 99999
+ AND "posthog_filesystem"."type" = 'dashboard'
+ AND NOT ("posthog_filesystem"."shortcut"
+ AND "posthog_filesystem"."shortcut" IS NOT NULL))
+ ORDER BY 1 ASC
+ LIMIT 1
+ '''
+# ---
+# name: TestDashboard.test_retrieve_dashboard_list.17
'''
SELECT "posthog_sharingconfiguration"."id",
"posthog_sharingconfiguration"."team_id",
@@ -12610,7 +12802,7 @@
WHERE "posthog_sharingconfiguration"."dashboard_id" = 99999
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.15
+# name: TestDashboard.test_retrieve_dashboard_list.18
'''
SELECT "posthog_insightvariable"."created_by_id",
"posthog_insightvariable"."created_at",
@@ -12629,7 +12821,7 @@
WHERE "posthog_insightvariable"."team_id" = 99999
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.16
+# name: TestDashboard.test_retrieve_dashboard_list.19
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -12978,111 +13170,13 @@
WHERE (NOT ("posthog_dashboardtile"."deleted"
AND "posthog_dashboardtile"."deleted" IS NOT NULL)
AND NOT ("posthog_dashboard"."deleted")
- AND "posthog_dashboardtile"."dashboard_id" = 99999
- AND NOT ("posthog_dashboard"."deleted"
- AND "posthog_dashboardtile"."deleted"
- AND "posthog_dashboardtile"."deleted" IS NOT NULL)
- AND (NOT "posthog_dashboarditem"."deleted"
- OR "posthog_dashboardtile"."insight_id" IS NULL))
- ORDER BY "posthog_dashboarditem"."order" ASC
- '''
-# ---
-# name: TestDashboard.test_retrieve_dashboard_list.17
- '''
- SELECT "posthog_tag"."name" AS "tag__name"
- FROM "posthog_taggeditem"
- INNER JOIN "posthog_tag" ON ("posthog_taggeditem"."tag_id" = "posthog_tag"."id")
- WHERE "posthog_taggeditem"."dashboard_id" = 99999
- '''
-# ---
-# name: TestDashboard.test_retrieve_dashboard_list.18
- '''
- SELECT "posthog_user"."id",
- "posthog_user"."password",
- "posthog_user"."last_login",
- "posthog_user"."first_name",
- "posthog_user"."last_name",
- "posthog_user"."is_staff",
- "posthog_user"."date_joined",
- "posthog_user"."uuid",
- "posthog_user"."current_organization_id",
- "posthog_user"."current_team_id",
- "posthog_user"."email",
- "posthog_user"."pending_email",
- "posthog_user"."distinct_id",
- "posthog_user"."is_email_verified",
- "posthog_user"."credentials_reviewed_at",
- "posthog_user"."requested_2fa_reset_at",
- "posthog_user"."has_seen_product_intro_for",
- "posthog_user"."strapi_id",
- "posthog_user"."is_active",
- "posthog_user"."role_at_organization",
- "posthog_user"."theme_mode",
- "posthog_user"."partial_notification_settings",
- "posthog_user"."anonymize_data",
- "posthog_user"."allow_impersonation",
- "posthog_user"."toolbar_mode",
- "posthog_user"."hedgehog_config",
- "posthog_user"."allow_sidebar_suggestions",
- "posthog_user"."shortcut_position",
- "posthog_user"."passkeys_enabled_for_2fa",
- "posthog_user"."hide_mcp_hints",
- "posthog_user"."ui_configuration",
- "posthog_user"."onboarding_skipped_at",
- "posthog_user"."onboarding_skipped_reason",
- "posthog_user"."onboarding_skipped_organization_id",
- "posthog_user"."onboarding_delegated_to_invite_id",
- "posthog_user"."onboarding_delegated_to_organization_id",
- "posthog_user"."onboarding_delegation_accepted_at",
- "posthog_user"."events_column_config",
- "posthog_user"."email_opt_in"
- FROM "posthog_user"
- WHERE ("posthog_user"."is_active"
- AND "posthog_user"."id" = 99999)
- '''
-# ---
-# name: TestDashboard.test_retrieve_dashboard_list.19
- '''
- SELECT "posthog_organization"."id",
- "posthog_organization"."name",
- "posthog_organization"."slug",
- "posthog_organization"."logo_media_id",
- "posthog_organization"."created_at",
- "posthog_organization"."updated_at",
- "posthog_organization"."is_active",
- "posthog_organization"."is_not_active_reason",
- "posthog_organization"."session_cookie_age",
- "posthog_organization"."is_member_join_email_enabled",
- "posthog_organization"."is_ai_data_processing_approved",
- "posthog_organization"."is_ai_training_opted_in",
- "posthog_organization"."is_ai_training_locked",
- "posthog_organization"."is_ai_training_cta_shown",
- "posthog_organization"."enforce_2fa",
- "posthog_organization"."enforce_verified_domains",
- "posthog_organization"."members_can_invite",
- "posthog_organization"."members_can_create_projects",
- "posthog_organization"."members_can_use_personal_api_keys",
- "posthog_organization"."members_can_see_org_members",
- "posthog_organization"."allow_publicly_shared_resources",
- "posthog_organization"."default_role_id",
- "posthog_organization"."plugins_access_level",
- "posthog_organization"."for_internal_metrics",
- "posthog_organization"."default_experiment_stats_method",
- "posthog_organization"."default_anonymize_ips",
- "posthog_organization"."is_hipaa",
- "posthog_organization"."is_pending_deletion",
- "posthog_organization"."customer_id",
- "posthog_organization"."available_product_features",
- "posthog_organization"."usage",
- "posthog_organization"."never_drop_data",
- "posthog_organization"."customer_trust_scores",
- "posthog_organization"."setup_section_2_completed",
- "posthog_organization"."personalization",
- "posthog_organization"."domain_whitelist",
- "posthog_organization"."is_platform"
- FROM "posthog_organization"
- WHERE "posthog_organization"."id" = '00000000-0000-0000-0000-000000000000'::uuid
- LIMIT 21
+ AND "posthog_dashboardtile"."dashboard_id" = 99999
+ AND NOT ("posthog_dashboard"."deleted"
+ AND "posthog_dashboardtile"."deleted"
+ AND "posthog_dashboardtile"."deleted" IS NOT NULL)
+ AND (NOT "posthog_dashboarditem"."deleted"
+ OR "posthog_dashboardtile"."insight_id" IS NULL))
+ ORDER BY "posthog_dashboarditem"."order" ASC
'''
# ---
# name: TestDashboard.test_retrieve_dashboard_list.2
@@ -13226,6 +13320,104 @@
'''
# ---
# name: TestDashboard.test_retrieve_dashboard_list.20
+ '''
+ SELECT "posthog_tag"."name" AS "tag__name"
+ FROM "posthog_taggeditem"
+ INNER JOIN "posthog_tag" ON ("posthog_taggeditem"."tag_id" = "posthog_tag"."id")
+ WHERE "posthog_taggeditem"."dashboard_id" = 99999
+ '''
+# ---
+# name: TestDashboard.test_retrieve_dashboard_list.21
+ '''
+ SELECT "posthog_user"."id",
+ "posthog_user"."password",
+ "posthog_user"."last_login",
+ "posthog_user"."first_name",
+ "posthog_user"."last_name",
+ "posthog_user"."is_staff",
+ "posthog_user"."date_joined",
+ "posthog_user"."uuid",
+ "posthog_user"."current_organization_id",
+ "posthog_user"."current_team_id",
+ "posthog_user"."email",
+ "posthog_user"."pending_email",
+ "posthog_user"."distinct_id",
+ "posthog_user"."is_email_verified",
+ "posthog_user"."credentials_reviewed_at",
+ "posthog_user"."requested_2fa_reset_at",
+ "posthog_user"."has_seen_product_intro_for",
+ "posthog_user"."strapi_id",
+ "posthog_user"."is_active",
+ "posthog_user"."role_at_organization",
+ "posthog_user"."theme_mode",
+ "posthog_user"."partial_notification_settings",
+ "posthog_user"."anonymize_data",
+ "posthog_user"."allow_impersonation",
+ "posthog_user"."toolbar_mode",
+ "posthog_user"."hedgehog_config",
+ "posthog_user"."allow_sidebar_suggestions",
+ "posthog_user"."shortcut_position",
+ "posthog_user"."passkeys_enabled_for_2fa",
+ "posthog_user"."hide_mcp_hints",
+ "posthog_user"."ui_configuration",
+ "posthog_user"."onboarding_skipped_at",
+ "posthog_user"."onboarding_skipped_reason",
+ "posthog_user"."onboarding_skipped_organization_id",
+ "posthog_user"."onboarding_delegated_to_invite_id",
+ "posthog_user"."onboarding_delegated_to_organization_id",
+ "posthog_user"."onboarding_delegation_accepted_at",
+ "posthog_user"."events_column_config",
+ "posthog_user"."email_opt_in"
+ FROM "posthog_user"
+ WHERE ("posthog_user"."is_active"
+ AND "posthog_user"."id" = 99999)
+ '''
+# ---
+# name: TestDashboard.test_retrieve_dashboard_list.22
+ '''
+ SELECT "posthog_organization"."id",
+ "posthog_organization"."name",
+ "posthog_organization"."slug",
+ "posthog_organization"."logo_media_id",
+ "posthog_organization"."created_at",
+ "posthog_organization"."updated_at",
+ "posthog_organization"."is_active",
+ "posthog_organization"."is_not_active_reason",
+ "posthog_organization"."session_cookie_age",
+ "posthog_organization"."is_member_join_email_enabled",
+ "posthog_organization"."is_ai_data_processing_approved",
+ "posthog_organization"."is_ai_training_opted_in",
+ "posthog_organization"."is_ai_training_locked",
+ "posthog_organization"."is_ai_training_cta_shown",
+ "posthog_organization"."enforce_2fa",
+ "posthog_organization"."enforce_verified_domains",
+ "posthog_organization"."members_can_invite",
+ "posthog_organization"."members_can_create_projects",
+ "posthog_organization"."members_can_use_personal_api_keys",
+ "posthog_organization"."members_can_see_org_members",
+ "posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."default_role_id",
+ "posthog_organization"."plugins_access_level",
+ "posthog_organization"."for_internal_metrics",
+ "posthog_organization"."default_experiment_stats_method",
+ "posthog_organization"."default_anonymize_ips",
+ "posthog_organization"."is_hipaa",
+ "posthog_organization"."is_pending_deletion",
+ "posthog_organization"."customer_id",
+ "posthog_organization"."available_product_features",
+ "posthog_organization"."usage",
+ "posthog_organization"."never_drop_data",
+ "posthog_organization"."customer_trust_scores",
+ "posthog_organization"."setup_section_2_completed",
+ "posthog_organization"."personalization",
+ "posthog_organization"."domain_whitelist",
+ "posthog_organization"."is_platform"
+ FROM "posthog_organization"
+ WHERE "posthog_organization"."id" = '00000000-0000-0000-0000-000000000000'::uuid
+ LIMIT 21
+ '''
+# ---
+# name: TestDashboard.test_retrieve_dashboard_list.23
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -13365,7 +13557,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.21
+# name: TestDashboard.test_retrieve_dashboard_list.24
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -13418,7 +13610,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.22
+# name: TestDashboard.test_retrieve_dashboard_list.25
'''
SELECT "ee_accesscontrol"."id",
"ee_accesscontrol"."team_id",
@@ -13443,7 +13635,7 @@
AND "ee_accesscontrol"."team_id" = 99999))
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.23
+# name: TestDashboard.test_retrieve_dashboard_list.26
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -13494,7 +13686,7 @@
WHERE "posthog_organizationmembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.24
+# name: TestDashboard.test_retrieve_dashboard_list.27
'''
SELECT "ee_accesscontrol"."team_id" AS "team_id",
"ee_accesscontrol"."resource_id" AS "resource_id",
@@ -13507,7 +13699,7 @@
AND "posthog_team"."organization_id" IN ('00000000-0000-0000-0000-000000000000'::uuid))
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.25
+# name: TestDashboard.test_retrieve_dashboard_list.28
'''
SELECT "ee_role"."organization_id" AS "role__organization_id",
"ee_rolemembership"."role_id" AS "role_id"
@@ -13516,7 +13708,7 @@
WHERE "ee_rolemembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.26
+# name: TestDashboard.test_retrieve_dashboard_list.29
'''
SELECT COUNT(*) AS "__count"
FROM "posthog_dashboard"
@@ -13532,7 +13724,60 @@
AND NOT "posthog_dashboard"."deleted")
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.27
+# name: TestDashboard.test_retrieve_dashboard_list.3
+ '''
+ SELECT "posthog_organizationmembership"."id",
+ "posthog_organizationmembership"."organization_id",
+ "posthog_organizationmembership"."user_id",
+ "posthog_organizationmembership"."level",
+ "posthog_organizationmembership"."joined_at",
+ "posthog_organizationmembership"."updated_at",
+ "posthog_organizationmembership"."invited_by_id",
+ "posthog_organization"."id",
+ "posthog_organization"."name",
+ "posthog_organization"."slug",
+ "posthog_organization"."logo_media_id",
+ "posthog_organization"."created_at",
+ "posthog_organization"."updated_at",
+ "posthog_organization"."is_active",
+ "posthog_organization"."is_not_active_reason",
+ "posthog_organization"."session_cookie_age",
+ "posthog_organization"."is_member_join_email_enabled",
+ "posthog_organization"."is_ai_data_processing_approved",
+ "posthog_organization"."is_ai_training_opted_in",
+ "posthog_organization"."is_ai_training_locked",
+ "posthog_organization"."is_ai_training_cta_shown",
+ "posthog_organization"."enforce_2fa",
+ "posthog_organization"."enforce_verified_domains",
+ "posthog_organization"."members_can_invite",
+ "posthog_organization"."members_can_create_projects",
+ "posthog_organization"."members_can_use_personal_api_keys",
+ "posthog_organization"."members_can_see_org_members",
+ "posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."default_role_id",
+ "posthog_organization"."plugins_access_level",
+ "posthog_organization"."for_internal_metrics",
+ "posthog_organization"."default_experiment_stats_method",
+ "posthog_organization"."default_anonymize_ips",
+ "posthog_organization"."is_hipaa",
+ "posthog_organization"."is_pending_deletion",
+ "posthog_organization"."customer_id",
+ "posthog_organization"."available_product_features",
+ "posthog_organization"."usage",
+ "posthog_organization"."never_drop_data",
+ "posthog_organization"."customer_trust_scores",
+ "posthog_organization"."setup_section_2_completed",
+ "posthog_organization"."personalization",
+ "posthog_organization"."domain_whitelist",
+ "posthog_organization"."is_platform"
+ FROM "posthog_organizationmembership"
+ INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")
+ WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
+ AND "posthog_organizationmembership"."user_id" = 99999)
+ LIMIT 21
+ '''
+# ---
+# name: TestDashboard.test_retrieve_dashboard_list.30
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -13634,97 +13879,44 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.28
+# name: TestDashboard.test_retrieve_dashboard_list.31
'''
SELECT "posthog_filesystem"."team_id",
"posthog_filesystem"."id",
"posthog_filesystem"."path",
"posthog_filesystem"."depth",
- "posthog_filesystem"."type",
- "posthog_filesystem"."ref",
- "posthog_filesystem"."href",
- "posthog_filesystem"."shortcut",
- "posthog_filesystem"."meta",
- "posthog_filesystem"."created_at",
- "posthog_filesystem"."created_by_id",
- "posthog_filesystem"."surface",
- "posthog_filesystem"."project_id"
- FROM "posthog_filesystem"
- WHERE (("posthog_filesystem"."surface" IS NULL
- OR "posthog_filesystem"."surface" = 'web')
- AND "posthog_filesystem"."ref" = '0001'
- AND "posthog_filesystem"."team_id" = 99999
- AND "posthog_filesystem"."type" = 'dashboard'
- AND NOT ("posthog_filesystem"."shortcut"
- AND "posthog_filesystem"."shortcut" IS NOT NULL))
- '''
-# ---
-# name: TestDashboard.test_retrieve_dashboard_list.29
- '''
- SELECT COUNT(*) AS "__count"
- FROM "posthog_dashboardtile"
- INNER JOIN "posthog_dashboard" ON ("posthog_dashboardtile"."dashboard_id" = "posthog_dashboard"."id")
- WHERE (NOT ("posthog_dashboardtile"."deleted"
- AND "posthog_dashboardtile"."deleted" IS NOT NULL)
- AND NOT ("posthog_dashboard"."deleted")
- AND "posthog_dashboardtile"."dashboard_id" = 99999
- AND NOT ("posthog_dashboardtile"."insight_id" IS NULL))
- '''
-# ---
-# name: TestDashboard.test_retrieve_dashboard_list.3
- '''
- SELECT "posthog_organizationmembership"."id",
- "posthog_organizationmembership"."organization_id",
- "posthog_organizationmembership"."user_id",
- "posthog_organizationmembership"."level",
- "posthog_organizationmembership"."joined_at",
- "posthog_organizationmembership"."updated_at",
- "posthog_organizationmembership"."invited_by_id",
- "posthog_organization"."id",
- "posthog_organization"."name",
- "posthog_organization"."slug",
- "posthog_organization"."logo_media_id",
- "posthog_organization"."created_at",
- "posthog_organization"."updated_at",
- "posthog_organization"."is_active",
- "posthog_organization"."is_not_active_reason",
- "posthog_organization"."session_cookie_age",
- "posthog_organization"."is_member_join_email_enabled",
- "posthog_organization"."is_ai_data_processing_approved",
- "posthog_organization"."is_ai_training_opted_in",
- "posthog_organization"."is_ai_training_locked",
- "posthog_organization"."is_ai_training_cta_shown",
- "posthog_organization"."enforce_2fa",
- "posthog_organization"."enforce_verified_domains",
- "posthog_organization"."members_can_invite",
- "posthog_organization"."members_can_create_projects",
- "posthog_organization"."members_can_use_personal_api_keys",
- "posthog_organization"."members_can_see_org_members",
- "posthog_organization"."allow_publicly_shared_resources",
- "posthog_organization"."default_role_id",
- "posthog_organization"."plugins_access_level",
- "posthog_organization"."for_internal_metrics",
- "posthog_organization"."default_experiment_stats_method",
- "posthog_organization"."default_anonymize_ips",
- "posthog_organization"."is_hipaa",
- "posthog_organization"."is_pending_deletion",
- "posthog_organization"."customer_id",
- "posthog_organization"."available_product_features",
- "posthog_organization"."usage",
- "posthog_organization"."never_drop_data",
- "posthog_organization"."customer_trust_scores",
- "posthog_organization"."setup_section_2_completed",
- "posthog_organization"."personalization",
- "posthog_organization"."domain_whitelist",
- "posthog_organization"."is_platform"
- FROM "posthog_organizationmembership"
- INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")
- WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
- AND "posthog_organizationmembership"."user_id" = 99999)
- LIMIT 21
+ "posthog_filesystem"."type",
+ "posthog_filesystem"."ref",
+ "posthog_filesystem"."href",
+ "posthog_filesystem"."shortcut",
+ "posthog_filesystem"."meta",
+ "posthog_filesystem"."created_at",
+ "posthog_filesystem"."created_by_id",
+ "posthog_filesystem"."surface",
+ "posthog_filesystem"."project_id"
+ FROM "posthog_filesystem"
+ WHERE (("posthog_filesystem"."surface" IS NULL
+ OR "posthog_filesystem"."surface" = 'web')
+ AND "posthog_filesystem"."ref" = '0001'
+ AND "posthog_filesystem"."team_id" = 99999
+ AND "posthog_filesystem"."type" = 'dashboard'
+ AND NOT ("posthog_filesystem"."shortcut"
+ AND "posthog_filesystem"."shortcut" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.30
+# name: TestDashboard.test_retrieve_dashboard_list.32
+ '''
+ SELECT COUNT(*) AS "__count"
+ FROM "posthog_dashboardtile"
+ INNER JOIN "posthog_dashboard" ON ("posthog_dashboardtile"."dashboard_id" = "posthog_dashboard"."id")
+ WHERE (NOT ("posthog_dashboardtile"."deleted"
+ AND "posthog_dashboardtile"."deleted" IS NOT NULL)
+ AND NOT ("posthog_dashboard"."deleted")
+ AND "posthog_dashboardtile"."dashboard_id" = 99999
+ AND NOT ("posthog_dashboardtile"."insight_id" IS NULL))
+ '''
+# ---
+# name: TestDashboard.test_retrieve_dashboard_list.33
'''
SELECT "posthog_sharingconfiguration"."id",
"posthog_sharingconfiguration"."team_id",
@@ -13743,14 +13935,62 @@
WHERE "posthog_sharingconfiguration"."dashboard_id" = 99999
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.31
+# name: TestDashboard.test_retrieve_dashboard_list.34
'''
SELECT COUNT(*) AS "__count"
FROM "posthog_taggeditem"
WHERE "posthog_taggeditem"."dashboard_id" = 99999
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.32
+# name: TestDashboard.test_retrieve_dashboard_list.35
+ '''
+ SELECT "posthog_filesystem"."id" AS "id",
+ "posthog_filesystem"."path" AS "path"
+ FROM "posthog_filesystem"
+ WHERE (("posthog_filesystem"."surface" IS NULL
+ OR "posthog_filesystem"."surface" = 'web')
+ AND "posthog_filesystem"."ref" = '0001'
+ AND "posthog_filesystem"."team_id" = 99999
+ AND "posthog_filesystem"."type" = 'dashboard'
+ AND NOT ("posthog_filesystem"."shortcut"
+ AND "posthog_filesystem"."shortcut" IS NOT NULL))
+ ORDER BY 1 ASC
+ LIMIT 1
+ '''
+# ---
+# name: TestDashboard.test_retrieve_dashboard_list.36
+ '''
+ SELECT "posthog_filesystem"."id" AS "id",
+ "posthog_filesystem"."path" AS "path"
+ FROM "posthog_filesystem"
+ WHERE (("posthog_filesystem"."surface" IS NULL
+ OR "posthog_filesystem"."surface" = 'web')
+ AND "posthog_filesystem"."ref" = '0001'
+ AND "posthog_filesystem"."team_id" = 99999
+ AND "posthog_filesystem"."type" = 'dashboard'
+ AND NOT ("posthog_filesystem"."shortcut"
+ AND "posthog_filesystem"."shortcut" IS NOT NULL))
+ ORDER BY 1 ASC
+ LIMIT 1
+ '''
+# ---
+# name: TestDashboard.test_retrieve_dashboard_list.37
+ '''
+ SELECT "posthog_filesystem"."id" AS "id",
+ "posthog_filesystem"."path" AS "path"
+ FROM "posthog_filesystem"
+ WHERE (("posthog_filesystem"."surface" IS NULL
+ OR "posthog_filesystem"."surface" = 'web')
+ AND "posthog_filesystem"."ref" = '0001'
+ AND "posthog_filesystem"."team_id" = 99999
+ AND "posthog_filesystem"."type" = 'dashboard'
+ AND NOT ("posthog_filesystem"."shortcut"
+ AND "posthog_filesystem"."shortcut" IS NOT NULL))
+ ORDER BY 1 ASC
+ LIMIT 1
+ '''
+# ---
+# name: TestDashboard.test_retrieve_dashboard_list.38
'''
SELECT "posthog_sharingconfiguration"."id",
"posthog_sharingconfiguration"."team_id",
@@ -13769,7 +14009,7 @@
WHERE "posthog_sharingconfiguration"."dashboard_id" = 99999
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.33
+# name: TestDashboard.test_retrieve_dashboard_list.39
'''
SELECT "posthog_insightvariable"."created_by_id",
"posthog_insightvariable"."created_at",
@@ -13788,7 +14028,32 @@
WHERE "posthog_insightvariable"."team_id" = 99999
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.34
+# name: TestDashboard.test_retrieve_dashboard_list.4
+ '''
+ SELECT "ee_accesscontrol"."id",
+ "ee_accesscontrol"."team_id",
+ "ee_accesscontrol"."access_level",
+ "ee_accesscontrol"."resource",
+ "ee_accesscontrol"."resource_id",
+ "ee_accesscontrol"."organization_member_id",
+ "ee_accesscontrol"."role_id",
+ "ee_accesscontrol"."created_by_id",
+ "ee_accesscontrol"."created_at",
+ "ee_accesscontrol"."updated_at",
+ "posthog_team"."organization_id" AS "_team_organization_id"
+ FROM "ee_accesscontrol"
+ INNER JOIN "posthog_team" ON ("ee_accesscontrol"."team_id" = "posthog_team"."id")
+ LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id")
+ WHERE (("ee_accesscontrol"."organization_member_id" IS NULL
+ AND "ee_accesscontrol"."role_id" IS NULL
+ AND "ee_accesscontrol"."team_id" = 99999)
+ OR ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
+ AND "posthog_organizationmembership"."user_id" = 99999
+ AND "ee_accesscontrol"."role_id" IS NULL
+ AND "ee_accesscontrol"."team_id" = 99999))
+ '''
+# ---
+# name: TestDashboard.test_retrieve_dashboard_list.40
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -14146,7 +14411,7 @@
ORDER BY "posthog_dashboarditem"."order" ASC
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.35
+# name: TestDashboard.test_retrieve_dashboard_list.41
'''
SELECT "posthog_tag"."name" AS "tag__name"
FROM "posthog_taggeditem"
@@ -14154,7 +14419,7 @@
WHERE "posthog_taggeditem"."dashboard_id" = 99999
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.36
+# name: TestDashboard.test_retrieve_dashboard_list.42
'''
SELECT "posthog_user"."id",
"posthog_user"."password",
@@ -14200,7 +14465,7 @@
AND "posthog_user"."id" = 99999)
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.37
+# name: TestDashboard.test_retrieve_dashboard_list.43
'''
SELECT "posthog_organization"."id",
"posthog_organization"."name",
@@ -14244,7 +14509,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.38
+# name: TestDashboard.test_retrieve_dashboard_list.44
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -14384,7 +14649,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.39
+# name: TestDashboard.test_retrieve_dashboard_list.45
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -14437,32 +14702,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.4
- '''
- SELECT "ee_accesscontrol"."id",
- "ee_accesscontrol"."team_id",
- "ee_accesscontrol"."access_level",
- "ee_accesscontrol"."resource",
- "ee_accesscontrol"."resource_id",
- "ee_accesscontrol"."organization_member_id",
- "ee_accesscontrol"."role_id",
- "ee_accesscontrol"."created_by_id",
- "ee_accesscontrol"."created_at",
- "ee_accesscontrol"."updated_at",
- "posthog_team"."organization_id" AS "_team_organization_id"
- FROM "ee_accesscontrol"
- INNER JOIN "posthog_team" ON ("ee_accesscontrol"."team_id" = "posthog_team"."id")
- LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id")
- WHERE (("ee_accesscontrol"."organization_member_id" IS NULL
- AND "ee_accesscontrol"."role_id" IS NULL
- AND "ee_accesscontrol"."team_id" = 99999)
- OR ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
- AND "posthog_organizationmembership"."user_id" = 99999
- AND "ee_accesscontrol"."role_id" IS NULL
- AND "ee_accesscontrol"."team_id" = 99999))
- '''
-# ---
-# name: TestDashboard.test_retrieve_dashboard_list.40
+# name: TestDashboard.test_retrieve_dashboard_list.46
'''
SELECT "ee_accesscontrol"."id",
"ee_accesscontrol"."team_id",
@@ -14487,7 +14727,7 @@
AND "ee_accesscontrol"."team_id" = 99999))
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.41
+# name: TestDashboard.test_retrieve_dashboard_list.47
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -14538,7 +14778,7 @@
WHERE "posthog_organizationmembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.42
+# name: TestDashboard.test_retrieve_dashboard_list.48
'''
SELECT "ee_accesscontrol"."team_id" AS "team_id",
"ee_accesscontrol"."resource_id" AS "resource_id",
@@ -14551,7 +14791,7 @@
AND "posthog_team"."organization_id" IN ('00000000-0000-0000-0000-000000000000'::uuid))
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.43
+# name: TestDashboard.test_retrieve_dashboard_list.49
'''
SELECT "ee_role"."organization_id" AS "role__organization_id",
"ee_rolemembership"."role_id" AS "role_id"
@@ -14560,7 +14800,58 @@
WHERE "ee_rolemembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.44
+# name: TestDashboard.test_retrieve_dashboard_list.5
+ '''
+ SELECT "posthog_organizationmembership"."id",
+ "posthog_organizationmembership"."organization_id",
+ "posthog_organizationmembership"."user_id",
+ "posthog_organizationmembership"."level",
+ "posthog_organizationmembership"."joined_at",
+ "posthog_organizationmembership"."updated_at",
+ "posthog_organizationmembership"."invited_by_id",
+ "posthog_organization"."id",
+ "posthog_organization"."name",
+ "posthog_organization"."slug",
+ "posthog_organization"."logo_media_id",
+ "posthog_organization"."created_at",
+ "posthog_organization"."updated_at",
+ "posthog_organization"."is_active",
+ "posthog_organization"."is_not_active_reason",
+ "posthog_organization"."session_cookie_age",
+ "posthog_organization"."is_member_join_email_enabled",
+ "posthog_organization"."is_ai_data_processing_approved",
+ "posthog_organization"."is_ai_training_opted_in",
+ "posthog_organization"."is_ai_training_locked",
+ "posthog_organization"."is_ai_training_cta_shown",
+ "posthog_organization"."enforce_2fa",
+ "posthog_organization"."enforce_verified_domains",
+ "posthog_organization"."members_can_invite",
+ "posthog_organization"."members_can_create_projects",
+ "posthog_organization"."members_can_use_personal_api_keys",
+ "posthog_organization"."members_can_see_org_members",
+ "posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."default_role_id",
+ "posthog_organization"."plugins_access_level",
+ "posthog_organization"."for_internal_metrics",
+ "posthog_organization"."default_experiment_stats_method",
+ "posthog_organization"."default_anonymize_ips",
+ "posthog_organization"."is_hipaa",
+ "posthog_organization"."is_pending_deletion",
+ "posthog_organization"."customer_id",
+ "posthog_organization"."available_product_features",
+ "posthog_organization"."usage",
+ "posthog_organization"."never_drop_data",
+ "posthog_organization"."customer_trust_scores",
+ "posthog_organization"."setup_section_2_completed",
+ "posthog_organization"."personalization",
+ "posthog_organization"."domain_whitelist",
+ "posthog_organization"."is_platform"
+ FROM "posthog_organizationmembership"
+ INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")
+ WHERE "posthog_organizationmembership"."user_id" = 99999
+ '''
+# ---
+# name: TestDashboard.test_retrieve_dashboard_list.50
'''
SELECT COUNT(*) AS "__count"
FROM "posthog_dashboard"
@@ -14574,7 +14865,7 @@
AND NOT ("posthog_dashboard"."creation_mode" = 'unlisted'))
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.45
+# name: TestDashboard.test_retrieve_dashboard_list.51
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -14611,6 +14902,18 @@
AND U0."shortcut" IS NOT NULL))
ORDER BY U0."id" ASC
LIMIT 1) AS "_folder_path",
+
+ (SELECT U0."id" AS "id"
+ FROM "posthog_filesystem" U0
+ WHERE ((U0."surface" IS NULL
+ OR U0."surface" = 'web')
+ AND U0."ref" = ("posthog_dashboard"."id")::varchar
+ AND U0."team_id" = ("posthog_dashboard"."team_id")
+ AND U0."type" = 'dashboard'
+ AND NOT (U0."shortcut"
+ AND U0."shortcut" IS NOT NULL))
+ ORDER BY 1 ASC
+ LIMIT 1) AS "_folder_id",
T6."id",
T6."password",
T6."last_login",
@@ -14666,7 +14969,7 @@
LIMIT 100
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.46
+# name: TestDashboard.test_retrieve_dashboard_list.52
'''
SELECT "posthog_sharingconfiguration"."id",
"posthog_sharingconfiguration"."team_id",
@@ -14689,7 +14992,7 @@
5 /* ... */)
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.47
+# name: TestDashboard.test_retrieve_dashboard_list.53
'''
SELECT "posthog_taggeditem"."id",
"posthog_taggeditem"."tag_id",
@@ -14715,57 +15018,6 @@
5 /* ... */)
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard_list.5
- '''
- SELECT "posthog_organizationmembership"."id",
- "posthog_organizationmembership"."organization_id",
- "posthog_organizationmembership"."user_id",
- "posthog_organizationmembership"."level",
- "posthog_organizationmembership"."joined_at",
- "posthog_organizationmembership"."updated_at",
- "posthog_organizationmembership"."invited_by_id",
- "posthog_organization"."id",
- "posthog_organization"."name",
- "posthog_organization"."slug",
- "posthog_organization"."logo_media_id",
- "posthog_organization"."created_at",
- "posthog_organization"."updated_at",
- "posthog_organization"."is_active",
- "posthog_organization"."is_not_active_reason",
- "posthog_organization"."session_cookie_age",
- "posthog_organization"."is_member_join_email_enabled",
- "posthog_organization"."is_ai_data_processing_approved",
- "posthog_organization"."is_ai_training_opted_in",
- "posthog_organization"."is_ai_training_locked",
- "posthog_organization"."is_ai_training_cta_shown",
- "posthog_organization"."enforce_2fa",
- "posthog_organization"."enforce_verified_domains",
- "posthog_organization"."members_can_invite",
- "posthog_organization"."members_can_create_projects",
- "posthog_organization"."members_can_use_personal_api_keys",
- "posthog_organization"."members_can_see_org_members",
- "posthog_organization"."allow_publicly_shared_resources",
- "posthog_organization"."default_role_id",
- "posthog_organization"."plugins_access_level",
- "posthog_organization"."for_internal_metrics",
- "posthog_organization"."default_experiment_stats_method",
- "posthog_organization"."default_anonymize_ips",
- "posthog_organization"."is_hipaa",
- "posthog_organization"."is_pending_deletion",
- "posthog_organization"."customer_id",
- "posthog_organization"."available_product_features",
- "posthog_organization"."usage",
- "posthog_organization"."never_drop_data",
- "posthog_organization"."customer_trust_scores",
- "posthog_organization"."setup_section_2_completed",
- "posthog_organization"."personalization",
- "posthog_organization"."domain_whitelist",
- "posthog_organization"."is_platform"
- FROM "posthog_organizationmembership"
- INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")
- WHERE "posthog_organizationmembership"."user_id" = 99999
- '''
-# ---
# name: TestDashboard.test_retrieve_dashboard_list.6
'''
SELECT "ee_accesscontrol"."team_id" AS "team_id",
diff --git a/posthog/api/test/dashboards/test_dashboard.py b/posthog/api/test/dashboards/test_dashboard.py
index 8b609aa1c15b..0997588ea467 100644
--- a/posthog/api/test/dashboards/test_dashboard.py
+++ b/posthog/api/test/dashboards/test_dashboard.py
@@ -22,6 +22,7 @@ from posthog.constants import AvailableFeature
from posthog.helpers.dashboard_templates import create_group_type_mapping_detail_dashboard
from posthog.models import Filter, Team, User
from posthog.models.activity_logging.activity_log import ActivityLog
+from posthog.models.file_system.file_system import FileSystem
from posthog.models.file_system.file_system_view_log import FileSystemViewLog
from posthog.models.group_type_mapping import (
GROUP_TYPES_CACHE_KEY_PREFIX,
@@ -470,6 +471,96 @@ class TestDashboard(APIBaseTest, QueryMatchingTest):
# Dashboards created without an explicit folder land in the default unfiled folder
assert results_by_id[unfiled_id]["folder"] == "Unfiled/Dashboards"
+ def test_list_includes_the_file_system_entry_needed_to_move_a_dashboard(self):
+ filed_id, _ = self.dashboard_api.create_dashboard(
+ {"name": "Filed dashboard", "_create_in_folder": "Marketing/Website"}
+ )
+
+ response = self.dashboard_api.list_dashboards(parent="environment")
+ result = {dashboard["id"]: dashboard for dashboard in response["results"]}[filed_id]
+
+ entry = FileSystem.objects.get(team=self.team, type="dashboard", ref=str(filed_id), shortcut=False)
+ # Together these are everything a move needs, so the list page never looks the entry up again.
+ assert result["file_system_id"] == str(entry.id)
+ assert result["file_system_path"] == entry.path
+ # Unlike `folder`, the path keeps the dashboard's own name as its last segment
+ assert result["file_system_path"] == "Marketing/Website/Filed dashboard"
+
+ def test_list_picks_the_same_entry_every_time_when_a_dashboard_has_several(self):
+ dashboard_id, _ = self.dashboard_api.create_dashboard({"name": "Twice filed", "_create_in_folder": "First"})
+ second = FileSystem.objects.create(
+ team=self.team, path="Second/Twice filed", type="dashboard", ref=str(dashboard_id), created_by=self.user
+ )
+ first = FileSystem.objects.get(team=self.team, type="dashboard", ref=str(dashboard_id), shortcut=False)
+ first = min([first, second], key=lambda entry: entry.id)
+
+ response = self.dashboard_api.list_dashboards(parent="environment")
+ result = {dashboard["id"]: dashboard for dashboard in response["results"]}[dashboard_id]
+
+ # Both annotations must resolve the same row, or a move would target one and report the other
+ assert result["file_system_id"] == str(first.id)
+ assert result["file_system_path"] == first.path
+
+ def test_updating_a_dashboard_keeps_its_file_system_entry_in_the_response(self):
+ dashboard_id, _ = self.dashboard_api.create_dashboard(
+ {"name": "Filed dashboard", "_create_in_folder": "Marketing/Website"}
+ )
+ entry = FileSystem.objects.get(team=self.team, type="dashboard", ref=str(dashboard_id), shortcut=False)
+
+ _, updated = self.dashboard_api.update_dashboard(dashboard_id, {"pinned": True})
+
+ # The list gates "Move to another folder" on these, so an update that drops them un-files the row
+ assert updated["file_system_id"] == str(entry.id)
+ assert updated["file_system_path"] == entry.path
+
+ def test_creating_a_dashboard_from_a_template_returns_its_file_system_entry(self):
+ response = self.client.post(
+ f"/api/projects/{self.team.id}/dashboards/create_from_template_json",
+ {"template": valid_template, "_create_in_folder": "Unfiled/Dashboards"},
+ )
+ assert response.status_code == 200, response.content
+
+ created = response.json()
+ entry = FileSystem.objects.get(team=self.team, type="dashboard", ref=str(created["id"]), shortcut=False)
+ # This endpoint serializes a dashboard the list annotation never touched, and the list stores the
+ # response as-is, so without the entry the new row offers no way to file it until a reload.
+ assert created["file_system_id"] == str(entry.id)
+ assert created["file_system_path"] == entry.path
+ assert created["folder"] == "Unfiled/Dashboards"
+
+ def test_creating_a_dashboard_returns_its_file_system_entry(self):
+ dashboard_id, created = self.dashboard_api.create_dashboard(
+ {"name": "Fresh dashboard", "_create_in_folder": "Marketing/Website"}
+ )
+ entry = FileSystem.objects.get(team=self.team, type="dashboard", ref=str(dashboard_id), shortcut=False)
+
+ # The save signal files the dashboard, so a response saying otherwise disables its move action
+ # until the list is reloaded.
+ assert created["file_system_id"] == str(entry.id)
+ assert created["file_system_path"] == entry.path
+
+ def test_renaming_a_dashboard_returns_the_new_file_system_path(self):
+ dashboard_id, _ = self.dashboard_api.create_dashboard(
+ {"name": "Old name", "_create_in_folder": "Marketing/Website"}
+ )
+
+ _, updated = self.dashboard_api.update_dashboard(dashboard_id, {"name": "New name"})
+
+ # The path's last segment is the dashboard's own name, and a move re-files the row under whatever
+ # that segment says, so a stale path would rename the entry back.
+ assert updated["file_system_path"] == "Marketing/Website/New name"
+
+ def test_list_reports_no_file_system_entry_when_the_dashboard_has_none(self):
+ dashboard_id, _ = self.dashboard_api.create_dashboard({"name": "Entryless dashboard"})
+ FileSystem.objects.filter(team=self.team, type="dashboard", ref=str(dashboard_id)).delete()
+
+ response = self.dashboard_api.list_dashboards(parent="environment")
+ result = {dashboard["id"]: dashboard for dashboard in response["results"]}[dashboard_id]
+
+ assert result["file_system_id"] is None
+ assert result["file_system_path"] is None
+ assert result["folder"] is None
+
@parameterized.expand(
[
# The named folder matches only the dashboard filed directly in it — nested sub-folders excluded
@@ -659,6 +750,23 @@ class TestDashboard(APIBaseTest, QueryMatchingTest):
response = self.client.get("/shared_dashboard/testtoken")
self.assertEqual(response.status_code, status.HTTP_200_OK)
+ def test_shared_dashboard_does_not_expose_where_it_is_filed(self):
+ dashboard_id, _ = self.dashboard_api.create_dashboard(
+ {"name": "public dashboard", "_create_in_folder": "Acquisitions/Project Falcon"}
+ )
+ dashboard = Dashboard.objects.get(id=dashboard_id)
+ SharingConfiguration.objects.create(team=self.team, dashboard=dashboard, access_token="testtoken", enabled=True)
+ self.client.logout()
+
+ response = self.client.get("/shared_dashboard/testtoken")
+ assert response.status_code == status.HTTP_200_OK
+
+ # The share page serializes the dashboard straight off the sharing configuration, so the fields fall
+ # back to reading the entry. Every one of them names a folder an anonymous viewer must not see.
+ payload = response.content.decode()
+ assert "Project Falcon" not in payload
+ assert "Acquisitions" not in payload
+
def test_return_cached_results_bleh(self):
dashboard = Dashboard.objects.create(team=self.team, name="dashboard")
diff --git a/products/dashboards/backend/api/dashboard.py b/products/dashboards/backend/api/dashboard.py
index 11a3959ebd05..1084f1a81743 100644
--- a/products/dashboards/backend/api/dashboard.py
+++ b/products/dashboards/backend/api/dashboard.py
@@ -26,6 +26,7 @@ from django.db.models import (
Q,
QuerySet,
Subquery,
+ UUIDField,
Value,
)
from django.db.models.functions import Cast
@@ -58,6 +59,7 @@ from posthog.api.tagged_item import TaggedItemSerializerMixin, TaggedItemViewSet
from posthog.api.utils import action
from posthog.clickhouse.client.async_task_chain import task_chain_context
from posthog.constants import GENERATED_DASHBOARD_PREFIX
+from posthog.dataclasses import frozen
from posthog.event_usage import EventSource, get_event_source, report_user_action
from posthog.exceptions_capture import capture_exception
from posthog.helpers import create_dashboard_from_template
@@ -167,6 +169,43 @@ DASHBOARD_TILE_ERROR_TYPE = "DashboardTileError"
DASHBOARD_TILE_ERROR_MESSAGE = "There is a problem loading this dashboard tile."
DASHBOARD_STREAM_ERROR_MESSAGE = "Dashboard tiles couldn't be loaded. Refresh the dashboard to try again."
+
+def dashboard_file_system_entries(team_id: Any, ref: Any) -> QuerySet[FileSystem]:
+ """
+ The project-tree entries a dashboard is filed under, oldest first. Taking `OuterRef`s as well as concrete
+ values lets the list annotation and the direct read share one definition, which they have to: a dashboard
+ can hold several non-shortcut entries, and if the two picked different ones a move would target one and
+ report the other. The arguments are `Any` because Django's lookup stubs do not admit an `OuterRef`.
+ """
+ return (
+ FileSystem.objects.filter(surface_q(DEFAULT_SURFACE), team_id=team_id, type="dashboard", ref=ref)
+ .exclude(shortcut=True)
+ .order_by("id")
+ )
+
+
+@frozen
+class FiledEntry:
+ id: str
+ path: str
+
+
+def filed_entry(dashboard: Dashboard) -> FiledEntry | None:
+ """
+ Where a dashboard sits in the project tree, or None when it was never filed. Prefers the annotation
+ `dangerously_get_queryset` adds, and queries only for a dashboard that never went through it, which the
+ endpoints serializing an instance directly (`create_from_template_json`, `create_unlisted_dashboard`, the
+ tile move and copy responses) all hand over. Those return a single dashboard, so the query cannot fan out
+ over a list.
+ """
+ if hasattr(dashboard, "_folder_path"):
+ path = dashboard._folder_path
+ entry_id = dashboard._folder_id # type: ignore[attr-defined]
+ return FiledEntry(id=str(entry_id), path=path) if path and entry_id else None
+ row = dashboard_file_system_entries(dashboard.team_id, str(dashboard.id)).values("id", "path").first()
+ return FiledEntry(id=str(row["id"]), path=row["path"]) if row else None
+
+
DASHBOARD_SHARED_FIELDS = [
"id",
"name",
@@ -177,6 +216,8 @@ DASHBOARD_SHARED_FIELDS = [
"last_accessed_at",
"last_viewed_at",
"folder",
+ "file_system_id",
+ "file_system_path",
"is_shared",
"deleted",
"creation_mode",
@@ -1023,6 +1064,20 @@ class DashboardBasicSerializer(
"dashboard has no file system entry. The dashboard's own name is not part of the path."
),
)
+ file_system_id = serializers.SerializerMethodField(
+ help_text=(
+ "Id of this dashboard's file system entry, or null when it has none. Together with "
+ "`file_system_path` this is everything a caller needs to move the dashboard between "
+ "folders, so a list page does not have to look the entry up separately."
+ ),
+ )
+ file_system_path = serializers.SerializerMethodField(
+ help_text=(
+ "Full path of this dashboard's file system entry, e.g. 'Unfiled/Dashboards/Revenue'. "
+ "Unlike `folder` this keeps the dashboard's own name as the last segment, which is what "
+ "a move needs in order to compute the destination path. Null when it has no entry."
+ ),
+ )
class Meta:
model = Dashboard
@@ -1036,6 +1091,8 @@ class DashboardBasicSerializer(
"last_accessed_at",
"last_viewed_at",
"folder",
+ "file_system_id",
+ "file_system_path",
"is_shared",
"deleted",
"creation_mode",
@@ -1075,16 +1132,30 @@ class DashboardBasicSerializer(
@extend_schema_field(serializers.CharField(allow_null=True))
def get_folder(self, dashboard: Dashboard) -> str | None:
- # Don't expose the project-tree location to anonymous viewers of a publicly shared dashboard —
- # the folder name can encode internal organisational structure.
+ # Don't expose the project-tree location to anonymous viewers of a publicly shared dashboard,
+ # because the folder name can encode internal organisational structure.
if self.context.get("is_shared"):
return None
# `_folder_path` is annotated on DashboardsViewSet.dangerously_get_queryset (all actions).
# The file system path's last segment is the dashboard's own name; the folder is everything above it.
- path = getattr(dashboard, "_folder_path", None)
- if not path:
+ entry = filed_entry(dashboard)
+ return join_path(split_path(entry.path)[:-1]) if entry else None
+
+ @extend_schema_field(serializers.UUIDField(allow_null=True))
+ def get_file_system_id(self, dashboard: Dashboard) -> str | None:
+ if self.context.get("is_shared"):
+ return None
+ entry = filed_entry(dashboard)
+ return entry.id if entry else None
+
+ @extend_schema_field(serializers.CharField(allow_null=True))
+ def get_file_system_path(self, dashboard: Dashboard) -> str | None:
+ # The path carries every folder above the dashboard, so it withholds for the same reason `folder`
+ # does: an anonymous viewer of a public dashboard must not learn the internal folder structure.
+ if self.context.get("is_shared"):
return None
- return join_path(split_path(path)[:-1])
+ entry = filed_entry(dashboard)
+ return entry.path if entry else None
class DashboardMetadataSerializer(DashboardBasicSerializer):
@@ -1719,6 +1790,10 @@ class DashboardSerializer(DashboardMetadataSerializer):
)
self.user_permissions.reset_insights_dashboard_cached_results()
+ # A rename re-paths the entry in a post-save signal, so the annotation bound before the save now
+ # points at the old path. Dropping it sends `filed_entry` back to the file system for the new one.
+ instance.__dict__.pop("_folder_id", None)
+ instance.__dict__.pop("_folder_path", None)
return instance
# Display-only tile fields that may appear in PATCH payloads. Safe to pass to
@@ -2361,19 +2436,17 @@ class DashboardsViewSet(
# and avoids the row multiplication a join could cause when shortcuts/multiple surfaces exist.
# The default surface matches both NULL and "web" rows, so order by id to keep the picked path
# stable when more than one non-shortcut entry exists for the same dashboard.
+ entry_for_dashboard = dashboard_file_system_entries(OuterRef("team_id"), OuterRef("_ref_id"))
queryset = queryset.annotate(_ref_id=Cast(F("id"), output_field=CharField())).annotate(
_folder_path=Subquery(
- FileSystem.objects.filter(
- surface_q(DEFAULT_SURFACE),
- team_id=OuterRef("team_id"),
- type="dashboard",
- ref=OuterRef("_ref_id"),
- )
- .exclude(shortcut=True)
- .order_by("id")
- .values("path")[:1],
+ entry_for_dashboard.values("path")[:1],
output_field=CharField(),
- )
+ ),
+ # Same row as `_folder_path`, so a caller can move the dashboard without fetching the entry.
+ _folder_id=Subquery(
+ entry_for_dashboard.values("id")[:1],
+ output_field=UUIDField(),
+ ),
)
include_deleted = False
diff --git a/products/dashboards/frontend/components/DashboardsTree.tsx b/products/dashboards/frontend/components/DashboardsTree.tsx
index 9dcd813afde6..5f691b797855 100644
--- a/products/dashboards/frontend/components/DashboardsTree.tsx
+++ b/products/dashboards/frontend/components/DashboardsTree.tsx
@@ -46,14 +46,12 @@ function collectExpandablePaths(nodes: FolderTreeNode[], acc: string[] = []): st
// familiar dashboards table on the right scoped to everything at or below the selected folder (root = all).
// Expansion is controlled: the tree opens collapsed except for the root (so you see the top-level folders),
// and clicking a folder expands it — both the chevron and a folder-row click mirror the toggle into the
-// expandedFolders reducer so collapsing sticks and the open/close animation plays. The table's Folder column
-// reads the same entryByRef the scoping uses, so the displayed folder always matches where the dashboard is.
+// expandedFolders reducer so collapsing sticks and the open/close animation plays.
export function DashboardsTree(): JSX.Element {
const {
folderTree,
currentFolder,
currentSubtreeDashboards,
- entryByRef,
expandedFolders,
folderEntryByPath,
folderDashboardCounts,
@@ -202,11 +200,7 @@ export function DashboardsTree(): JSX.Element {
</div>
</div>
<div className="min-w-0" data-attr="dashboards-tree-content">
- <DashboardsTable
- dashboards={currentSubtreeDashboards}
- dashboardsLoading={dashboardsLoading}
- dashboardFsEntry={(id) => entryByRef[String(id)]}
- />
+ <DashboardsTable dashboards={currentSubtreeDashboards} dashboardsLoading={dashboardsLoading} />
</div>
</div>
)
diff --git a/products/dashboards/frontend/generated/api.schemas.ts b/products/dashboards/frontend/generated/api.schemas.ts
index 0c2d4a3b3530..75dd393417da 100644
--- a/products/dashboards/frontend/generated/api.schemas.ts
+++ b/products/dashboards/frontend/generated/api.schemas.ts
@@ -257,6 +257,16 @@ export interface DashboardBasicApi {
* @nullable
*/
readonly folder: string | null
+ /**
+ * Id of this dashboard's file system entry, or null when it has none. Together with `file_system_path` this is everything a caller needs to move the dashboard between folders, so a list page does not have to look the entry up separately.
+ * @nullable
+ */
+ readonly file_system_id: string | null
+ /**
+ * Full path of this dashboard's file system entry, e.g. 'Unfiled/Dashboards/Revenue'. Unlike `folder` this keeps the dashboard's own name as the last segment, which is what a move needs in order to compute the destination path. Null when it has no entry.
+ * @nullable
+ */
+ readonly file_system_path: string | null
readonly is_shared: boolean
readonly deleted: boolean
readonly creation_mode: CreationModeEnumApi
@@ -332,6 +342,16 @@ export interface DashboardApi {
* @nullable
*/
readonly folder: string | null
+ /**
+ * Id of this dashboard's file system entry, or null when it has none. Together with `file_system_path` this is everything a caller needs to move the dashboard between folders, so a list page does not have to look the entry up separately.
+ * @nullable
+ */
+ readonly file_system_id: string | null
+ /**
+ * Full path of this dashboard's file system entry, e.g. 'Unfiled/Dashboards/Revenue'. Unlike `folder` this keeps the dashboard's own name as the last segment, which is what a move needs in order to compute the destination path. Null when it has no entry.
+ * @nullable
+ */
+ readonly file_system_path: string | null
readonly is_shared: boolean
deleted?: boolean
readonly creation_mode: CreationModeEnumApi
diff --git a/products/dashboards/frontend/logics/dashboardsFileSystemLogic.test.ts b/products/dashboards/frontend/logics/dashboardsFileSystemLogic.test.ts
index be70feaf2ebb..88489424b83f 100644
--- a/products/dashboards/frontend/logics/dashboardsFileSystemLogic.test.ts
+++ b/products/dashboards/frontend/logics/dashboardsFileSystemLogic.test.ts
@@ -120,22 +120,60 @@ describe('dashboardsFileSystemLogic', () => {
}) as any
)
await expectLogic(logic, () => {
- projectTreeDataLogic.actions.movedItem(
- { id: 'fs-1', type: 'dashboard', ref: '1', path: 'Marketing/A' } as any,
- 'Marketing/A',
- 'Product/A'
- )
+ projectTreeDataLogic.actions.movesSettled([
+ {
+ item: { id: 'fs-1', type: 'dashboard', ref: '1', path: 'Marketing/A' } as any,
+ oldPath: 'Marketing/A',
+ newPath: 'Product/A',
+ },
+ ])
}).toDispatchActions(['loadDashboardFileSystemEntries', 'loadDashboardFileSystemEntriesSuccess'])
expect(logic.values.entryByRef['1']?.path).toEqual('Product/A')
})
+ it('refetches once for a whole bulk move, and reloads folder rows when any item was a folder', async () => {
+ await expectLogic(logic).toDispatchActions([
+ 'loadDashboardFileSystemEntriesSuccess',
+ 'loadFolderEntriesSuccess',
+ ])
+ ;(api.fileSystem.list as jest.Mock).mockClear()
+
+ // A bulk move announces itself once, however many items it carried. Refetching per item would fire a
+ // full pagination each time, and that concurrent load is what surfaced a folder-load error over a
+ // move that had actually succeeded.
+ await expectLogic(logic, () => {
+ projectTreeDataLogic.actions.movesSettled([
+ {
+ item: { id: 'fld', type: 'folder', path: 'Marketing' } as any,
+ oldPath: 'Marketing',
+ newPath: 'Product/Marketing',
+ },
+ {
+ item: { id: 'fs-1', type: 'dashboard', ref: '1', path: 'Marketing/A' } as any,
+ oldPath: 'Marketing/A',
+ newPath: 'Product/A',
+ },
+ {
+ item: { id: 'fs-2', type: 'dashboard', ref: '2', path: 'Marketing/B' } as any,
+ oldPath: 'Marketing/B',
+ newPath: 'Product/B',
+ },
+ ])
+ }).toDispatchActions(['loadDashboardFileSystemEntriesSuccess', 'loadFolderEntriesSuccess'])
+
+ const listedTypes = (api.fileSystem.list as jest.Mock).mock.calls.map(([{ type }]) => type)
+ expect(listedTypes).toEqual(['dashboard', 'folder'])
+ })
+
it('ignores moves of non-dashboard, non-folder items (no wasted refetch)', async () => {
await expectLogic(logic).toDispatchActions([
'loadDashboardFileSystemEntriesSuccess',
'loadFolderEntriesSuccess',
])
;(api.fileSystem.list as jest.Mock).mockClear()
- projectTreeDataLogic.actions.movedItem({ id: 'i-1', type: 'insight', path: 'a' } as any, 'a', 'b')
+ projectTreeDataLogic.actions.movesSettled([
+ { item: { id: 'i-1', type: 'insight', path: 'a' } as any, oldPath: 'a', newPath: 'b' },
+ ])
await expectLogic(logic).toFinishAllListeners()
expect(api.fileSystem.list).not.toHaveBeenCalled()
})
diff --git a/products/dashboards/frontend/logics/dashboardsFileSystemLogic.ts b/products/dashboards/frontend/logics/dashboardsFileSystemLogic.ts
index f18cce55a77b..94aae1140961 100644
--- a/products/dashboards/frontend/logics/dashboardsFileSystemLogic.ts
+++ b/products/dashboards/frontend/logics/dashboardsFileSystemLogic.ts
@@ -7,7 +7,7 @@ import { lemonToast } from 'lib/lemon-ui/LemonToast'
import { withTimeout } from 'lib/utils/async'
import { dashboardsLogic } from 'scenes/dashboard/dashboards/dashboardsLogic'
-import { projectTreeDataLogic } from '~/layout/panel-layout/ProjectTree/projectTreeDataLogic'
+import { MovedItem, projectTreeDataLogic } from '~/layout/panel-layout/ProjectTree/projectTreeDataLogic'
import { joinPath, splitPath } from '~/layout/panel-layout/ProjectTree/utils'
import { dashboardsModel } from '~/models/dashboardsModel'
import { FileSystemEntry } from '~/queries/schema/schema-general'
@@ -103,6 +103,9 @@ export interface dashboardsFileSystemLogicActions {
newPath: string
oldPath: string
} // projectTreeDataLogic
+ movesSettled: (moved: MovedItem[]) => {
+ moved: MovedItem[]
+ } // projectTreeDataLogic
createFolder: (
name: string,
parentPath?: string
@@ -204,7 +207,7 @@ export const dashboardsFileSystemLogic = kea<dashboardsFileSystemLogicType>([
path(['products', 'dashboards', 'dashboardsFileSystemLogic']),
connect(() => ({
values: [dashboardsLogic, ['dashboards']],
- actions: [projectTreeDataLogic, ['createSavedItem', 'movedItem', 'deleteItem']],
+ actions: [projectTreeDataLogic, ['createSavedItem', 'movedItem', 'movesSettled', 'deleteItem']],
})),
actions({
// Tree arm: select a folder ('' = the dashboards root).
@@ -314,15 +317,17 @@ export const dashboardsFileSystemLogic = kea<dashboardsFileSystemLogicType>([
[dashboardsModel.actionTypes.duplicateDashboardSuccess]: () => {
actions.loadDashboardFileSystemEntries()
},
- // A move lands as movedItem AFTER the server commit (the table's "Move to" action goes through the
- // shared move path). A dashboard move changes its own path; a folder move re-parents the dashboards
- // beneath it (and the folder rows). Other item types (insights, notebooks) don't affect this view,
- // so skip the refetch for them.
- [projectTreeDataLogic.actionTypes.movedItem]: ({ item }: { item: FileSystemEntry }) => {
- if (item.type === 'dashboard' || item.type === 'folder') {
- actions.loadDashboardFileSystemEntries()
+ // Listening for the settled operation rather than for each `movedItem` is what keeps a bulk move to
+ // one refetch: a real boundary, instead of a window long enough to guess that no more are coming.
+ // A dashboard move changes its own path; a folder move re-parents the dashboards beneath it and the
+ // folder rows. Other item types (insights, notebooks) don't affect this view.
+ [projectTreeDataLogic.actionTypes.movesSettled]: ({ moved }: { moved: MovedItem[] }) => {
+ const movedTypes = new Set(moved.map(({ item }) => item.type))
+ if (!movedTypes.has('dashboard') && !movedTypes.has('folder')) {
+ return
}
- if (item.type === 'folder') {
+ actions.loadDashboardFileSystemEntries()
+ if (movedTypes.has('folder')) {
actions.loadFolderEntries()
}
},
@@ -370,8 +375,11 @@ export const dashboardsFileSystemLogic = kea<dashboardsFileSystemLogicType>([
}
try {
await api.fileSystem.move(entry.id, newPath)
- // movedItem syncs the sidebar's store and (via our own listener below) refetches this tree.
+ // Two different things, both needed: the first re-paths this folder's row in the sidebar's
+ // store, the second says the operation is over so the refetch listener below runs. A rename
+ // calls the move API directly rather than going through `moveItems`, so nothing else emits it.
actions.movedItem(entry, entry.path, newPath)
+ actions.movesSettled([{ item: entry, oldPath: entry.path, newPath }])
// Re-point the scope if we were inside the renamed folder — or a descendant of it, which moves
// with it. (deleteSavedItem falls back to root because the folder is gone; rename keeps it.)
if (values.currentFolder === entry.path) {
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 93467a1c60c5..4cb0251e7301 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -18407,6 +18407,16 @@ export namespace Schemas {
* @nullable
*/
readonly folder: string | null;
+ /**
+ * Id of this dashboard's file system entry, or null when it has none. Together with `file_system_path` this is everything a caller needs to move the dashboard between folders, so a list page does not have to look the entry up separately.
+ * @nullable
+ */
+ readonly file_system_id: string | null;
+ /**
+ * Full path of this dashboard's file system entry, e.g. 'Unfiled/Dashboards/Revenue'. Unlike `folder` this keeps the dashboard's own name as the last segment, which is what a move needs in order to compute the destination path. Null when it has no entry.
+ * @nullable
+ */
+ readonly file_system_path: string | null;
readonly is_shared: boolean;
deleted?: boolean;
readonly creation_mode: CreationModeEnum;
@@ -18481,6 +18491,16 @@ export namespace Schemas {
* @nullable
*/
readonly folder: string | null;
+ /**
+ * Id of this dashboard's file system entry, or null when it has none. Together with `file_system_path` this is everything a caller needs to move the dashboard between folders, so a list page does not have to look the entry up separately.
+ * @nullable
+ */
+ readonly file_system_id: string | null;
+ /**
+ * Full path of this dashboard's file system entry, e.g. 'Unfiled/Dashboards/Revenue'. Unlike `folder` this keeps the dashboard's own name as the last segment, which is what a move needs in order to compute the destination path. Null when it has no entry.
+ * @nullable
+ */
+ readonly file_system_path: string | null;
readonly is_shared: boolean;
readonly deleted: boolean;
readonly creation_mode: CreationModeEnum;