diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-04-04 14:51:48 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2016-04-04 15:07:37 +0200 |
commit | 065cdd3b3fbb7b5fc6ffcb05ee95f76ed41b4b2f (patch) | |
tree | 1d80111952583831c7f638b795147c6ca6a19883 | |
parent | c6c159847040bd5183c9ceb1df80553c6b2f3396 (diff) | |
download | sonarqube-065cdd3b3fbb7b5fc6ffcb05ee95f76ed41b4b2f.tar.gz sonarqube-065cdd3b3fbb7b5fc6ffcb05ee95f76ed41b4b2f.zip |
SONAR-7402 improve breadcrumbs on measures page
9 files changed, 21 insertions, 62 deletions
diff --git a/server/sonar-web/src/main/js/apps/component-measures/app/actions.js b/server/sonar-web/src/main/js/apps/component-measures/app/actions.js index 137b9592f72..e38934a9bee 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/app/actions.js +++ b/server/sonar-web/src/main/js/apps/component-measures/app/actions.js @@ -24,7 +24,6 @@ import { getMetrics } from '../../../api/metrics'; */ export const DISPLAY_HOME = 'app/DISPLAY_HOME'; -export const DISPLAY_DOMAIN = 'app/DISPLAY_DOMAIN'; export const RECEIVE_METRICS = 'app/RECEIVE_METRICS'; @@ -36,10 +35,6 @@ export function displayHome () { return { type: DISPLAY_HOME }; } -export function displayDomain (domainName) { - return { type: DISPLAY_DOMAIN, domainName }; -} - function receiveMetrics (metrics) { return { type: RECEIVE_METRICS, metrics }; } diff --git a/server/sonar-web/src/main/js/apps/component-measures/app/reducer.js b/server/sonar-web/src/main/js/apps/component-measures/app/reducer.js index f481ff479a7..2484e2d0563 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/app/reducer.js +++ b/server/sonar-web/src/main/js/apps/component-measures/app/reducer.js @@ -17,17 +17,14 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { DISPLAY_DOMAIN, RECEIVE_METRICS } from './actions'; +import { RECEIVE_METRICS } from './actions'; const initialState = { - metrics: undefined, - lastDisplayedDomain: undefined + metrics: undefined }; export default function appReducer (state = initialState, action = {}) { switch (action.type) { - case DISPLAY_DOMAIN: - return { ...state, lastDisplayedDomain: action.domainName }; case RECEIVE_METRICS: return { ...state, metrics: action.metrics }; default: diff --git a/server/sonar-web/src/main/js/apps/component-measures/details/MeasureDetails.js b/server/sonar-web/src/main/js/apps/component-measures/details/MeasureDetails.js index 3b9fd8f6589..d91eb5d2fbb 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/details/MeasureDetails.js +++ b/server/sonar-web/src/main/js/apps/component-measures/details/MeasureDetails.js @@ -56,7 +56,7 @@ export default class MeasureDetails extends React.Component { } render () { - const { component, metric, secondaryMeasure, measure, periods, lastDisplayedDomain, children } = this.props; + const { component, metric, secondaryMeasure, measure, periods, children } = this.props; if (measure == null) { return <Spinner/>; @@ -70,20 +70,20 @@ export default class MeasureDetails extends React.Component { return ( <section id="component-measures-details" className="page page-container page-limited"> - {lastDisplayedDomain ? ( - <Link - to={{ pathname: `domain/${lastDisplayedDomain}`, query: { id: component.key } }} - className="small text-muted"> - {translateWithParameters('component_measures.back_to_domain_measures', lastDisplayedDomain)} - </Link> - ) : ( - <IndexLink - to={{ pathname: '/', query: { id: component.key } }} - id="component-measures-back-to-all-measures" - className="small text-muted"> - {translate('component_measures.back_to_all_measures')} - </IndexLink> - )} + <div className="note"> + <IndexLink + to={{ pathname: '/', query: { id: component.key } }} + id="component-measures-back-to-all-measures" + className="text-muted"> + {translate('component_measures.all_measures')} + </IndexLink> + {' / '} + <Link + to={{ pathname: `domain/${metric.domain}`, query: { id: component.key } }} + className="text-muted"> + {translateWithParameters('component_measures.domain_measures', metric.domain)} + </Link> + </div> <MeasureDetailsHeader measure={measure} diff --git a/server/sonar-web/src/main/js/apps/component-measures/details/MeasureDetailsContainer.js b/server/sonar-web/src/main/js/apps/component-measures/details/MeasureDetailsContainer.js index c6f91fd298d..b0d87963394 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/details/MeasureDetailsContainer.js +++ b/server/sonar-web/src/main/js/apps/component-measures/details/MeasureDetailsContainer.js @@ -25,7 +25,6 @@ import { fetchMeasure } from './actions'; const mapStateToProps = state => { return { component: state.app.component, - lastDisplayedDomain: state.app.lastDisplayedDomain, metrics: state.app.metrics, metric: state.details.metric, measure: state.details.measure, diff --git a/server/sonar-web/src/main/js/apps/component-measures/home/AllMeasures.js b/server/sonar-web/src/main/js/apps/component-measures/home/AllMeasures.js index 1d30a1f4cb0..bb3cb74a2ff 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/home/AllMeasures.js +++ b/server/sonar-web/src/main/js/apps/component-measures/home/AllMeasures.js @@ -23,14 +23,6 @@ import AllMeasuresDomain from './AllMeasuresDomain'; import { getLeakPeriodLabel } from '../../../helpers/periods'; export default class AllMeasures extends React.Component { - componentDidMount () { - this.props.onDisplay(); - } - - componentDidUpdate () { - this.props.onDisplay(); - } - render () { const { component, domains, periods } = this.props; const leakPeriodLabel = getLeakPeriodLabel(periods); diff --git a/server/sonar-web/src/main/js/apps/component-measures/home/AllMeasuresContainer.js b/server/sonar-web/src/main/js/apps/component-measures/home/AllMeasuresContainer.js index 8cdcb3d40b7..00bb948b70b 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/home/AllMeasuresContainer.js +++ b/server/sonar-web/src/main/js/apps/component-measures/home/AllMeasuresContainer.js @@ -20,7 +20,6 @@ import { connect } from 'react-redux'; import AllMeasures from './AllMeasures'; -import { displayDomain } from '../app/actions'; const mapStateToProps = state => { return { @@ -30,13 +29,6 @@ const mapStateToProps = state => { }; }; -const mapDispatchToProps = dispatch => { - return { - onDisplay: () => dispatch(displayDomain(undefined)) - }; -}; - export default connect( - mapStateToProps, - mapDispatchToProps + mapStateToProps )(AllMeasures); diff --git a/server/sonar-web/src/main/js/apps/component-measures/home/DomainMeasures.js b/server/sonar-web/src/main/js/apps/component-measures/home/DomainMeasures.js index 2fe75c0fd5a..8ba732ac836 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/home/DomainMeasures.js +++ b/server/sonar-web/src/main/js/apps/component-measures/home/DomainMeasures.js @@ -36,14 +36,6 @@ const sortMeasures = (measures, order) => { }; export default class DomainMeasures extends React.Component { - componentDidMount () { - this.props.onDisplay(this.props.params.domainName); - } - - componentDidUpdate () { - this.props.onDisplay(this.props.params.domainName); - } - render () { const { component, domains, periods } = this.props; const { domainName } = this.props.params; diff --git a/server/sonar-web/src/main/js/apps/component-measures/home/DomainMeasuresContainer.js b/server/sonar-web/src/main/js/apps/component-measures/home/DomainMeasuresContainer.js index 0ff458548b3..f71d24c0368 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/home/DomainMeasuresContainer.js +++ b/server/sonar-web/src/main/js/apps/component-measures/home/DomainMeasuresContainer.js @@ -20,7 +20,6 @@ import { connect } from 'react-redux'; import DomainMeasures from './DomainMeasures'; -import { displayDomain } from '../app/actions'; const mapStateToProps = state => { return { @@ -30,13 +29,6 @@ const mapStateToProps = state => { }; }; -const mapDispatchToProps = dispatch => { - return { - onDisplay: domainName => dispatch(displayDomain(domainName)) - }; -}; - export default connect( - mapStateToProps, - mapDispatchToProps + mapStateToProps )(DomainMeasures); diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index b71f3510eb8..1fdfa23b98d 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -3154,8 +3154,8 @@ code.open_component_page=Open Component's Page # COMPONENT MEASURES # #------------------------------------------------------------------------------ -component_measures.back_to_all_measures=Back to All Measures -component_measures.back_to_domain_measures=Back to {0} Measures +component_measures.all_measures=All Measures +component_measures.domain_measures={0} Measures component_measures.back_to_list=Back to List component_measures.tab.tree=Tree component_measures.tab.list=List |