debian-mirror-gitlab/app/assets/javascripts/blob/pipeline_tour_success_modal.vue

146 lines
4.1 KiB
Vue
Raw Normal View History

2020-04-08 14:13:33 +05:30
<script>
2020-11-24 15:15:51 +05:30
import { GlModal, GlSprintf, GlLink, GlButton } from '@gitlab/ui';
2020-04-08 14:13:33 +05:30
import Cookies from 'js-cookie';
2021-01-03 14:25:43 +05:30
import { s__ } from '~/locale';
2020-04-22 19:07:51 +05:30
import Tracking from '~/tracking';
const trackingMixin = Tracking.mixin();
2020-04-08 14:13:33 +05:30
export default {
beginnerLink:
'https://about.gitlab.com/blog/2018/01/22/a-beginners-guide-to-continuous-integration/',
2020-11-24 15:15:51 +05:30
goToTrackValuePipelines: 10,
goToTrackValueMergeRequest: 20,
2020-04-22 19:07:51 +05:30
trackEvent: 'click_button',
2020-04-08 14:13:33 +05:30
components: {
GlModal,
GlSprintf,
2020-11-24 15:15:51 +05:30
GlButton,
2020-04-08 14:13:33 +05:30
GlLink,
},
2020-04-22 19:07:51 +05:30
mixins: [trackingMixin],
2020-04-08 14:13:33 +05:30
props: {
goToPipelinesPath: {
type: String,
required: true,
},
2020-11-24 15:15:51 +05:30
projectMergeRequestsPath: {
type: String,
required: false,
default: '',
},
2020-04-08 14:13:33 +05:30
commitCookie: {
type: String,
required: true,
},
2020-04-22 19:07:51 +05:30
humanAccess: {
type: String,
required: true,
},
2021-01-29 00:20:46 +05:30
exampleLink: {
type: String,
required: true,
},
codeQualityLink: {
type: String,
required: true,
},
2020-04-22 19:07:51 +05:30
},
data() {
return {
trackLabel: 'congratulate_first_pipeline',
};
},
computed: {
tracking() {
return {
label: this.trackLabel,
property: this.humanAccess,
};
},
2020-11-24 15:15:51 +05:30
goToMergeRequestPath() {
return this.commitCookiePath || this.projectMergeRequestsPath;
},
commitCookiePath() {
const cookieVal = Cookies.get(this.commitCookie);
if (cookieVal !== 'true') return cookieVal;
return '';
},
2020-04-08 14:13:33 +05:30
},
2021-01-03 14:25:43 +05:30
i18n: {
modalTitle: s__("That's it, well done!"),
pipelinesButton: s__('MR widget|See your pipeline in action'),
mergeRequestButton: s__('MR widget|Back to the Merge request'),
bodyMessage: s__(
`MR widget|The pipeline will test your code on every commit. A %{codeQualityLinkStart}code quality report%{codeQualityLinkEnd} will appear in your merge requests to warn you about potential code degradations.`,
),
helpMessage: s__(
`MR widget|Take a look at our %{beginnerLinkStart}Beginner's Guide to Continuous Integration%{beginnerLinkEnd} and our %{exampleLinkStart}examples of GitLab CI/CD%{exampleLinkEnd} to learn more.`,
),
},
2020-04-08 14:13:33 +05:30
mounted() {
2020-04-22 19:07:51 +05:30
this.track();
2020-04-08 14:13:33 +05:30
this.disableModalFromRenderingAgain();
},
methods: {
disableModalFromRenderingAgain() {
Cookies.remove(this.commitCookie);
},
},
};
</script>
<template>
2021-01-03 14:25:43 +05:30
<gl-modal visible size="sm" modal-id="success-pipeline-modal-id-not-used">
<template #modal-title>
{{ $options.i18n.modalTitle }}
<gl-emoji class="gl-vertical-align-baseline font-size-inherit gl-mr-1" data-name="tada" />
</template>
2020-04-08 14:13:33 +05:30
<p>
2021-01-03 14:25:43 +05:30
<gl-sprintf :message="$options.i18n.bodyMessage">
2020-10-24 23:57:45 +05:30
<template #codeQualityLink="{content}">
2021-01-29 00:20:46 +05:30
<gl-link :href="codeQualityLink" target="_blank" class="font-size-inherit">{{
2020-10-24 23:57:45 +05:30
content
}}</gl-link>
</template>
</gl-sprintf>
2020-04-08 14:13:33 +05:30
</p>
2021-01-03 14:25:43 +05:30
<gl-sprintf :message="$options.i18n.helpMessage">
2020-04-08 14:13:33 +05:30
<template #beginnerLink="{content}">
<gl-link :href="$options.beginnerLink" target="_blank">
{{ content }}
</gl-link>
</template>
<template #exampleLink="{content}">
2021-01-29 00:20:46 +05:30
<gl-link :href="exampleLink" target="_blank">
2020-04-08 14:13:33 +05:30
{{ content }}
</gl-link>
</template>
</gl-sprintf>
<template #modal-footer>
2020-11-24 15:15:51 +05:30
<gl-button
v-if="projectMergeRequestsPath"
ref="goToMergeRequest"
:href="goToMergeRequestPath"
:data-track-property="humanAccess"
:data-track-value="$options.goToTrackValueMergeRequest"
:data-track-event="$options.trackEvent"
:data-track-label="trackLabel"
>
2021-01-03 14:25:43 +05:30
{{ $options.i18n.mergeRequestButton }}
2020-11-24 15:15:51 +05:30
</gl-button>
<gl-button
ref="goToPipelines"
2020-04-22 19:07:51 +05:30
:href="goToPipelinesPath"
2020-11-24 15:15:51 +05:30
variant="success"
2020-04-22 19:07:51 +05:30
:data-track-property="humanAccess"
2020-11-24 15:15:51 +05:30
:data-track-value="$options.goToTrackValuePipelines"
2020-04-22 19:07:51 +05:30
:data-track-event="$options.trackEvent"
:data-track-label="trackLabel"
>
2021-01-03 14:25:43 +05:30
{{ $options.i18n.pipelinesButton }}
2020-11-24 15:15:51 +05:30
</gl-button>
2020-04-08 14:13:33 +05:30
</template>
</gl-modal>
</template>