10000 feat(data-warehouse): new SQL layout by EDsCODE · Pull Request #25686 · PostHog/posthog · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(data-warehouse): new SQL layout #25686

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

Merged
merged 26 commits into from
Nov 11, 2024
Merged

feat(data-warehouse): new SQL layout #25686

merged 26 commits into from
Nov 11, 2024

Conversation

EDsCODE
Copy link
Member
@EDsCODE EDsCODE commented Oct 18, 2024

Problem

  • current SQL editor is clunky

Changes

  • set the foundation layout for new editor
  • full screen with resizable editor and result sections
  • multitab
  • styling WIP
Screenshot 2024-11-07 at 6 27 04 PM

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

How did you test this code?

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

4 snapshot changes in total. 0 added, 4 modified, 0 deleted:

  • chromium: 0 added, 4 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

4 snapshot changes in total. 0 added, 4 modified, 0 deleted:

  • chromium: 0 added, 4 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week. If you want to permanentely keep it open, use the waiting label.

@posthog-bot
Copy link
Contributor

This PR was closed due to lack of activity. Feel free to reopen if it's still relevant.

@posthog-bot posthog-bot closed this Nov 4, 2024
@EDsCODE EDsCODE removed the stale label Nov 4, 2024
@EDsCODE EDsCODE reopened this Nov 4, 2024
Copy link
Contributor
github-actions bot commented Nov 7, 2024

Size Change: +45 B (0%)

Total Size: 1.15 MB

ℹ️ View Unchanged
Filename Size Change
frontend/dist/toolbar.js 1.15 MB +45 B (0%)

compressed-size-action

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

6 snapshot changes in total. 0 added, 6 modified, 0 deleted:

  • chromium: 0 added, 6 modified, 0 deleted (diff for shard 2)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@EDsCODE EDsCODE marked this pull request as ready for review November 7, 2024 23:27
Copy link
Contributor
@tomasfarias tomasfarias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Copy link
Member
@Gilbert09 Gilbert09 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to merge this to get it out, but, I really think we should address my large comment about editor logic and building better support for a multi-tabbed editor disconnected from the query object - we should get that right before building new features IMO, but happy to discuss this in standup today

@@ -173,6 +173,7 @@ export const urls = {
dataWarehouse: (query?: string | Record<string, any>): string =>
combineUrl(`/data-warehouse`, {}, query ? { q: typeof query === 'string' ? query : JSON.stringify(query) } : {})
.url,
sqlEditor: (): string => `/sql`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want this to be /sql-editor? Not that fussed either way, but it may be a bit clearer. Also, are we fine with using SQL and not HogQL everywhere? I think yes, but wanted to mention it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

temporary path just for testing purposes

if (monaco) {
const uri = monaco.Uri.parse(model.path)
const newModel = monaco.editor.createModel(model.query, 'hogQL', uri)
editor?.setModel(newModel)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the last saved model will be the one selected in the UI? May be good to break this out of this forEach loop

Comment on lines +148 to +154
onPressCmdEnter: (value, selectionType) => {
if (value && selectionType === 'selection') {
saveQuery(value)
} else {
saveQuery()
}
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is the existing logic right now, but I wanna get away from this model of being able to "save" a selection of the query from the editor - this sets the inner setQuery of hogQLQueryEditorLogic.

Ultimately, I'd like a pattern here where the HogQL query is separated from the editor itself. We have a bunch of workarounds and less-than-ideal UX due to how the editor logic works in conjunction with dataNodeLogic, and this is a chance to completely rewrite that. An example of this is: if you update the text in the hogql editor and don't run it but save it - the query text of the last run is whats saved and not whats currently in your editor = bad and weird UX.

I'd consider thinking about writing a new logic for managing all of this model state along with the appropriate components - the current set up really isn't designed with tabs in mind. We can fix this now before its too late and becomes a tough situation later

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you update the text in the hogql editor and don't run it but save it - the query text of the last run is whats saved and not whats currently in your editor = bad and weird UX.

This actually isn't an issue with how I used datanodelogic right now. DataNodeLogic right now is mainly used to just be fed a query and return some results. The actual query that's handled by the saving vs the editing is decoupled with a component state var setActiveQueryInput.

But, overall I do agree this logic needs some rethinking. I worked this in for now to get an idea of dependencies of the current editor but definitely open to making a new logic as there's a good bit of logic that's sitting inside the component/onMount handler

@EDsCODE EDsCODE merged commit 6be1ada into master Nov 11, 2024
96 checks passed
@EDsCODE EDsCODE deleted the dw-editor-layout branch November 11, 2024 20:30
@EDsCODE EDsCODE mentioned this pull request Nov 14, 2024
34 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0