summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vue_shared/components/incubation/incubation_alert.vue
blob: b704cec247506a79f93db491b23c7177728a32d9 (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
<script>
import { GlAlert, GlLink } from '@gitlab/ui';
import { s__, sprintf } from '~/locale';

export default {
  name: 'IncubationAlert',
  components: { GlAlert, GlLink },
  props: {
    featureName: {
      type: String,
      required: true,
    },
    linkToFeedbackIssue: {
      type: String,
      required: true,
    },
  },
  data() {
    return {
      isAlertDismissed: false,
    };
  },
  computed: {
    shouldShowAlert() {
      return !this.isAlertDismissed;
    },
    titleLabel() {
      return sprintf(this.$options.i18n.titleLabel, { featureName: this.featureName });
    },
  },
  methods: {
    dismissAlert() {
      this.isAlertDismissed = true;
    },
  },
  i18n: {
    titleLabel: s__('Incubation|%{featureName} is in incubating phase'),
    contentLabel: s__(
      'Incubation|GitLab incubates features to explore new use cases. These features are updated regularly, and support is limited.',
    ),
    learnMoreLabel: s__('Incubation|Learn more about incubating features'),
    feedbackLabel: s__('Incubation|Give feedback on this feature'),
  },
};
</script>

<template>
  <gl-alert
    v-if="shouldShowAlert"
    :title="titleLabel"
    variant="warning"
    :primary-button-text="$options.i18n.feedbackLabel"
    :primary-button-link="linkToFeedbackIssue"
    @dismiss="dismissAlert"
  >
    {{ $options.i18n.contentLabel }}
    <gl-link href="https://about.gitlab.com/handbook/engineering/incubation/" target="_blank">{{
      $options.i18n.learnMoreLabel
    }}</gl-link>
  </gl-alert>
</template>