debian-mirror-gitlab/app/assets/javascripts/projects/terraform_notification/index.js

24 lines
633 B
JavaScript
Raw Normal View History

2021-09-30 23:02:18 +05:30
import Vue from 'vue';
2021-10-27 15:23:28 +05:30
import { parseBoolean, getCookie } from '~/lib/utils/common_utils';
2021-09-30 23:02:18 +05:30
import TerraformNotification from './components/terraform_notification.vue';
export default () => {
const el = document.querySelector('.js-terraform-notification');
2021-10-27 15:23:28 +05:30
const bannerDismissedKey = 'terraform_notification_dismissed';
2021-09-30 23:02:18 +05:30
2021-10-27 15:23:28 +05:30
if (!el || parseBoolean(getCookie(bannerDismissedKey))) {
2021-09-30 23:02:18 +05:30
return false;
}
2021-10-27 15:23:28 +05:30
const { terraformImagePath } = el.dataset;
2021-09-30 23:02:18 +05:30
return new Vue({
el,
2021-10-27 15:23:28 +05:30
provide: {
terraformImagePath,
bannerDismissedKey,
},
render: (createElement) => createElement(TerraformNotification),
2021-09-30 23:02:18 +05:30
});
};