summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vue_shared/components/reports/report_issues.vue
blob: 5ce3ece4cc5eab40d114d6be54c20474d4724798 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<script>
import Icon from '~/vue_shared/components/icon.vue';
import Issue from '~/reports/components/test_issue_body.vue';

export default {
  name: 'ReportIssues',
  components: {
    Icon,
    Issue,
  },
  props: {
    issues: {
      type: Array,
      required: true,
    },
    type: {
      type: String,
      required: true,
    },
    // failed || success
    status: {
      type: String,
      required: true,
    },
  },
  computed: {
    iconName() {
      if (this.isStatusFailed) {
        return 'status_failed_borderless';
      } else if (this.isStatusSuccess) {
        return 'status_success_borderless';
      }

      return 'status_created_borderless';
    },
    isStatusFailed() {
      return this.status === 'failed';
    },
    isStatusSuccess() {
      return this.status === 'success';
    },
    isStatusNeutral() {
      return this.status === 'neutral';
    },
    isTypeTest() {
      // TODO: Remove this. It's needed because of the EE port of this. Ideally there would be no type here.
      return this.type === 'test';
    },
  },
};
</script>
<template>
  <div>
    <ul class="report-block-list">
      <li
        v-for="(issue, index) in issues"
        :class="{ 'is-dismissed': issue.isDismissed }"
        :key="index"
        class="report-block-list-issue"
      >
        <div
          :class="{
            failed: isStatusFailed,
            success: isStatusSuccess,
            neutral: isStatusNeutral,
          }"
          class="report-block-list-icon append-right-5"
        >
          <icon
            :name="iconName"
            :size="32"
          />
        </div>

        <issue
          v-if="isTypeTest"
          :issue="issue"
          :status="status"
        />

      </li>
    </ul>
  </div>
</template>