Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-11-26 12:09:53 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-11-26 12:09:53 +0300
commitbbede1e22c4dd615042a3e9c0d7e24afc83ca377 (patch)
tree3126821f7bea0509a1f6daaa0f6d592248d13e7e /app/assets/javascripts/reports
parentf8bb64721a58ed2fa5a8dceb3743c99fb379ea57 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/reports')
-rw-r--r--app/assets/javascripts/reports/components/test_issue_body.vue30
-rw-r--r--app/assets/javascripts/reports/store/utils.js13
2 files changed, 25 insertions, 18 deletions
diff --git a/app/assets/javascripts/reports/components/test_issue_body.vue b/app/assets/javascripts/reports/components/test_issue_body.vue
index 5e9a5b03543..69b0dcf881d 100644
--- a/app/assets/javascripts/reports/components/test_issue_body.vue
+++ b/app/assets/javascripts/reports/components/test_issue_body.vue
@@ -1,13 +1,13 @@
<script>
import { mapActions } from 'vuex';
-import { GlBadge } from '@gitlab/ui';
-import { n__ } from '~/locale';
+import { GlBadge, GlSprintf } from '@gitlab/ui';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
export default {
name: 'TestIssueBody',
components: {
GlBadge,
+ GlSprintf,
},
mixins: [glFeatureFlagsMixin()],
props: {
@@ -28,18 +28,15 @@ export default {
},
computed: {
showRecentFailures() {
- return this.glFeatures.testFailureHistory && this.issue.recent_failures;
+ return (
+ this.glFeatures.testFailureHistory &&
+ this.issue.recent_failures?.count &&
+ this.issue.recent_failures?.base_branch
+ );
},
},
methods: {
...mapActions(['openModal']),
- recentFailuresText(count) {
- return n__(
- 'Failed %d time in the last 14 days',
- 'Failed %d times in the last 14 days',
- count,
- );
- },
},
};
</script>
@@ -53,7 +50,18 @@ export default {
>
<gl-badge v-if="isNew" variant="danger" class="gl-mr-2">{{ s__('New') }}</gl-badge>
<gl-badge v-if="showRecentFailures" variant="warning" class="gl-mr-2">
- {{ recentFailuresText(issue.recent_failures) }}
+ <gl-sprintf
+ :message="
+ n__(
+ 'Reports|Failed %{count} time in %{base_branch} in the last 14 days',
+ 'Reports|Failed %{count} times in %{base_branch} in the last 14 days',
+ issue.recent_failures.count,
+ )
+ "
+ >
+ <template #count>{{ issue.recent_failures.count }}</template>
+ <template #base_branch>{{ issue.recent_failures.base_branch }}</template>
+ </gl-sprintf>
</gl-badge>
{{ issue.name }}
</button>
diff --git a/app/assets/javascripts/reports/store/utils.js b/app/assets/javascripts/reports/store/utils.js
index fd6f4933cfa..2d32daee9d0 100644
--- a/app/assets/javascripts/reports/store/utils.js
+++ b/app/assets/javascripts/reports/store/utils.js
@@ -62,12 +62,8 @@ export const recentFailuresTextBuilder = (summary = {}) => {
}
return sprintf(
n__(
- s__(
- 'Reports|%{recentlyFailed} out of %{failed} failed tests has failed more than once in the last 14 days',
- ),
- s__(
- 'Reports|%{recentlyFailed} out of %{failed} failed tests have failed more than once in the last 14 days',
- ),
+ 'Reports|%{recentlyFailed} out of %{failed} failed tests has failed more than once in the last 14 days',
+ 'Reports|%{recentlyFailed} out of %{failed} failed tests have failed more than once in the last 14 days',
recentlyFailed,
),
{ recentlyFailed, failed },
@@ -83,7 +79,10 @@ export const countRecentlyFailedTests = subject => {
return (
[report.new_failures, report.existing_failures, report.resolved_failures]
// only count tests which have failed more than once
- .map(failureArray => failureArray.filter(failure => failure.recent_failures > 1).length)
+ .map(
+ failureArray =>
+ failureArray.filter(failure => failure.recent_failures?.count > 1).length,
+ )
.reduce((total, count) => total + count, 0)
);
})