Skip to content

Remove timeline graph type radio buttons#4147

Merged
canova merged 8 commits into
firefox-devtools:mainfrom
canova:remove-graph-type-radio
Jul 25, 2022
Merged

Remove timeline graph type radio buttons#4147
canova merged 8 commits into
firefox-devtools:mainfrom
canova:remove-graph-type-radio

Conversation

@canova

@canova canova commented Jul 18, 2022

Copy link
Copy Markdown
Member

Finally I went ahead and removed our famous graph type radio buttons 😄
With this PR, it should work like explained in #3150. I've also added a function to window, so our power users still can access and change if they really need to.
This PR also removes some of the unused parts in the timeline and removes the now empty line after removing these radio buttons.

Fixes #3150
Fixes #3443

Example profile with CPU and category data: before / after
Example profile with category but without CPU data: before / after
Example profile without CPU and category data: before / after
Example chome profile: before / after
Example perf profile: before / after
Example profile for testing url upgrader: after

@canova canova requested a review from a team as a code owner July 18, 2022 18:07
@canova canova requested a review from julienw July 18, 2022 18:09
@codecov

codecov Bot commented Jul 18, 2022

Copy link
Copy Markdown

Codecov Report

Merging #4147 (20397bb) into main (561bc31) will increase coverage by 0.02%.
The diff coverage is 76.92%.

@@            Coverage Diff             @@
##             main    #4147      +/-   ##
==========================================
+ Coverage   88.28%   88.31%   +0.02%     
==========================================
  Files         280      280              
  Lines       24414    24408       -6     
  Branches     6490     6488       -2     
==========================================
+ Hits        21554    21555       +1     
+ Misses       2656     2650       -6     
+ Partials      204      203       -1     
Impacted Files Coverage Δ
src/app-logic/constants.js 100.00% <ø> (ø)
src/components/timeline/FullTimeline.js 100.00% <ø> (+34.21%) ⬆️
src/components/timeline/TrackThread.js 92.20% <ø> (ø)
src/selectors/app.js 55.12% <ø> (-0.29%) ⬇️
src/utils/window-console.js 40.90% <11.11%> (-4.71%) ⬇️
src/app-logic/url-handling.js 86.50% <92.30%> (+0.93%) ⬆️
src/actions/receive-profile.js 85.84% <100.00%> (-0.26%) ⬇️
src/components/shared/thread/ActivityGraph.js 89.79% <100.00%> (+0.43%) ⬆️
src/profile-logic/profile-data.js 90.38% <100.00%> (+0.06%) ⬆️
src/reducers/url-state.js 96.84% <100.00%> (-0.02%) ⬇️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 561bc31...20397bb. Read the comment docs.

@julienw julienw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, this looks good to me!

I only have one important comment about where we can compute the timelineType. Tell me what you think!

Comment on lines +137 to +139
❗ The timeline type "${timelineType}" is unknown.
💡 Valid types are: "cpu-category", "category", or "stack".
Please try again 😊

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good choice of emojis 🤩

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Actually I copy/pasted most of it from another function here 😄

Comment on lines -1558 to +1619
search: '',
search: `?v=${CURRENT_URL_VERSION}`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just wondering why this is needed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If the version number is not there, it tries to upgrade the url first. Since we change the default value from 'category' to 'cpu-category', it prints 'category' here in this test. But this test is not checking the upgrader at all, so it should not check this path and focus only on the default parameters.

class="photon-label photon-label-micro timelineSettingsToggleLabel"
>
<input
checked=""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do you know why this change happened?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

and now the full snapshot is removed so.... let's not focus on that :D

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, I removed this test, but to give you more context. We did multiple things that affected this in the first place:

  1. Make the cpu-category the default one
  2. Properly upgrade the old profiles.

So the 1 makes this unchecked and 2 makes it checked again. But since it's removed, we don't need to worry about it now.

class="photon-label photon-label-micro timelineSettingsToggleLabel"
>
<input
checked=""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

oh it's back 🤔

Comment thread src/reducers/url-state.js Outdated
Comment on lines 234 to 235
case 'PROFILE_LOADED':
if (!action.profile.meta.categories) {
// An imported profile did not provide its own categories. Use the stack view instead.
return 'stack';
}
return state;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

idea: use determineTimelineType here, and remove the property from the actions VIEW_..._PROFILE.

This looks conceptually more correct to me because (in theory) the reduces is where the computation should happen.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's not 100% clear to me how everything is organized at load time, but it seems to be that this would work because the sequence is:

  1. LOAD_PROFILE
  2. UPDATE_URL_STATE
  3. finalizeProfileView calling VIEW_..._PROFILE

Therefore the information from the URL would override what's set in LOAD_PROFILE, which is what we're trying to do in finalizeProfileView.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what do you think?
I'm fine if you want to do it in a separate PR, however it would be good to do it soon while it's fresh in our heads.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(note: if we decide to not do this, then you can remove thiscase block here)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You are right about the order of the actions. But there is one problem with the UPDATE_URL_STATE.
When we add it to the LOAD_PROFILE it changes the url state. But then, during the UPDATE_URL_STATE, it actually replaces the whole urlState object with a new one. Because of this, whenever we update the url state during the LOAD_PROFILE, it's going to be overwritten no matter what. Because of this, we need to do it during the finalize function to make sure that we have a new url state and we can do this addition afterwards depending on the profile data. So unfortunately, we can't change it during the LOAD_PROFILE action.

I will remove this case from the reducer instead.

Comment on lines +371 to 373
urlState.profileSpecific.timelineType === 'cpu-category'
? undefined
: urlState.profileSpecific.timelineType,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I was wondering about not adding it at all if the type is the default (computed) one. But we'd need the profile data, and we don't have it here. Then I'm fine with this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, I think it should be easiest to make the 'cpu-category' the default. Otherwise we need the profile which makes it harder.

@canova canova left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks for the review @julienw. Could you take a look at it again?

Comment on lines +137 to +139
❗ The timeline type "${timelineType}" is unknown.
💡 Valid types are: "cpu-category", "category", or "stack".
Please try again 😊

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Actually I copy/pasted most of it from another function here 😄

Comment on lines -1558 to +1619
search: '',
search: `?v=${CURRENT_URL_VERSION}`,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If the version number is not there, it tries to upgrade the url first. Since we change the default value from 'category' to 'cpu-category', it prints 'category' here in this test. But this test is not checking the upgrader at all, so it should not check this path and focus only on the default parameters.

class="photon-label photon-label-micro timelineSettingsToggleLabel"
>
<input
checked=""

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, I removed this test, but to give you more context. We did multiple things that affected this in the first place:

  1. Make the cpu-category the default one
  2. Properly upgrade the old profiles.

So the 1 makes this unchecked and 2 makes it checked again. But since it's removed, we don't need to worry about it now.

Comment on lines +371 to 373
urlState.profileSpecific.timelineType === 'cpu-category'
? undefined
: urlState.profileSpecific.timelineType,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, I think it should be easiest to make the 'cpu-category' the default. Otherwise we need the profile which makes it harder.

Comment thread src/reducers/url-state.js Outdated
Comment on lines 234 to 235
case 'PROFILE_LOADED':
if (!action.profile.meta.categories) {
// An imported profile did not provide its own categories. Use the stack view instead.
return 'stack';
}
return state;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You are right about the order of the actions. But there is one problem with the UPDATE_URL_STATE.
When we add it to the LOAD_PROFILE it changes the url state. But then, during the UPDATE_URL_STATE, it actually replaces the whole urlState object with a new one. Because of this, whenever we update the url state during the LOAD_PROFILE, it's going to be overwritten no matter what. Because of this, we need to do it during the finalize function to make sure that we have a new url state and we can do this addition afterwards depending on the profile data. So unfortunately, we can't change it during the LOAD_PROFILE action.

I will remove this case from the reducer instead.

@canova canova force-pushed the remove-graph-type-radio branch from 20fd22f to 0fe0988 Compare July 20, 2022 14:16
@canova canova requested a review from julienw July 20, 2022 14:26

@julienw julienw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

makes sense, thanks for the cleanup!

@canova canova force-pushed the remove-graph-type-radio branch from 0fe0988 to 20397bb Compare July 25, 2022 14:17
@canova canova merged commit 2431ece into firefox-devtools:main Jul 25, 2022
@canova canova deleted the remove-graph-type-radio branch July 25, 2022 14:30
@canova canova mentioned this pull request Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants