From 065cdd3b3fbb7b5fc6ffcb05ee95f76ed41b4b2f Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Mon, 4 Apr 2016 14:51:48 +0200 Subject: [PATCH] SONAR-7402 improve breadcrumbs on measures page --- .../js/apps/component-measures/app/actions.js | 5 ---- .../js/apps/component-measures/app/reducer.js | 7 ++--- .../details/MeasureDetails.js | 30 +++++++++---------- .../details/MeasureDetailsContainer.js | 1 - .../component-measures/home/AllMeasures.js | 8 ----- .../home/AllMeasuresContainer.js | 10 +------ .../component-measures/home/DomainMeasures.js | 8 ----- .../home/DomainMeasuresContainer.js | 10 +------ .../resources/org/sonar/l10n/core.properties | 4 +-- 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 ; @@ -70,20 +70,20 @@ export default class MeasureDetails extends React.Component { return (
- {lastDisplayedDomain ? ( - - {translateWithParameters('component_measures.back_to_domain_measures', lastDisplayedDomain)} - - ) : ( - - {translate('component_measures.back_to_all_measures')} - - )} +
+ + {translate('component_measures.all_measures')} + + {' / '} + + {translateWithParameters('component_measures.domain_measures', metric.domain)} + +
{ 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 -- 2.39.5