]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9822 Quality Gate cannot be displayed directly if it includes a custom metric...
authorStas Vilchik <stas.vilchik@sonarsource.com>
Thu, 12 Oct 2017 14:57:12 +0000 (16:57 +0200)
committerStas Vilchik <stas.vilchik@sonarsource.com>
Mon, 16 Oct 2017 09:08:02 +0000 (11:08 +0200)
server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.js

index 3d4b9ff3aedadaefa6edb576d0640fed6aca56fe..f46cba13af44b58223ef8e6352751a7dc779e90f 100644 (file)
@@ -65,12 +65,17 @@ export default class Conditions extends React.PureComponent {
       onDeleteCondition
     } = this.props;
 
-    const sortedConditions = sortBy(conditions, condition => {
-      return metrics.find(metric => metric.key === condition.metric).name;
-    });
+    const existingConditions = conditions.filter(condition =>
+      metrics.find(metric => metric.key === condition.metric)
+    );
+
+    const sortedConditions = sortBy(
+      existingConditions,
+      condition => metrics.find(metric => metric.key === condition.metric).name
+    );
 
     const duplicates = [];
-    const savedConditions = conditions.filter(condition => condition.id != null);
+    const savedConditions = existingConditions.filter(condition => condition.id != null);
     savedConditions.forEach(condition => {
       const sameCount = savedConditions.filter(
         sample => sample.metric === condition.metric && sample.period === condition.period