Welcome to mirror list, hosted at ThFree Co, Russian Federation.

devops_score_callout.vue « components « devops_reports « analytics « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e594b4e360ad615602e9a9df7090a019e77dfa1b (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
<script>
import { GlBanner } from '@gitlab/ui';
import { parseBoolean, getCookie, setCookie } from '~/lib/utils/common_utils';
import {
  INTRO_COOKIE_KEY,
  INTRO_BANNER_TITLE,
  INTRO_BANNER_BODY,
  INTRO_BANNER_ACTION_TEXT,
} from '../constants';

export default {
  name: 'DevopsScoreCallout',
  components: {
    GlBanner,
  },
  inject: {
    devopsReportDocsPath: {
      default: '',
    },
    devopsScoreIntroImagePath: {
      default: '',
    },
  },
  data() {
    return {
      bannerDismissed: parseBoolean(getCookie(INTRO_COOKIE_KEY)),
    };
  },
  i18n: {
    title: INTRO_BANNER_TITLE,
    body: INTRO_BANNER_BODY,
    action: INTRO_BANNER_ACTION_TEXT,
  },
  methods: {
    dismissBanner() {
      setCookie(INTRO_COOKIE_KEY, 'true');
      this.bannerDismissed = true;
    },
  },
};
</script>
<template>
  <gl-banner
    v-if="!bannerDismissed"
    class="gl-mt-3"
    variant="introduction"
    :title="$options.i18n.title"
    :button-text="$options.i18n.action"
    :button-link="devopsReportDocsPath"
    :svg-path="devopsScoreIntroImagePath"
    @close="dismissBanner"
  >
    <p>{{ $options.i18n.body }}</p>
  </gl-banner>
</template>