summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/reports/components/test_issue_body.vue
blob: 5e9a5b035436349d4dfcda586888a6e530098f70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<script>
import { mapActions } from 'vuex';
import { GlBadge } from '@gitlab/ui';
import { n__ } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';

export default {
  name: 'TestIssueBody',
  components: {
    GlBadge,
  },
  mixins: [glFeatureFlagsMixin()],
  props: {
    issue: {
      type: Object,
      required: true,
    },
    // failed || success
    status: {
      type: String,
      required: true,
    },
    isNew: {
      type: Boolean,
      required: false,
      default: false,
    },
  },
  computed: {
    showRecentFailures() {
      return this.glFeatures.testFailureHistory && this.issue.recent_failures;
    },
  },
  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>
<template>
  <div class="report-block-list-issue-description gl-mt-2 gl-mb-2">
    <div class="report-block-list-issue-description-text" data-testid="test-issue-body-description">
      <button
        type="button"
        class="btn-link btn-blank text-left break-link vulnerability-name-button"
        @click="openModal({ issue })"
      >
        <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-badge>
        {{ issue.name }}
      </button>
    </div>
  </div>
</template>