summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/projects/terraform_notification/index.js
blob: 0a273247930c01005c0a7b87a53c5072f94498ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import Vue from 'vue';
import { parseBoolean, getCookie } from '~/lib/utils/common_utils';
import TerraformNotification from './components/terraform_notification.vue';

export default () => {
  const el = document.querySelector('.js-terraform-notification');
  const bannerDismissedKey = 'terraform_notification_dismissed';

  if (!el || parseBoolean(getCookie(bannerDismissedKey))) {
    return false;
  }

  const { terraformImagePath } = el.dataset;

  return new Vue({
    el,
    provide: {
      terraformImagePath,
      bannerDismissedKey,
    },
    render: (createElement) => createElement(TerraformNotification),
  });
};