Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(data-warehouse): modeling ui #24587

Merged
merged 51 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
8fc3625
move again
EDsCODE Aug 15, 2024
60a468e
Update UI snapshots for `chromium` (1)
github-actions[bot] Aug 15, 2024
e0ed222
wip
EDsCODE Aug 15, 2024
9e5481d
add tab to onboarding
EDsCODE Aug 15, 2024
476d52c
Merge branch 'dw-move-tab-2' of github.com:PostHog/posthog into dw-mo…
EDsCODE Aug 15, 2024
dd33696
Merge branch 'dw-move-tab-2' into dw-data-model-ui
EDsCODE Aug 15, 2024
6ddf82d
use ui
EDsCODE Aug 16, 2024
700c354
working pathing
EDsCODE Aug 26, 2024
6551492
mvoe files
EDsCODE Aug 26, 2024
def0c19
merge master
EDsCODE Aug 26, 2024
4f9dcc2
Update UI snapshots for `chromium` (1)
github-actions[bot] Aug 26, 2024
03866a5
merge master
EDsCODE Aug 28, 2024
e9a5964
Merge branch 'dw-data-model-ui' of github.com:PostHog/posthog into dw…
EDsCODE Aug 28, 2024
da57aae
Update UI snapshots for `chromium` (1)
github-actions[bot] Aug 28, 2024
23ce5ae
refactor edges
EDsCODE Aug 29, 2024
3b9e351
Merge branch 'dw-data-model-ui' of github.com:PostHog/posthog into dw…
EDsCODE Aug 29, 2024
6a8be5c
add example
EDsCODE Aug 29, 2024
160c8ba
refactor types and data
EDsCODE Aug 29, 2024
90fa06c
refactor table name
EDsCODE Aug 29, 2024
879d9a1
Merge branch 'master' into dw-data-model-ui
EDsCODE Aug 29, 2024
f59ebb2
logic working
EDsCODE Aug 29, 2024
0e3c3f8
use view names
EDsCODE Aug 29, 2024
8fd5f1d
fixed boundaries
EDsCODE Aug 29, 2024
6cd3833
updated nav
EDsCODE Aug 29, 2024
43234c3
merge main
EDsCODE Aug 29, 2024
663ad0e
Update UI snapshots for `chromium` (1)
github-actions[bot] Aug 29, 2024
39a6263
cleanup
EDsCODE Aug 30, 2024
262e65f
Merge branch 'dw-data-model-ui' of github.com:PostHog/posthog into dw…
EDsCODE Aug 30, 2024
62f3440
merge main
EDsCODE Aug 30, 2024
aa2aa5c
test types
EDsCODE Aug 30, 2024
214051a
Update query snapshots
github-actions[bot] Aug 30, 2024
42087a6
typing
EDsCODE Aug 30, 2024
f035962
Merge branch 'dw-data-model-ui' of github.com:PostHog/posthog into dw…
EDsCODE Aug 30, 2024
fb942c4
remove uuid
EDsCODE Aug 30, 2024
8544c14
merge main
EDsCODE Sep 4, 2024
775f345
touchups
EDsCODE Sep 4, 2024
6dbc269
Merge branch 'master' into dw-data-model-ui
EDsCODE Sep 4, 2024
312de24
use new api
EDsCODE Sep 4, 2024
b21187b
reformat
EDsCODE Sep 4, 2024
9c1241f
Merge branch 'master' into dw-data-model-ui
EDsCODE Sep 4, 2024
445272d
typing
EDsCODE Sep 4, 2024
7f4d8c8
Merge branch 'dw-data-model-ui' of github.com:PostHog/posthog into dw…
EDsCODE Sep 4, 2024
e6f5ea9
update tests
EDsCODE Sep 4, 2024
f2cddf6
Update UI snapshots for `chromium` (2)
github-actions[bot] Sep 4, 2024
42dc083
Update UI snapshots for `chromium` (2)
github-actions[bot] Sep 4, 2024
0038304
Update UI snapshots for `chromium` (2)
github-actions[bot] Sep 4, 2024
0e50c6a
Update UI snapshots for `chromium` (2)
github-actions[bot] Sep 4, 2024
6e5edb6
refactor
EDsCODE Sep 6, 2024
71b7e84
Merge branch 'dw-data-model-ui' of github.com:PostHog/posthog into dw…
EDsCODE Sep 6, 2024
8129ef8
add comment
EDsCODE Sep 6, 2024
3c42eb5
typing
EDsCODE Sep 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions frontend/src/layout/navigation-3000/Navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@
display: flex;
flex-direction: column;
}

&.Navigation3000__scene--canvas {
--scene-padding: 0px;

display: flex;
flex-direction: column;
overflow: hidden;
}
}

// Navbar
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/layout/navigation-3000/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export function Navigation({
className={clsx(
'Navigation3000__scene',
// Hack - once we only have 3000 the "minimal" scenes should become "app-raw"
sceneConfig?.layout === 'app-raw' && 'Navigation3000__scene--raw'
sceneConfig?.layout === 'app-raw' && 'Navigation3000__scene--raw',
sceneConfig?.layout === 'app-canvas' && 'Navigation3000__scene--canvas'
)}
>
{!sceneConfig?.hideBillingNotice && <BillingAlertsV2 />}
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/layout/navigation-3000/navigationLogic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,14 @@ export const navigation3000Logic = kea<navigation3000LogicType>([
icon: <IconServer />,
to: isUsingSidebar ? undefined : urls.dataWarehouse(),
},
featureFlags[FEATURE_FLAGS.DATA_MODELING] && hasOnboardedAnyProduct
? {
identifier: Scene.DataModel,
label: 'Data model',
icon: <IconServer />,
to: isUsingSidebar ? undefined : urls.dataModel(),
}
: null,
hasOnboardedAnyProduct
? {
identifier: Scene.Pipeline,
Expand Down
12 changes: 12 additions & 0 deletions frontend/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2072,6 +2072,18 @@ const api = {
): Promise<DataWarehouseSavedQuery> {
return await new ApiRequest().dataWarehouseSavedQuery(viewId).update({ data })
},
async ancestors(viewId: DataWarehouseSavedQuery['id'], level?: number): Promise<Record<string, string[]>> {
return await new ApiRequest()
.dataWarehouseSavedQuery(viewId)
.withAction('ancestors')
.create({ data: { level } })
},
async descendants(viewId: DataWarehouseSavedQuery['id'], level?: number): Promise<Record<string, string[]>> {
return await new ApiRequest()
.dataWarehouseSavedQuery(viewId)
.withAction('descendants')
.create({ data: { level } })
},
},
externalDataSources: {
async list(options?: ApiMethodOptions | undefined): Promise<PaginatedResponse<ExternalDataStripeSource>> {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ export const FEATURE_FLAGS = {
WEB_ANALYTICS_REPLAY: 'web-analytics-replay', // owner: @robbie-c
BATCH_EXPORTS_POSTHOG_HTTP: 'posthog-http-batch-exports',
EXPERIMENT_MAKE_DECISION: 'experiment-make-decision', // owner: @jurajmajerik #team-feature-success
DATA_MODELING: 'data-modeling', // owner: @EDsCODE #team-data-warehouse
WEB_ANALYTICS_CONVERSION_GOALS: 'web-analytics-conversion-goals', // owner: @robbie-c
WEB_ANALYTICS_LAST_CLICK: 'web-analytics-last-click', // owner: @robbie-c
} as const
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/queries/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3441,6 +3441,9 @@
"hogql_value": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
Expand Down
1 change: 1 addition & 0 deletions frontend/src/queries/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1690,6 +1690,7 @@ export interface DatabaseSchemaField {
table?: string
fields?: string[]
chain?: (string | integer)[]
id?: string
}

export interface DatabaseSchemaTableCommon {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/appScenes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const appScenes: Record<Scene, () => any> = {
[Scene.Surveys]: () => import('./surveys/Surveys'),
[Scene.Survey]: () => import('./surveys/Survey'),
[Scene.SurveyTemplates]: () => import('./surveys/SurveyTemplates'),
[Scene.DataModel]: () => import('./data-model/DataModelScene'),
[Scene.DataWarehouse]: () => import('./data-warehouse/external/DataWarehouseExternalScene'),
[Scene.DataWarehouseTable]: () => import('./data-warehouse/new/NewSourceWizard'),
[Scene.DataWarehouseExternal]: () => import('./data-warehouse/external/DataWarehouseExternalScene'),
Expand Down
27 changes: 27 additions & 0 deletions frontend/src/scenes/data-model/DataModelScene.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { useValues } from 'kea'
import { ViewLinkModal } from 'scenes/data-warehouse/ViewLinkModal'
import { SceneExport } from 'scenes/sceneTypes'

import { dataModelSceneLogic } from './dataModelSceneLogic'
import NodeCanvasWithTable from './NodeCanvasWithTable'

export const scene: SceneExport = {
component: DataModelScene,
logic: dataModelSceneLogic,
}

export function DataModelScene(): JSX.Element {
const { simplifiedPersonFields, joinedFieldsAsNodes, allNodes } = useValues(dataModelSceneLogic)

return (
<>
<NodeCanvasWithTable
nodes={allNodes}
fixedFields={simplifiedPersonFields}
joinedFields={joinedFieldsAsNodes}
tableName="persons"
/>
<ViewLinkModal />
</>
)
}
20 changes: 20 additions & 0 deletions frontend/src/scenes/data-model/Node.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
interface NodeProps {
pref: (el: HTMLDivElement | null) => void
width?: string
height?: string
className?: string
children: React.ReactNode
}

function GenericNode({ pref, className = '', children }: NodeProps): JSX.Element {
return (
<div
ref={pref}
className={`flex max-w-[200px] px-4 py-3 justify-center items-center space-between gap-1 bg-bg-3000 border border-black border-2 rounded-lg truncate ${className}`}
>
{children}
</div>
)
}

export default GenericNode
Loading
Loading