summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/pipelines/components/graph/action_component.vue
blob: 2ef98d1d4187163d4ff5ce8f236d93dc5efa487d (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
<script>
  import tooltip from '../../../vue_shared/directives/tooltip';
  import icon from '../../../vue_shared/components/icon.vue';

  /**
   * 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,
      },
    },

    components: {
      icon,
    },

    directives: {
      tooltip,
    },

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