diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-08-02 14:25:57 +0200 |
---|---|---|
committer | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-08-14 11:44:44 +0200 |
commit | 5be60c5d3348076336e5a79e6308104db52f27dc (patch) | |
tree | 498f4b70fbbe58d9b84406301b687265814cf267 /server/sonar-web/src/main/js/helpers | |
parent | d7b669175e4e40341f6f1553ebe8ed84a9980ce2 (diff) | |
download | sonarqube-5be60c5d3348076336e5a79e6308104db52f27dc.tar.gz sonarqube-5be60c5d3348076336e5a79e6308104db52f27dc.zip |
SONAR-9608 SONAR-9613 Add the page actions and a select to switch between views
Diffstat (limited to 'server/sonar-web/src/main/js/helpers')
-rw-r--r-- | server/sonar-web/src/main/js/helpers/__tests__/urls-test.js | 8 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/helpers/path.js | 5 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/helpers/urls.js | 5 |
3 files changed, 7 insertions, 11 deletions
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/urls-test.js b/server/sonar-web/src/main/js/helpers/__tests__/urls-test.js index c74c18a8b36..9321a56db18 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/urls-test.js +++ b/server/sonar-web/src/main/js/helpers/__tests__/urls-test.js @@ -78,15 +78,15 @@ describe('#getComponentIssuesUrl', () => { describe('#getComponentDrilldownUrl', () => { it('should return component drilldown url', () => { expect(getComponentDrilldownUrl(SIMPLE_COMPONENT_KEY, METRIC)).toEqual({ - pathname: '/component_measures_old/metric/' + METRIC, - query: { id: SIMPLE_COMPONENT_KEY } + pathname: '/component_measures', + query: { id: SIMPLE_COMPONENT_KEY, metric: METRIC } }); }); it('should not encode component key', () => { expect(getComponentDrilldownUrl(COMPLEX_COMPONENT_KEY, METRIC)).toEqual({ - pathname: '/component_measures_old/metric/' + METRIC, - query: { id: COMPLEX_COMPONENT_KEY } + pathname: '/component_measures', + query: { id: COMPLEX_COMPONENT_KEY, metric: METRIC } }); }); }); diff --git a/server/sonar-web/src/main/js/helpers/path.js b/server/sonar-web/src/main/js/helpers/path.js index b65c049f3e4..f1400210753 100644 --- a/server/sonar-web/src/main/js/helpers/path.js +++ b/server/sonar-web/src/main/js/helpers/path.js @@ -103,10 +103,9 @@ export function splitPath(path) { } } -export function limitComponentName(str) { +export function limitComponentName(str, limit = 30) { if (typeof str === 'string') { - const LIMIT = 30; - return str.length > LIMIT ? str.substr(0, LIMIT) + '...' : str; + return str.length > limit ? str.substr(0, limit) + '...' : str; } else { return ''; } diff --git a/server/sonar-web/src/main/js/helpers/urls.js b/server/sonar-web/src/main/js/helpers/urls.js index 84bf3e4fd63..e60862b2673 100644 --- a/server/sonar-web/src/main/js/helpers/urls.js +++ b/server/sonar-web/src/main/js/helpers/urls.js @@ -62,10 +62,7 @@ export function getComponentIssuesUrlAsString(componentKey, query) { * @returns {Object} */ export function getComponentDrilldownUrl(componentKey, metric) { - return { - pathname: `/component_measures_old/metric/${metric}`, - query: { id: componentKey } - }; + return { pathname: '/component_measures', query: { id: componentKey, metric } }; } /** |