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

fix(dashboards): Move generated dashboards to bottom by default #17070

Merged
merged 40 commits into from
Aug 22, 2023

Conversation

neilkakkar
Copy link
Contributor

@neilkakkar neilkakkar commented Aug 17, 2023

Problem

We generate dashboards for users for all feature flags.

This can lead to annoyances when listing dashboards, as generated ones overwhelm your own.

This PR removes them from the list, and only allows editing these dashboards via the feature flag usage tab, where they were generated.

This PR makes it such that generated ones are at the bottom by default, unless:

  1. You change the name (hence indicating interest in doing something more with the dashboard)
  2. You're sorting by something relevant

Changes

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

How did you test this code?

@neilkakkar neilkakkar marked this pull request as ready for review August 17, 2023 10:23
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

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

  • chromium: 0 added, 1 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.

Copy link
Contributor

@liyiy liyiy left a comment

Choose a reason for hiding this comment

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

I'll let team PA be the final reviewer of this. This is definitely way better than having a bunch of unwanted dashboards polluting the table, though do people even click them from the dashboards page itself at all? Why not just filter them out for just the dashboards page completely? 🤔

@neilkakkar
Copy link
Contributor Author

I wanted them around to let people edit things, but good point, I can link them directly to the dashboard to edit from the usage tab itself.

Will do that, and remove all mention from the list. 👍

Copy link
Member

@Twixes Twixes left a comment

Choose a reason for hiding this comment

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

Makes a ton of sense, just a couple minor comments

Twixes
Twixes previously requested changes Aug 21, 2023
(a.name ?? 'Untitled').localeCompare(b.name ?? 'Untitled')
)
return [...Object.values(rawDashboards)]
.filter((dashboard) => !(dashboard.name ?? 'Untitled').startsWith(GENERATED_DASHBOARD_PREFIX))
Copy link
Member

Choose a reason for hiding this comment

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

Wait, if the ones starting with GENERATED_DASHBOARD_PREFIX are filtered out, it doesn't make sense to sort by that prefix, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not here, but, this isn't the only place the comparison function is used, and I wanted to keep the function standard for sorting wherever you want to sort dashboards, so if, say, you're sorting raw dashboards somewhere, they're still at the end. Seemed less error prone.

Happy to remove generated prefix from the sorting function if you feel strongly about this

Copy link
Member

Choose a reason for hiding this comment

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

Right, but nameSortedDashboards is the source for all our lists of dashboards, so if we filtered out the generated dashboards, they won't be displayed at the bottom anymore – they will be just hidden. From the description of the PR I thought that that's not the intention

Copy link
Contributor Author

Choose a reason for hiding this comment

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

original intention yes, but based on Li's comment, am removing them completely from the list, and adding a link to the usage dashboard to get to the main db, will update description 😅

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I missed that, was still looking at the PR title 😅 In that case nameCompareFunction handling is unused in this PR, so would be better to revert that addition

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd argue that it at least unifies the current 3 places where we manually write the same function again, would you be fine with me removing the generated prefix from it but keeping the function, or do you want me to get rid of it completely?

Copy link
Member

Choose a reason for hiding this comment

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

No, yeah, the function makes sense. Just the prefix handling that's not going to be used

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

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

  • chromium: 0 added, 1 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

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

  • chromium: 0 added, 1 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.

@neilkakkar neilkakkar enabled auto-merge (squash) August 22, 2023 09:35
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 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 (wasn't pushed!)
  • 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

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

  • chromium: 0 added, 1 modified, 0 deleted (wasn't pushed!)
  • 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:

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:

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 (wasn't pushed!)
  • 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

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

  • chromium: 0 added, 1 modified, 0 deleted (wasn't pushed!)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@neilkakkar neilkakkar disabled auto-merge August 22, 2023 11:19
@neilkakkar
Copy link
Contributor Author

@Twixes 0.05 didn't help, so I bumped up to 0.08

@neilkakkar neilkakkar merged commit bb53a51 into master Aug 22, 2023
@neilkakkar neilkakkar deleted the gen-dash branch August 22, 2023 13:07
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