diff options
author | Stas Vilchik <stas.vilchik@sonarsource.com> | 2017-10-12 16:57:12 +0200 |
---|---|---|
committer | Stas Vilchik <stas.vilchik@sonarsource.com> | 2017-10-16 11:08:02 +0200 |
commit | 416c2af8844a41cfd078e80c38be96f15f76ee9e (patch) | |
tree | 8406e6143c23a6bda8ffffaf2a74b006f4f34735 /server/sonar-web/src/main/js | |
parent | 0a16b53786b6b25310ceda98b0a9efe614bda804 (diff) | |
download | sonarqube-416c2af8844a41cfd078e80c38be96f15f76ee9e.tar.gz sonarqube-416c2af8844a41cfd078e80c38be96f15f76ee9e.zip |
SONAR-9822 Quality Gate cannot be displayed directly if it includes a custom metric that was deleted
Diffstat (limited to 'server/sonar-web/src/main/js')
-rw-r--r-- | server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.js b/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.js index 3d4b9ff3aed..f46cba13af4 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.js @@ -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 |