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

diff_code_quality_item.vue « components « diffs « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 727b2a0c099d5acee0d7e827ebc918ef4be2fb19 (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 { GlLink, GlIcon } from '@gitlab/ui';
import { mapActions } from 'vuex';
import { getSeverity } from '~/ci/reports/utils';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';

export default {
  components: { GlLink, GlIcon },
  mixins: [glFeatureFlagsMixin()],
  props: {
    finding: {
      type: Object,
      required: true,
    },
    link: {
      type: Boolean,
      required: false,
      default: true,
    },
  },
  computed: {
    enhancedFinding() {
      return getSeverity(this.finding);
    },
    listText() {
      return `${this.finding.severity} - ${this.finding.description}`;
    },
  },
  methods: {
    toggleDrawer() {
      this.setDrawer(this.finding);
    },
    ...mapActions('findingsDrawer', ['setDrawer']),
  },
};
</script>

<template>
  <li class="gl-py-1 gl-font-regular gl-display-flex">
    <span class="gl-mr-3">
      <gl-icon
        :size="12"
        :name="enhancedFinding.name"
        :class="enhancedFinding.class"
        class="codequality-severity-icon"
      />
    </span>
    <span
      v-if="glFeatures.codeQualityInlineDrawer"
      data-testid="description-button-section"
      class="gl-display-flex"
    >
      <gl-link v-if="link" category="primary" variant="link" @click="toggleDrawer">
        {{ listText }}</gl-link
      >
      <span v-else>{{ listText }}</span>
    </span>
    <span v-else data-testid="description-plain-text" class="gl-display-flex">
      {{ listText }}
    </span>
  </li>
</template>