summaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-03-10 15:40:52 +0100
committerStas Vilchik <vilchiks@gmail.com>2016-03-10 15:43:47 +0100
commita98bbbaf9c6d6851a3868b42c4d7fa7a2d2e0858 (patch)
treeecc51a42753363cddcb24552dab27cae54102bcb /server/sonar-web
parente27b290bb1d71f571104362832c50eb0bfd94eb2 (diff)
downloadsonarqube-a98bbbaf9c6d6851a3868b42c4d7fa7a2d2e0858.tar.gz
sonarqube-a98bbbaf9c6d6851a3868b42c4d7fa7a2d2e0858.zip
SONAR-7402 sort measures inside domain
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/package.json1
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/AllMeasuresDomain.js15
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/config/domains.js99
3 files changed, 114 insertions, 1 deletions
diff --git a/server/sonar-web/package.json b/server/sonar-web/package.json
index b68a902c342..43a3f6e3f3d 100644
--- a/server/sonar-web/package.json
+++ b/server/sonar-web/package.json
@@ -47,6 +47,7 @@
"isparta": "4.0.0",
"jquery": "2.2.0",
"jsdom": "6.5.1",
+ "lodash": "4.6.1",
"mocha": "2.3.4",
"moment": "2.10.6",
"numeral": "1.5.3",
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/AllMeasuresDomain.js b/server/sonar-web/src/main/js/apps/component-measures/components/AllMeasuresDomain.js
index 4b3f7222ec1..f70f0afd203 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/AllMeasuresDomain.js
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/AllMeasuresDomain.js
@@ -17,15 +17,28 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import sortBy from 'lodash/sortBy';
+import partition from 'lodash/partition';
import React from 'react';
import { Link } from 'react-router';
+import domains from '../config/domains';
import { formatLeak } from '../utils';
import { formatMeasure } from '../../../helpers/measures';
import { translateWithParameters } from '../../../helpers/l10n';
export default function AllMeasuresDomain ({ domain, component, displayLeakHeader, leakPeriodLabel }) {
const hasLeak = !!leakPeriodLabel;
+ const { measures } = domain;
+ const knownMetrics = domains[domain.name] || [];
+
+ const [knownMeasures, otherMeasures] =
+ partition(measures, measure => knownMetrics.indexOf(measure.metric.key) !== -1);
+
+ const finalMeasures = [
+ ...sortBy(knownMeasures, measure => knownMetrics.indexOf(measure.metric.key)),
+ ...sortBy(otherMeasures, measure => measure.metric.name)
+ ];
return (
<li>
@@ -39,7 +52,7 @@ export default function AllMeasuresDomain ({ domain, component, displayLeakHeade
</header>
<ul className="domain-measures">
- {domain.measures.map(measure => (
+ {finalMeasures.map(measure => (
<li key={measure.metric.key}>
<Link to={{ pathname: measure.metric.key, query: { id: component.key } }}>
<div className="domain-measures-name">
diff --git a/server/sonar-web/src/main/js/apps/component-measures/config/domains.js b/server/sonar-web/src/main/js/apps/component-measures/config/domains.js
new file mode 100644
index 00000000000..1a0b2da7223
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/component-measures/config/domains.js
@@ -0,0 +1,99 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+export default {
+ 'Issues': [
+ 'violations',
+ 'new_violations',
+ 'blocker_violations',
+ 'new_blocker_violations',
+ 'critical_violations',
+ 'new_critical_violations',
+ 'major_violations',
+ 'new_major_violations',
+ 'minor_violations',
+ 'new_minor_violations',
+ 'info_violations',
+ 'new_info_violations',
+ 'open_issues',
+ 'reopened_issues',
+ 'confirmed_issues',
+ 'false_positive_issues'
+ ],
+
+ 'Maintainability': [
+ 'code_smells',
+ 'new_code_smells',
+ 'sqale_index',
+ 'new_technical_debt',
+ 'sqale_rating',
+ 'sqale_debt_ratio',
+ 'new_sqale_debt_ratio',
+ 'effort_to_reach_maintainability_rating_a'
+ ],
+
+ 'Reliability': [
+ 'bugs',
+ 'new_bugs',
+ 'reliability_rating',
+ 'reliability_remediation_effort',
+ 'new_reliability_remediation_effort',
+ 'effort_to_reach_reliability_rating_a'
+ ],
+
+ 'Security': [
+ 'vulnerabilities',
+ 'new_vulnerabilities',
+ 'security_rating',
+ 'security_remediation_effort',
+ 'new_security_remediation_effort',
+ 'effort_to_reach_security_rating_a'
+ ],
+
+ 'Size': [
+ 'ncloc',
+ 'lines'
+ ],
+
+ 'Tests': [
+ 'overall_coverage',
+ 'overall_line_coverage',
+ 'overall_branch_coverage',
+ 'overall_uncovered_lines',
+ 'overall_uncovered_conditions',
+ 'coverage',
+ 'line_coverage',
+ 'branch_coverage',
+ 'uncovered_lines',
+ 'uncovered_conditions',
+ 'it_coverage',
+ 'it_line_coverage',
+ 'it_branch_coverage',
+ 'it_uncovered_lines',
+ 'it_uncovered_conditions',
+ 'lines_to_cover',
+ 'tests',
+ 'test_success',
+ 'test_errors',
+ 'test_failures',
+ 'skipped_tests',
+ 'test_success_density',
+ 'test_execution_time'
+ ]
+};