summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/jira_connect/subscriptions/components/compatibility_alert.vue
blob: 3cfbd87ac53a4cfd1fffa2b8df11d997d4e96a8a (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
<script>
import { GlAlert, GlSprintf, GlLink } from '@gitlab/ui';
import { s__ } from '~/locale';
import { helpPagePath } from '~/helpers/help_page_helper';
import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue';

const COMPATIBILITY_ALERT_STATE_KEY = 'compatibility_alert_dismissed';

export default {
  name: 'CompatibilityAlert',
  components: {
    GlAlert,
    GlSprintf,
    GlLink,
    LocalStorageSync,
  },
  data() {
    return {
      alertDismissed: false,
    };
  },
  computed: {
    shouldShowAlert() {
      return !this.alertDismissed;
    },
  },
  methods: {
    dismissAlert() {
      this.alertDismissed = true;
    },
  },
  i18n: {
    title: s__('Integrations|Known limitations'),
    body: s__(
      'Integrations|This integration only works with GitLab.com. Adding a namespace only works in browsers that allow cross-site cookies. %{linkStart}Learn more%{linkEnd}.',
    ),
  },
  DOCS_LINK_URL: helpPagePath('integration/jira/connect-app'),
  COMPATIBILITY_ALERT_STATE_KEY,
};
</script>
<template>
  <local-storage-sync
    v-model="alertDismissed"
    :storage-key="$options.COMPATIBILITY_ALERT_STATE_KEY"
  >
    <gl-alert
      v-if="shouldShowAlert"
      class="gl-mb-7"
      variant="info"
      :title="$options.i18n.title"
      @dismiss="dismissAlert"
    >
      <gl-sprintf :message="$options.i18n.body">
        <template #link="{ content }">
          <gl-link :href="$options.DOCS_LINK_URL" target="_blank" rel="noopener noreferrer">{{
            content
          }}</gl-link>
        </template>
      </gl-sprintf>
    </gl-alert>
  </local-storage-sync>
</template>