diff options
Diffstat (limited to 'app/assets/javascripts/projects/terraform_notification/index.js')
-rw-r--r-- | app/assets/javascripts/projects/terraform_notification/index.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/app/assets/javascripts/projects/terraform_notification/index.js b/app/assets/javascripts/projects/terraform_notification/index.js index eb04f109a8e..0a273247930 100644 --- a/app/assets/javascripts/projects/terraform_notification/index.js +++ b/app/assets/javascripts/projects/terraform_notification/index.js @@ -1,18 +1,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) { + if (!el || parseBoolean(getCookie(bannerDismissedKey))) { return false; } - const { projectId } = el.dataset; + const { terraformImagePath } = el.dataset; return new Vue({ el, - render: (createElement) => - createElement(TerraformNotification, { props: { projectId: Number(projectId) } }), + provide: { + terraformImagePath, + bannerDismissedKey, + }, + render: (createElement) => createElement(TerraformNotification), }); }; |