]> source.dussan.org Git - sonarqube.git/commitdiff
fix display of application quality gate
authorStas Vilchik <stas.vilchik@sonarsource.com>
Wed, 26 Jul 2017 09:03:35 +0000 (11:03 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 31 Jul 2017 09:27:51 +0000 (11:27 +0200)
server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGateProject.js
server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGate.js
server/sonar-web/src/main/js/apps/overview/qualityGate/__tests__/ApplicationQualityGateProject-test.js

index 1c96978d4ae30dac3748090551a029901c3ebca6..26f941e9d211493b8fae785fc6057d071bbc77cb 100644 (file)
@@ -29,7 +29,7 @@ import './ApplicationQualityGateProject.css';
 type Condition = {
   comparator: string,
   errorThreshold?: string,
-  metricKey: string,
+  metric: string,
   onLeak: boolean,
   status: string,
   value: string,
@@ -56,13 +56,13 @@ export default class ApplicationQualityGateProject extends React.PureComponent {
   props: Props;
 
   renderCondition = (condition: Condition) => {
-    const metric = this.props.metrics[condition.metricKey];
+    const metric = this.props.metrics[condition.metric];
     const metricName = getLocalizedMetricName(metric);
     const threshold = condition.errorThreshold || condition.warningThreshold;
-    const isDiff = isDiffMetric(condition.metricKey);
+    const isDiff = isDiffMetric(condition.metric);
 
     return (
-      <li key={condition.metricKey}>
+      <li key={condition.metric}>
         <span className="text-limited">
           <strong>{formatMeasure(condition.value, metric.type)}</strong> {metricName}
           {!isDiff && condition.onLeak && ' ' + translate('quality_gates.conditions.leak')}
index 18413693f9af0674d2b7b387d0b1cfa02ac95674..5bfcb90b203b4ef9384f14cd54fce61cd35f86cd 100644 (file)
@@ -50,7 +50,7 @@ export default function QualityGate({ component, measures }: Props) {
 
   let conditions = [];
   if (detailsMeasure && detailsMeasure.value) {
-    conditions = parseQualityGateDetails(detailsMeasure.value).conditions;
+    conditions = parseQualityGateDetails(detailsMeasure.value).conditions || [];
   }
 
   return (
index 9aad73676212e1ec3bbf03c1084e58a26d19d5b3..88c232cd58308be934d724153eac731e4daf29f8 100644 (file)
@@ -36,7 +36,7 @@ it('renders', () => {
     conditions: [
       {
         status: 'ERROR',
-        metricKey: 'new_coverage',
+        metric: 'new_coverage',
         comparator: 'LT',
         onLeak: true,
         errorThreshold: '85',
@@ -44,7 +44,7 @@ it('renders', () => {
       },
       {
         status: 'WARN',
-        metricKey: 'bugs',
+        metric: 'bugs',
         comparator: 'GT',
         onLeak: false,
         warningThreshold: '0',
@@ -52,7 +52,7 @@ it('renders', () => {
       },
       {
         status: 'ERROR',
-        metricKey: 'bugs',
+        metric: 'bugs',
         comparator: 'GT',
         onLeak: true,
         warningThreshold: '0',
@@ -60,7 +60,7 @@ it('renders', () => {
       },
       {
         status: 'OK',
-        metricKey: 'skipped_tests',
+        metric: 'skipped_tests',
         comparator: 'GT',
         onLeak: false,
         warningThreshold: '0',