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

Improve event properties display #1825

Merged
merged 3 commits into from
Oct 9, 2020
Merged

Conversation

timgl
Copy link
Collaborator

@timgl timgl commented Oct 8, 2020

Changes

  • Makes URLs clickable
  • Hide a handful of properties that aren't relevant (with option to show them, see toggle)
    image
  • Make an exception event red in the events list
    image

Checklist

  • All querysets/queries filter by Team (if this PR affects any querysets/queries)
  • Backend tests (if this PR affects the backend)
  • Cypress E2E tests (if this PR affects the front and/or backend)

@timgl timgl requested review from macobo and yakkomajuri October 8, 2020 10:48
frontend/src/scenes/events/EventDetails.js Outdated Show resolved Hide resolved
for (let key of Object.keys(event.properties)) {
if (key !== '$snapshot_data') displayableEventProperties[key] = event.properties[key]
if (keyMapping.event[key] && keyMapping.event[key].hide) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: I think lodash would clean things up a lot here, would it make sense to introduce it?

import { omit, pick, keys } from 'lodash' 

const hideableKeys = pick(keys(event.properties), (key) => keyMapping[key].hide)
const displayedProperties = showHiddenProps ? event.properties : omit(event.properties, hideableKeys)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I disagree this is more readable, especially if you're familiar with lodash. I'm also really loath to add more libraries in general!

frontend/src/lib/utils.js Show resolved Hide resolved
@timgl timgl temporarily deployed to posthog-improve-event-p-elw5dm October 9, 2020 14:30 Inactive
@timgl timgl merged commit a51942b into master Oct 9, 2020
@timgl timgl deleted the improve-event-properties-display branch October 9, 2020 14:46
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.

2 participants