diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 11:43:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 11:43:02 +0300 |
commit | d9ab72d6080f594d0b3cae15f14b3ef2c6c638cb (patch) | |
tree | 2341ef426af70ad1e289c38036737e04b0aa5007 /app/assets/javascripts/reports | |
parent | d6e514dd13db8947884cd58fe2a9c2a063400a9b (diff) |
Add latest changes from gitlab-org/gitlab@14-4-stable-eev14.4.0-rc42
Diffstat (limited to 'app/assets/javascripts/reports')
5 files changed, 32 insertions, 33 deletions
diff --git a/app/assets/javascripts/reports/codequality_report/components/codequality_issue_body.vue b/app/assets/javascripts/reports/codequality_report/components/codequality_issue_body.vue index 736c8668a34..59bd54eab60 100644 --- a/app/assets/javascripts/reports/codequality_report/components/codequality_issue_body.vue +++ b/app/assets/javascripts/reports/codequality_report/components/codequality_issue_body.vue @@ -33,17 +33,20 @@ export default { issueName() { return `${this.severityLabel} - ${this.issue.name}`; }, + issueSeverity() { + return this.issue.severity.toLowerCase(); + }, isStatusSuccess() { return this.status === STATUS_SUCCESS; }, severityClass() { - return SEVERITY_CLASSES[this.issue.severity] || SEVERITY_CLASSES.unknown; + return SEVERITY_CLASSES[this.issueSeverity] || SEVERITY_CLASSES.unknown; }, severityIcon() { - return SEVERITY_ICONS[this.issue.severity] || SEVERITY_ICONS.unknown; + return SEVERITY_ICONS[this.issueSeverity] || SEVERITY_ICONS.unknown; }, severityLabel() { - return this.$options.severityText[this.issue.severity] || this.$options.severityText.unknown; + return this.$options.severityText[this.issueSeverity] || this.$options.severityText.unknown; }, }, severityText: { diff --git a/app/assets/javascripts/reports/codequality_report/grouped_codequality_reports_app.vue b/app/assets/javascripts/reports/codequality_report/grouped_codequality_reports_app.vue index 0e18d0992cd..599e8d35708 100644 --- a/app/assets/javascripts/reports/codequality_report/grouped_codequality_reports_app.vue +++ b/app/assets/javascripts/reports/codequality_report/grouped_codequality_reports_app.vue @@ -55,10 +55,12 @@ export default { ...mapActions(['fetchReports', 'setPaths']), }, loadingText: sprintf(s__('ciReport|Loading %{reportName} report'), { - reportName: 'codeclimate', + // eslint-disable-next-line @gitlab/require-i18n-strings + reportName: 'Code quality', }), errorText: sprintf(s__('ciReport|Failed to load %{reportName} report'), { - reportName: 'codeclimate', + // eslint-disable-next-line @gitlab/require-i18n-strings + reportName: 'Code quality', }), }; </script> diff --git a/app/assets/javascripts/reports/codequality_report/store/getters.js b/app/assets/javascripts/reports/codequality_report/store/getters.js index 3fb8c5be351..4712f8cbefe 100644 --- a/app/assets/javascripts/reports/codequality_report/store/getters.js +++ b/app/assets/javascripts/reports/codequality_report/store/getters.js @@ -1,5 +1,5 @@ import { spriteIcon } from '~/lib/utils/common_utils'; -import { sprintf, __, s__, n__ } from '~/locale'; +import { sprintf, s__ } from '~/locale'; import { LOADING, ERROR, SUCCESS, STATUS_NOT_FOUND } from '../../constants'; export const hasCodequalityIssues = (state) => @@ -18,27 +18,23 @@ export const codequalityStatus = (state) => { export const codequalityText = (state) => { const { newIssues, resolvedIssues } = state; - const text = []; - + let text; if (!newIssues.length && !resolvedIssues.length) { - text.push(s__('ciReport|No changes to code quality')); - } else { - text.push(s__('ciReport|Code quality')); - - if (resolvedIssues.length) { - text.push(n__(' improved on %d point', ' improved on %d points', resolvedIssues.length)); - } - - if (newIssues.length && resolvedIssues.length) { - text.push(__(' and')); - } - - if (newIssues.length) { - text.push(n__(' degraded on %d point', ' degraded on %d points', newIssues.length)); - } + text = s__('ciReport|No changes to code quality'); + } else if (newIssues.length && resolvedIssues.length) { + text = sprintf( + s__(`ciReport|Code quality scanning detected %{issueCount} changes in merged results`), + { + issueCount: newIssues.length + resolvedIssues.length, + }, + ); + } else if (resolvedIssues.length) { + text = s__(`ciReport|Code quality improved`); + } else if (newIssues.length) { + text = s__(`ciReport|Code quality degraded`); } - return text.join(''); + return text; }; export const codequalityPopover = (state) => { diff --git a/app/assets/javascripts/reports/codequality_report/store/utils/codequality_parser.js b/app/assets/javascripts/reports/codequality_report/store/utils/codequality_parser.js index a794f5f0577..417297df43c 100644 --- a/app/assets/javascripts/reports/codequality_report/store/utils/codequality_parser.js +++ b/app/assets/javascripts/reports/codequality_report/store/utils/codequality_parser.js @@ -1,14 +1,16 @@ -export const parseCodeclimateMetrics = (issues = [], path = '') => { +export const parseCodeclimateMetrics = (issues = [], blobPath = '') => { return issues.map((issue) => { + // the `file_path` attribute from the artifact is returned as `file` by GraphQL + const issuePath = issue.file_path || issue.path; const parsedIssue = { name: issue.description, - path: issue.file_path, - urlPath: `${path}/${issue.file_path}#L${issue.line}`, + path: issuePath, + urlPath: `${blobPath}/${issuePath}#L${issue.line}`, ...issue, }; if (issue?.location?.path) { - let parseCodeQualityUrl = `${path}/${issue.location.path}`; + let parseCodeQualityUrl = `${blobPath}/${issue.location.path}`; parsedIssue.path = issue.location.path; if (issue?.location?.lines?.begin) { diff --git a/app/assets/javascripts/reports/grouped_test_report/grouped_test_reports_app.vue b/app/assets/javascripts/reports/grouped_test_report/grouped_test_reports_app.vue index 82806793401..be49a03a9a5 100644 --- a/app/assets/javascripts/reports/grouped_test_report/grouped_test_reports_app.vue +++ b/app/assets/javascripts/reports/grouped_test_report/grouped_test_reports_app.vue @@ -3,7 +3,6 @@ import { GlButton, GlIcon } from '@gitlab/ui'; import { mapActions, mapGetters, mapState } from 'vuex'; import api from '~/api'; import { sprintf, s__ } from '~/locale'; -import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import GroupedIssuesList from '../components/grouped_issues_list.vue'; import { componentNames } from '../components/issue_body'; import ReportSection from '../components/report_section.vue'; @@ -28,7 +27,6 @@ export default { GlButton, GlIcon, }, - mixins: [glFeatureFlagsMixin()], props: { endpoint: { type: String, @@ -82,9 +80,7 @@ export default { methods: { ...mapActions(['setPaths', 'fetchReports', 'closeModal']), handleToggleEvent() { - if (this.glFeatures.usageDataITestingSummaryWidgetTotal) { - api.trackRedisHllUserEvent(this.$options.expandEvent); - } + api.trackRedisHllUserEvent(this.$options.expandEvent); }, reportText(report) { const { name, summary } = report || {}; |