forked from firefox-devtools/profiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add empty reasons for Flame Graph, Stack Chart, and Marker Table (Mer…
…ge PR firefox-devtools#2159)
- Loading branch information
Showing
14 changed files
with
518 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
// @flow | ||
|
||
import React, { PureComponent } from 'react'; | ||
|
||
import EmptyReasons from '../shared/EmptyReasons'; | ||
import { selectedThreadSelectors } from '../../selectors/per-thread'; | ||
import { oneLine } from 'common-tags'; | ||
import explicitConnect, { type ConnectedProps } from '../../utils/connect'; | ||
|
||
import type { Thread } from '../../types/profile'; | ||
import type { State } from '../../types/store'; | ||
|
||
type StateProps = {| | ||
threadName: string, | ||
rangeFilteredThread: Thread, | ||
thread: Thread, | ||
|}; | ||
|
||
type Props = ConnectedProps<{||}, StateProps, {||}>; | ||
|
||
/** | ||
* This component attempts to tell why exactly a flame graph is empty with no samples | ||
* and display a friendly message to the end user. | ||
*/ | ||
class FlameGraphEmptyReasons extends PureComponent<Props> { | ||
render() { | ||
const { thread, rangeFilteredThread, threadName } = this.props; | ||
let reason; | ||
|
||
if (thread.samples.length === 0) { | ||
reason = 'This thread has no samples.'; | ||
} else if (rangeFilteredThread.samples.length === 0) { | ||
reason = 'Broaden the selected range to view samples.'; | ||
} else { | ||
reason = oneLine` | ||
Try broadening the selected range, removing search terms, or call tree transforms | ||
to view samples. | ||
`; | ||
} | ||
|
||
return ( | ||
<EmptyReasons | ||
threadName={threadName} | ||
reason={reason} | ||
viewName="flame graph" | ||
/> | ||
); | ||
} | ||
} | ||
|
||
export default explicitConnect<{||}, StateProps, {||}>({ | ||
mapStateToProps: (state: State) => ({ | ||
threadName: selectedThreadSelectors.getFriendlyThreadName(state), | ||
thread: selectedThreadSelectors.getThread(state), | ||
rangeFilteredThread: selectedThreadSelectors.getRangeFilteredThread(state), | ||
}), | ||
component: FlameGraphEmptyReasons, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
// @flow | ||
|
||
import React, { PureComponent } from 'react'; | ||
|
||
import EmptyReasons from '../shared/EmptyReasons'; | ||
import { selectedThreadSelectors } from '../../selectors/per-thread'; | ||
|
||
import explicitConnect, { type ConnectedProps } from '../../utils/connect'; | ||
|
||
import type { State } from '../../types/store'; | ||
|
||
type StateProps = {| | ||
+threadName: string, | ||
+isMarkerTableEmptyInFullRange: boolean, | ||
|}; | ||
|
||
type Props = ConnectedProps<{||}, StateProps, {||}>; | ||
class MarkerTableEmptyReasons extends PureComponent<Props> { | ||
render() { | ||
const { isMarkerTableEmptyInFullRange, threadName } = this.props; | ||
|
||
return ( | ||
<EmptyReasons | ||
threadName={threadName} | ||
reason={ | ||
isMarkerTableEmptyInFullRange | ||
? 'This thread contains no markers for this table.' | ||
: 'All markers were filtered out by the current selection or search term.' | ||
} | ||
viewName="marker table" | ||
/> | ||
); | ||
} | ||
} | ||
|
||
export default explicitConnect<{||}, StateProps, {||}>({ | ||
mapStateToProps: (state: State) => ({ | ||
threadName: selectedThreadSelectors.getFriendlyThreadName(state), | ||
isMarkerTableEmptyInFullRange: selectedThreadSelectors.getAreMarkerPanelsEmptyInFullRange( | ||
state | ||
), | ||
}), | ||
component: MarkerTableEmptyReasons, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
// @flow | ||
|
||
import React, { PureComponent } from 'react'; | ||
|
||
import EmptyReasons from '../shared/EmptyReasons'; | ||
import { selectedThreadSelectors } from '../../selectors/per-thread'; | ||
import { oneLine } from 'common-tags'; | ||
import explicitConnect, { type ConnectedProps } from '../../utils/connect'; | ||
|
||
import type { Thread } from '../../types/profile'; | ||
import type { State } from '../../types/store'; | ||
|
||
type StateProps = {| | ||
threadName: string, | ||
rangeFilteredThread: Thread, | ||
thread: Thread, | ||
|}; | ||
|
||
type Props = ConnectedProps<{||}, StateProps, {||}>; | ||
|
||
/** | ||
* This component attempts to tell why exactly a stack chart is empty with no samples | ||
* and display a friendly message to the end user. | ||
*/ | ||
class StackChartEmptyReasons extends PureComponent<Props> { | ||
render() { | ||
const { thread, rangeFilteredThread, threadName } = this.props; | ||
let reason; | ||
|
||
if (thread.samples.length === 0) { | ||
reason = 'This thread has no samples.'; | ||
} else if (rangeFilteredThread.samples.length === 0) { | ||
reason = 'Broaden the selected range to view samples.'; | ||
} else { | ||
reason = oneLine` | ||
Try broadening the selected range, removing search terms, or call tree transforms | ||
to view samples. | ||
`; | ||
} | ||
|
||
return ( | ||
<EmptyReasons | ||
threadName={threadName} | ||
reason={reason} | ||
viewName="stack chart" | ||
/> | ||
); | ||
} | ||
} | ||
|
||
export default explicitConnect<{||}, StateProps, {||}>({ | ||
mapStateToProps: (state: State) => ({ | ||
threadName: selectedThreadSelectors.getFriendlyThreadName(state), | ||
thread: selectedThreadSelectors.getThread(state), | ||
rangeFilteredThread: selectedThreadSelectors.getRangeFilteredThread(state), | ||
}), | ||
component: StackChartEmptyReasons, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.