diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-06 00:10:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-06 00:10:21 +0300 |
commit | fa138c9c2443f5e703ba017ff4104569871cc410 (patch) | |
tree | 810475960a536eaafc9c3b303efce401081c3fce /app/assets/javascripts/vue_merge_request_widget | |
parent | d66704a6c6edbfaf3f8652c934c8ad2356c7d07b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/vue_merge_request_widget')
-rw-r--r-- | app/assets/javascripts/vue_merge_request_widget/extensions/code_quality/index.js | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/app/assets/javascripts/vue_merge_request_widget/extensions/code_quality/index.js b/app/assets/javascripts/vue_merge_request_widget/extensions/code_quality/index.js index 394f8979a53..11bc2983f0f 100644 --- a/app/assets/javascripts/vue_merge_request_widget/extensions/code_quality/index.js +++ b/app/assets/javascripts/vue_merge_request_widget/extensions/code_quality/index.js @@ -12,25 +12,31 @@ export default { props: ['codeQuality', 'blobPath'], i18n, computed: { + shouldCollapse(data) { + const { newErrors, resolvedErrors, parsingInProgress } = data; + if (parsingInProgress || (newErrors.length === 0 && resolvedErrors.length === 0)) { + return false; + } + return true; + }, summary(data) { - const { newErrors, resolvedErrors, errorSummary, parsingInProgress } = data; - + const { newErrors, resolvedErrors, parsingInProgress } = data; if (parsingInProgress) { return i18n.loading; - } else if (errorSummary.errored >= 1 && errorSummary.resolved >= 1) { + } else if (newErrors.length >= 1 && resolvedErrors.length >= 1) { return i18n.improvementAndDegradationCopy( i18n.pluralReport(resolvedErrors), i18n.pluralReport(newErrors), ); - } else if (errorSummary.resolved >= 1) { + } else if (resolvedErrors.length >= 1) { return i18n.improvedCopy(i18n.singularReport(resolvedErrors)); - } else if (errorSummary.errored >= 1) { + } else if (newErrors.length >= 1) { return i18n.degradedCopy(i18n.singularReport(newErrors)); } return i18n.noChanges; }, statusIcon() { - if (this.collapsedData.errorSummary?.errored >= 1) { + if (this.collapsedData.newErrors.length >= 1) { return EXTENSION_ICONS.warning; } return EXTENSION_ICONS.success; @@ -46,8 +52,6 @@ export default { parsingInProgress: status === HTTP_STATUS_NO_CONTENT, resolvedErrors: parseCodeclimateMetrics(data.resolved_errors, this.blobPath.head_path), newErrors: parseCodeclimateMetrics(data.new_errors, this.blobPath.head_path), - existingErrors: parseCodeclimateMetrics(data.existing_errors, this.blobPath.head_path), - errorSummary: data.summary, }, }; }); |