summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/notes/components/note_actions/timeline_event_button.vue
blob: 4dd0c968282f2a6c2c53b5b7efa90457e3bf4a9e (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
<script>
import { GlTooltipDirective, GlButton } from '@gitlab/ui';
import { __ } from '~/locale';

export default {
  i18n: {
    buttonText: __('Add comment to incident timeline'),
    addError: __('Error promoting the note to timeline event: %{error}'),
    addGenericError: __('Something went wrong while promoting the note to timeline event.'),
  },
  components: {
    GlButton,
  },
  directives: {
    GlTooltip: GlTooltipDirective,
  },
  props: {
    noteId: {
      type: [String, Number],
      required: true,
    },
    isPromotionInProgress: {
      type: Boolean,
      required: false,
      default: false,
    },
  },
  methods: {
    handleButtonClick() {
      this.$emit('click-promote-comment-to-event', {
        noteId: this.noteId,
        addError: this.$options.i18n.addError,
        addGenericError: this.$options.i18n.addGenericError,
      });
    },
  },
};
</script>
<template>
  <span v-gl-tooltip :title="$options.i18n.buttonText">
    <gl-button
      category="tertiary"
      icon="clock"
      :aria-label="$options.i18n.buttonText"
      :disabled="isPromotionInProgress"
      @click="handleButtonClick"
    />
  </span>
</template>