diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-27 18:07:48 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-27 18:07:48 +0000 |
commit | e20baee820ea2c76ee16980a98e8080f255d9035 (patch) | |
tree | 6e13a73bee42b7ef310850d03982faebea17a0b1 /app/assets/javascripts/serverless | |
parent | 71c5863d7b1ca9836a7d7703f35750cd726a9846 (diff) | |
download | gitlab-ce-e20baee820ea2c76ee16980a98e8080f255d9035.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/serverless')
-rw-r--r-- | app/assets/javascripts/serverless/survey_banner.js | 36 | ||||
-rw-r--r-- | app/assets/javascripts/serverless/survey_banner.vue | 52 |
2 files changed, 88 insertions, 0 deletions
diff --git a/app/assets/javascripts/serverless/survey_banner.js b/app/assets/javascripts/serverless/survey_banner.js new file mode 100644 index 00000000000..070e8f4c661 --- /dev/null +++ b/app/assets/javascripts/serverless/survey_banner.js @@ -0,0 +1,36 @@ +import Vue from 'vue'; +import { setUrlParams } from '~/lib/utils/url_utility'; +import SurveyBanner from './survey_banner.vue'; + +let bannerInstance; +const SURVEY_URL_BASE = 'https://gitlab.fra1.qualtrics.com/jfe/form/SV_00PfofFfY9s8Shf'; + +export default function initServerlessSurveyBanner() { + const el = document.querySelector('.js-serverless-survey-banner'); + if (el && !bannerInstance) { + const { userName, userEmail } = el.dataset; + + // pre-populate survey fields + const surveyUrl = setUrlParams( + { + Q_PopulateResponse: JSON.stringify({ + QID1: userEmail, + QID2: userName, + QID16: '1', // selects "yes" to "do you currently use GitLab?" + }), + }, + SURVEY_URL_BASE, + ); + + bannerInstance = new Vue({ + el, + render(createElement) { + return createElement(SurveyBanner, { + props: { + surveyUrl, + }, + }); + }, + }); + } +} diff --git a/app/assets/javascripts/serverless/survey_banner.vue b/app/assets/javascripts/serverless/survey_banner.vue new file mode 100644 index 00000000000..a0a90fa5e80 --- /dev/null +++ b/app/assets/javascripts/serverless/survey_banner.vue @@ -0,0 +1,52 @@ +<script> +import Cookies from 'js-cookie'; +import { parseBoolean } from '~/lib/utils/common_utils'; +import { GlBanner } from '@gitlab/ui'; + +export default { + components: { + GlBanner, + }, + props: { + surveyUrl: { + type: String, + required: true, + }, + }, + data() { + return { + visible: true, + }; + }, + created() { + if (parseBoolean(Cookies.get('hide_serverless_survey'))) { + this.visible = false; + } + }, + methods: { + handleClose() { + Cookies.set('hide_serverless_survey', 'true', { expires: 365 * 10 }); + this.visible = false; + }, + }, +}; +</script> + +<template> + <gl-banner + v-if="visible" + class="mt-4" + :title="s__('Serverless|Help shape the future of Serverless at GitLab')" + :button-text="s__('Serverless|Sign up for First Look')" + :button-link="surveyUrl" + @close="handleClose" + > + <p> + {{ + s__( + 'Serverless|We are continually striving to improve our Serverless functionality. As a Knative user, we would love to hear how we can make this experience better for you. Sign up for GitLab First Look today and we will be in touch shortly.', + ) + }} + </p> + </gl-banner> +</template> |