summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/pipelines/components/graph/action_component.vue
blob: 1f9e3d3977938ede3ac250cd41718c16b0432f03 (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 getActionIcon from '../../../vue_shared/ci_action_icons';
  import tooltipMixin from '../../../vue_shared/mixins/tooltip';

  /**
   * Renders either a cancel, retry or play icon pointing to the given path.
   * TODO: Remove UJS from here and use an async request instead.
   */
  export default {
    props: {
      tooltipText: {
        type: String,
        required: true,
      },

      link: {
        type: String,
        required: true,
      },

      actionMethod: {
        type: String,
        required: true,
      },

      actionIcon: {
        type: String,
        required: true,
      },
    },

    mixins: [
      tooltipMixin,
    ],

    computed: {
      actionIconSvg() {
        return getActionIcon(this.actionIcon);
      },

      cssClass() {
        return `js-${gl.text.dasherize(this.actionIcon)}`;
      },
    },
  };
</script>
<template>
  <a
    :data-method="actionMethod"
    :title="tooltipText"
    :href="link"
    ref="tooltip"
    class="ci-action-icon-container"
    data-toggle="tooltip"
    data-container="body">

    <i
      class="ci-action-icon-wrapper"
      :class="cssClass"
      v-html="actionIconSvg"
      aria-hidden="true"
      />
  </a>
</template>