]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7402 improve breadcrumbs on measures page
authorStas Vilchik <vilchiks@gmail.com>
Mon, 4 Apr 2016 12:51:48 +0000 (14:51 +0200)
committerStas Vilchik <vilchiks@gmail.com>
Mon, 4 Apr 2016 13:07:37 +0000 (15:07 +0200)
server/sonar-web/src/main/js/apps/component-measures/app/actions.js
server/sonar-web/src/main/js/apps/component-measures/app/reducer.js
server/sonar-web/src/main/js/apps/component-measures/details/MeasureDetails.js
server/sonar-web/src/main/js/apps/component-measures/details/MeasureDetailsContainer.js
server/sonar-web/src/main/js/apps/component-measures/home/AllMeasures.js
server/sonar-web/src/main/js/apps/component-measures/home/AllMeasuresContainer.js
server/sonar-web/src/main/js/apps/component-measures/home/DomainMeasures.js
server/sonar-web/src/main/js/apps/component-measures/home/DomainMeasuresContainer.js
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 137b9592f72c8f9c109579ec6a95d57b7126e719..e38934a9bee991e78d0fa65628ec744aede59209 100644 (file)
@@ -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 };
 }
index f481ff479a7d9522a3647e5c932e690ea3446659..2484e2d05638af0898a033671b6129b165a92705 100644 (file)
  * 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:
index 3b9fd8f658929488a2c1b7f3547a51c3dfec4dc0..d91eb5d2fbb6c852dfbb1f33dd4f018aa97b319d 100644 (file)
@@ -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}
index c6f91fd298dae0e3d23163bad43ea76eb6e9bda1..b0d8796339487ed5f08331abc1d4170df5d11292 100644 (file)
@@ -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,
index 1d30a1f4cb0957ccf1a2d18e418c7060318b371b..bb3cb74a2ff2985ef4860f4e7e98ff74b28104d6 100644 (file)
@@ -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);
index 8cdcb3d40b768955b989f167aabdb9667487759b..00bb948b70b4decc2428b73ee121277a187c0ba6 100644 (file)
@@ -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);
index 2fe75c0fd5ab2bfbe230d0444778fa5fcb2dbe51..8ba732ac8368335045454a150c8a8df731214d05 100644 (file)
@@ -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;
index 0ff458548b3a78d00cd92cb66161cfc008af4b52..f71d24c036823d570815d759bdec14fdfd6239f6 100644 (file)
@@ -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);
index b71f3510eb898ccb7afb44f042aadc40bb5d34f8..1fdfa23b98db60d083fd4e1f1b00aa021333e3cf 100644 (file)
@@ -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