-
Notifications
You must be signed in to change notification settings - Fork 479
Implement container that gives additional information on the profile setting #4222
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
Changes from all commits
9f749b6
983e8af
8460910
6ee1566
3cc8b5f
feb442b
b0211d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,8 +10,10 @@ import { MetaOverheadStatistics } from './MetaOverheadStatistics'; | |
| import { | ||
| getProfile, | ||
| getSymbolicationStatus, | ||
| getProfileExtraInfo, | ||
| } from 'firefox-profiler/selectors/profile'; | ||
| import { resymbolicateProfile } from 'firefox-profiler/actions/receive-profile'; | ||
| import { formatFromMarkerSchema } from 'firefox-profiler/profile-logic/marker-schema'; | ||
|
|
||
| import { | ||
| formatBytes, | ||
|
|
@@ -25,14 +27,23 @@ import { | |
| import { assertExhaustiveCheck } from 'firefox-profiler/utils/flow'; | ||
| import explicitConnect from 'firefox-profiler/utils/connect'; | ||
|
|
||
| import type { Profile, SymbolicationStatus } from 'firefox-profiler/types'; | ||
| import type { | ||
| Profile, | ||
| SymbolicationStatus, | ||
| ExtraProfileInfoSection, | ||
| } from 'firefox-profiler/types'; | ||
| import type { ConnectedProps } from 'firefox-profiler/utils/connect'; | ||
|
|
||
| import './MetaInfo.css'; | ||
|
|
||
| type State = {| | ||
| showsMoreInfo: boolean, | ||
| |}; | ||
|
|
||
| type StateProps = $ReadOnly<{| | ||
| profile: Profile, | ||
| symbolicationStatus: SymbolicationStatus, | ||
| profileExtraInfo: ExtraProfileInfoSection[], | ||
| |}>; | ||
|
|
||
| type DispatchProps = $ReadOnly<{| | ||
|
|
@@ -44,7 +55,9 @@ type Props = ConnectedProps<{||}, StateProps, DispatchProps>; | |
| /** | ||
| * This component formats the profile's meta information into a dropdown panel. | ||
| */ | ||
| class MetaInfoPanelImpl extends React.PureComponent<Props> { | ||
| class MetaInfoPanelImpl extends React.PureComponent<Props, State> { | ||
| state = { showsMoreInfo: false }; | ||
|
|
||
| /** | ||
| * This method provides information about the symbolication status, and a button | ||
| * to re-trigger symbolication. | ||
|
|
@@ -120,6 +133,55 @@ class MetaInfoPanelImpl extends React.PureComponent<Props> { | |
| } | ||
| } | ||
|
|
||
| _handleMoreInfoButtonClick = (event: SyntheticMouseEvent<>) => { | ||
| event.preventDefault(); | ||
| this.setState((state) => ({ showsMoreInfo: !state.showsMoreInfo })); | ||
| }; | ||
|
|
||
| _renderMoreInfoSection(section: ExtraProfileInfoSection) { | ||
| return ( | ||
| <div key={section.label}> | ||
|
parttimenerd marked this conversation as resolved.
|
||
| <h2 className="metaInfoSubTitle">{section.label}</h2> | ||
| <div className="metaInfoSection"> | ||
| {section.entries.map(({ label, format, value }) => { | ||
| return ( | ||
| <div className="moreInfoRow" key={label}> | ||
| <span className="metaInfoWideLabel">{label}</span> | ||
| <div className="moreInfoValue"> | ||
| {formatFromMarkerSchema('moreInfo', format, value)} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same comment applies here: this isn't a marker so this doesn't look appropriate. However I realize that
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As explained before, I'm totally for the changes, but I think they are best in a "Factor out marker formatting" PR which I'll submit after the admission of #4201, if that's ok. |
||
| </div> | ||
| </div> | ||
| ); | ||
| })} | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| _renderMoreInfo() { | ||
| return ( | ||
| <details className="metaInfoRow" open={this.state.showsMoreInfo}> | ||
|
parttimenerd marked this conversation as resolved.
|
||
| <summary | ||
| className="moreInfoSummary photon-button photon-button-default photon-button-micro" | ||
| onClick={this._handleMoreInfoButtonClick} | ||
| > | ||
| <Localized | ||
| id={ | ||
| this.state.showsMoreInfo | ||
| ? `MenuButtons--index--hide-moreInfo-button` | ||
| : `MenuButtons--index--show-moreInfo-button` | ||
| } | ||
| > | ||
| {this.state.showsMoreInfo ? 'Show Less' : 'Show More'} | ||
| </Localized> | ||
| </summary> | ||
| <div className="moreInfoPart"> | ||
| {this.props.profileExtraInfo.map(this._renderMoreInfoSection)} | ||
| </div> | ||
| </details> | ||
| ); | ||
| } | ||
|
|
||
| render() { | ||
| const { meta, profilerOverhead } = this.props.profile; | ||
| const { configuration } = meta; | ||
|
|
@@ -403,6 +465,9 @@ class MetaInfoPanelImpl extends React.PureComponent<Props> { | |
| {profilerOverhead ? ( | ||
| <MetaOverheadStatistics profilerOverhead={profilerOverhead} /> | ||
| ) : null} | ||
| {this.props.profileExtraInfo.length !== 0 | ||
| ? this._renderMoreInfo() | ||
| : null} | ||
| </> | ||
| ); | ||
| } | ||
|
|
@@ -444,6 +509,7 @@ export const MetaInfoPanel = explicitConnect<{||}, StateProps, DispatchProps>({ | |
| mapStateToProps: (state) => ({ | ||
| profile: getProfile(state), | ||
| symbolicationStatus: getSymbolicationStatus(state), | ||
| profileExtraInfo: getProfileExtraInfo(state), | ||
| }), | ||
| mapDispatchToProps: { | ||
| resymbolicateProfile, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.