diff --git a/locales/en-US/app.ftl b/locales/en-US/app.ftl index 196f00f2f3..d6b97ecd6c 100644 --- a/locales/en-US/app.ftl +++ b/locales/en-US/app.ftl @@ -926,21 +926,25 @@ TransformNavigator--collapse-indirect-recursion = Collapse indirect recursion: { # $item (String) - Name of the function that transform applied to. TransformNavigator--collapse-function-subtree = Collapse subtree: { $item } -## Source code view in a box at the bottom of the UI. +## "Bottom box" - a view which contains the source view and the assembly view, +## at the bottom of the profiler UI +## +## Some of these string IDs still start with SourceView, even though the strings +## are used for both the source view and the assembly view. -# Displayed while the source view is waiting for the network request which -# delivers the source code. +# Displayed while a view in the bottom box is waiting for code to load from +# the network. # Variables: # $host (String) - The "host" part of the URL, e.g. hg.mozilla.org SourceView--loading-url = Waiting for { $host }… -# Displayed while the source view is waiting for the browser to deliver -# the source code. +# Displayed while a view in the bottom box is waiting for code to load from +# the browser. SourceView--loading-browser-connection = Waiting for { -firefox-brand-name }… # Displayed whenever the source view was not able to get the source code for # a file. -SourceView--source-not-available-title = Source not available +BottomBox--source-code-not-available-title = Source code not available # Displayed whenever the source view was not able to get the source code for # a file. @@ -949,6 +953,25 @@ SourceView--source-not-available-title = Source not available SourceView--source-not-available-text = See issue #3741 for supported scenarios and planned improvements. +# Displayed whenever the assembly view was not able to get the assembly code for +# a file. +# Assembly refers to the low-level programming language. +BottomBox--assembly-code-not-available-title = Assembly code not available + +# Displayed whenever the assembly view was not able to get the assembly code for +# a file. +# Elements: +# link text - A link to the github issue about supported scenarios. +BottomBox--assembly-code-not-available-text = + See issue #4520 for supported scenarios and planned improvements. + +SourceView--close-button = + .title = Close the source view + +## Code loading errors +## These are displayed both in the source view and in the assembly view. +## The string IDs here currently all start with SourceView for historical reasons. + # Displayed below SourceView--cannot-obtain-source, if the profiler does not # know which URL to request source code from. SourceView--no-known-cors-url = @@ -1016,8 +1039,17 @@ SourceView--not-in-archive-error-when-obtaining-source = SourceView--archive-parsing-error-when-obtaining-source = The archive at { $url } could not be parsed: { $parsingErrorMessage } -SourceView--close-button = - .title = Close the source view +## Toggle buttons in the top right corner of the bottom box + +# The toggle button for the assembly view, while the assembly view is hidden. +# Assembly refers to the low-level programming language. +AssemblyView--show-button = + .title = Show the assembly view + +# The toggle button for the assembly view, while the assembly view is shown. +# Assembly refers to the low-level programming language. +AssemblyView--hide-button = + .title = Hide the assembly view ## UploadedRecordingsHome ## This is the page that displays all the profiles that user has uploaded. diff --git a/res/css/photon/button.css b/res/css/photon/button.css index 024e0819a2..9a37ddf7d2 100644 --- a/res/css/photon/button.css +++ b/res/css/photon/button.css @@ -80,7 +80,8 @@ background-color: transparent; } -.photon-button-ghost:hover:not(:disabled) { +.photon-button-ghost:hover:not(:disabled), +.photon-button-ghost--checked { background-color: var(--grey-90-a10); } diff --git a/res/img/svg/asm-icon.svg b/res/img/svg/asm-icon.svg new file mode 100644 index 0000000000..f7adf26afd --- /dev/null +++ b/res/img/svg/asm-icon.svg @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/src/actions/code.js b/src/actions/code.js index fddbe025d8..2afa84c49b 100644 --- a/src/actions/code.js +++ b/src/actions/code.js @@ -23,8 +23,8 @@ export function beginLoadingSourceCodeFromBrowserConnection( return { type: 'SOURCE_CODE_LOADING_BEGIN_BROWSER_CONNECTION', file }; } -export function finishLoadingSourceCode(file: string, source: string): Action { - return { type: 'SOURCE_CODE_LOADING_SUCCESS', file, source }; +export function finishLoadingSourceCode(file: string, code: string): Action { + return { type: 'SOURCE_CODE_LOADING_SUCCESS', file, code }; } export function failLoadingSourceCode( diff --git a/src/components/app/AssemblyViewToggleButton.js b/src/components/app/AssemblyViewToggleButton.js new file mode 100644 index 0000000000..c511f80d98 --- /dev/null +++ b/src/components/app/AssemblyViewToggleButton.js @@ -0,0 +1,87 @@ +/* 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 from 'react'; +import classNames from 'classnames'; + +import { getAssemblyViewIsOpen } from 'firefox-profiler/selectors/url-state'; +import { + openAssemblyView, + closeAssemblyView, +} from 'firefox-profiler/actions/profile-view'; +import explicitConnect from 'firefox-profiler/utils/connect'; + +import type { ConnectedProps } from 'firefox-profiler/utils/connect'; + +import { Localized } from '@fluent/react'; + +type StateProps = {| + +assemblyViewIsOpen: boolean, +|}; + +type DispatchProps = {| + +openAssemblyView: typeof openAssemblyView, + +closeAssemblyView: typeof closeAssemblyView, +|}; + +type Props = ConnectedProps<{||}, StateProps, DispatchProps>; + +class AssemblyViewToggleButtonImpl extends React.PureComponent { + _onClick = () => { + if (this.props.assemblyViewIsOpen) { + this.props.closeAssemblyView(); + } else { + this.props.openAssemblyView(); + } + }; + + render() { + const { assemblyViewIsOpen } = this.props; + + return assemblyViewIsOpen ? ( + +