diff options
Diffstat (limited to 'app/assets/javascripts/projects/terraform_notification/components/terraform_notification.vue')
-rw-r--r-- | app/assets/javascripts/projects/terraform_notification/components/terraform_notification.vue | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/app/assets/javascripts/projects/terraform_notification/components/terraform_notification.vue b/app/assets/javascripts/projects/terraform_notification/components/terraform_notification.vue index 0b398eddc9c..02e31d6fbb3 100644 --- a/app/assets/javascripts/projects/terraform_notification/components/terraform_notification.vue +++ b/app/assets/javascripts/projects/terraform_notification/components/terraform_notification.vue @@ -1,7 +1,7 @@ <script> import { GlBanner } from '@gitlab/ui'; import { helpPagePath } from '~/helpers/help_page_helper'; -import { parseBoolean, setCookie, getCookie } from '~/lib/utils/common_utils'; +import { setCookie } from '~/lib/utils/common_utils'; import { s__ } from '~/locale'; export default { @@ -16,50 +16,36 @@ export default { components: { GlBanner, }, - props: { - projectId: { - type: Number, - required: true, - }, - }, + inject: ['terraformImagePath', 'bannerDismissedKey'], data() { return { isVisible: true, }; }, computed: { - bannerDissmisedKey() { - return `terraform_notification_dismissed_for_project_${this.projectId}`; - }, docsUrl() { return helpPagePath('user/infrastructure/terraform_state'); }, }, - created() { - if (parseBoolean(getCookie(this.bannerDissmisedKey))) { - this.isVisible = false; - } - }, methods: { handleClose() { - setCookie(this.bannerDissmisedKey, true); + setCookie(this.bannerDismissedKey, true); this.isVisible = false; }, }, }; </script> <template> - <div v-if="isVisible"> - <div class="gl-py-5"> - <gl-banner - :title="$options.i18n.title" - :button-text="$options.i18n.buttonText" - :button-link="docsUrl" - variant="introduction" - @close="handleClose" - > - <p>{{ $options.i18n.description }}</p> - </gl-banner> - </div> + <div v-if="isVisible" class="gl-py-5"> + <gl-banner + :title="$options.i18n.title" + :button-text="$options.i18n.buttonText" + :button-link="docsUrl" + :svg-path="terraformImagePath" + variant="promotion" + @close="handleClose" + > + <p>{{ $options.i18n.description }}</p> + </gl-banner> </div> </template> |