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

test_issue_body.vue « components « grouped_test_report « reports « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8913046d62f59d04e49833510c31fa5f52ed494a (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
63
64
<script>
import { GlBadge, GlButton } from '@gitlab/ui';
import { mapActions } from 'vuex';
import { sprintf, n__ } from '~/locale';
import IssueStatusIcon from '~/reports/components/issue_status_icon.vue';
import { STATUS_NEUTRAL } from '../../constants';

export default {
  name: 'TestIssueBody',
  components: {
    GlBadge,
    GlButton,
    IssueStatusIcon,
  },
  props: {
    issue: {
      type: Object,
      required: true,
    },
  },
  computed: {
    recentFailureMessage() {
      return sprintf(
        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',
          this.issue.recent_failures?.count,
        ),
        this.issue.recent_failures,
      );
    },
    showRecentFailures() {
      return this.issue.recent_failures?.count && this.issue.recent_failures?.base_branch;
    },
    status() {
      return this.issue.status || STATUS_NEUTRAL;
    },
  },
  methods: {
    ...mapActions(['openModal']),
  },
};
</script>
<template>
  <div class="gl-display-flex gl-mt-2 gl-mb-2">
    <issue-status-icon :status="status" :status-icon-size="24" class="gl-mr-3" />
    <gl-button
      button-text-classes="gl-white-space-normal! gl-word-break-all gl-text-left"
      variant="link"
      data-testid="test-issue-body-description"
      @click="openModal({ issue })"
    >
      <gl-badge
        v-if="showRecentFailures"
        variant="warning"
        class="gl-mr-2"
        data-testid="test-issue-body-recent-failures"
      >
        {{ recentFailureMessage }}
      </gl-badge>
      {{ issue.name }}
    </gl-button>
  </div>
</template>