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(events-graph): Add storybook for new events graph component #70866

Merged
merged 7 commits into from
May 16, 2024

Conversation

MichaelSun48
Copy link
Member

@MichaelSun48 MichaelSun48 commented May 14, 2024

Related ticket: #69691

This PR creates the storybook and initial design for the new events stats graph component, <GroupStatusChart/>. This PR does not change the existing events graph in the issue stream.

The only publicly used file that was modified is miniBarChart.tsx. The <MiniBarChart/> component is the underlying component of the existing events graph component, <GroupChart/>, and it needs to expose more parameters of the graph as props to allow for the modifications in the new <GroupStatusChart/> component to avoid creating an entirely new underlying component. Prop defaults were set for all new props introduced to ensure that the existing event stats chart is visually unchanged.

The new component in its current form:
image

Remaining work to be done (probably in future PRs):

  • Add test file
  • Add loading state
  • Swap old events graph with this one

Open design questions:

  • What should the loading state look like? Gray box (with rounded edges)

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 14, 2024
Comment on lines +8 to +31
// [1715554800, 126],
[1715558400, 112],
// [1715562000, 126],
[1715565600, 113],
// [1715569200, 118],
[1715572800, 87],
// [1715576400, 88],
[1715580000, 59],
// [1715583600, 54],
[1715587200, 55],
// [1715590800, 52],
[1715594400, 48],
// [1715598000, 62],
[1715601600, 86],
// [1715605200, 100],
[1715608800, 121],
// [1715612400, 124],
[1715616000, 129],
// [1715619600, 149],
[1715623200, 141],
// [1715626800, 132],
[1715630400, 133],
// [1715634000, 127],
[1715637600, 82],
Copy link
Member Author

Choose a reason for hiding this comment

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

Half of the 24 entries in this series are commented out to align the storybook more with the existing mockups, which currently only 12 bars. This is what it looks like with all 24 entries enabled:
image

showSecondaryPoints?: boolean;
};

function GroupStatusChart({
Copy link
Member Author

Choose a reason for hiding this comment

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

This new component is largely the same as the pre-existing <GroupChart/> component, but I would still prefer to have work contained in this new file to avoid any unintended changes to the existing component.

@MichaelSun48 MichaelSun48 marked this pull request as ready for review May 14, 2024 16:41
@MichaelSun48 MichaelSun48 requested a review from a team as a code owner May 14, 2024 16:41
@MichaelSun48 MichaelSun48 requested review from malwilley and a team May 14, 2024 16:41
const EMPTY_STATS: ReadonlyArray<TimeseriesValue> = [];

type Props = {
data: Group;
Copy link
Member

Choose a reason for hiding this comment

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

It looks like you only need a couple properties on Group, so it would probably be better to just accept stats and filteredStats. That way mocking is easier and consumers of this component don't need access to the whole group.

Copy link
Member Author

Choose a reason for hiding this comment

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

I completely agree and would take it another step further - the chart component shouldn't even have the responsibility of deciding whether or not to use the filtered or unfiltered stats, especially since it only uses one. The parent component should just decide which one to use and pass the correct stats down to this component.

static/app/components/charts/groupStatusChart.tsx Outdated Show resolved Hide resolved
static/app/components/charts/groupStatusChart.tsx Outdated Show resolved Hide resolved
static/app/components/charts/groupStatusChart.tsx Outdated Show resolved Hide resolved
static/app/components/charts/groupStatusChart.tsx Outdated Show resolved Hide resolved
static/app/components/charts/groupStatusChart.tsx Outdated Show resolved Hide resolved
static/app/components/charts/groupStatusChart.tsx Outdated Show resolved Hide resolved
@MichaelSun48
Copy link
Member Author

@malwilley @scttcper thank you for the feedback!! This is infinitely more readable now

I'll also put up another PR making the same changes to the existing <GroupChart/> component since most of the changes were applied to code that I copy pasted from there.

Copy link

codecov bot commented May 14, 2024

Codecov Report

Attention: Patch coverage is 9.52381% with 19 lines in your changes are missing coverage. Please review.

Project coverage is 80.00%. Comparing base (0b85460) to head (dc96e10).
Report is 14 commits behind head on master.

❗ Current head dc96e10 differs from pull request most recent head 2a9aaf4. Consider uploading reports for the commit 2a9aaf4 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #70866       +/-   ##
===========================================
- Coverage   91.36%   80.00%   -11.37%     
===========================================
  Files        2861     6506     +3645     
  Lines      178780   290857   +112077     
  Branches    31901    50133    +18232     
===========================================
+ Hits       163344   232691    +69347     
- Misses      15435    57732    +42297     
- Partials        1      434      +433     
Files Coverage Δ
static/app/components/charts/miniBarChart.tsx 81.39% <100.00%> (ø)
static/app/components/charts/groupStatusChart.tsx 0.00% <0.00%> (ø)

... and 3643 files with indirect coverage changes

@MichaelSun48
Copy link
Member Author

^ This commit will also round the corners of each bar in the bar chart in prod:

before:
image

after:
image

@MichaelSun48 MichaelSun48 merged commit 7413f9c into master May 16, 2024
42 of 43 checks passed
@MichaelSun48 MichaelSun48 deleted the msun/newEventStatsGraph branch May 16, 2024 17:02
cmanallen pushed a commit that referenced this pull request May 21, 2024
)

Related ticket: #69691

This PR creates the storybook and initial design for the new events
stats graph component, `<GroupStatusChart/>`. **This PR does not change
the existing events graph in the issue stream**.

The only publicly used file that was modified is miniBarChart.tsx. The
`<MiniBarChart/>` component is the underlying component of the existing
events graph component, `<GroupChart/>`, and it needs to expose more
parameters of the graph as props to allow for the modifications in the
new `<GroupStatusChart/>` component to avoid creating an entirely new
underlying component\. Prop defaults were set for all new props
introduced to ensure that the existing event stats chart is visually
unchanged.

The new component in its current form: 

![image](https://github.com/getsentry/sentry/assets/55160142/ff1bbf2d-d3ef-49cf-9536-8302defb2ffd)


Remaining work to be done (probably in future PRs): 
- [ ] Add test file
- [ ] Add loading state
- [ ] **Swap old events graph with this one**

Open design questions:
- [ ] ~~What should the loading state look like?~~ Gray box (with
rounded edges)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants