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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

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';
2022-04-04 11:22:00 +05:30
import { getCookie, removeCookie } from '~/lib/utils/common_utils';
2021-12-11 22:18:48 +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() {
2022-04-04 11:22:00 +05:30
const cookieVal = getCookie(this.commitCookie);
2020-11-24 15:15:51 +05:30
if (cookieVal !== 'true') return cookieVal;
return '';
},
2020-04-08 14:13:33 +05:30
},
2021-01-03 14:25:43 +05:30
i18n: {
2021-12-11 22:18:48 +05:30
modalTitle: __("That's it, well done!"),
2021-01-03 14:25:43 +05:30
pipelinesButton: s__('MR widget|See your pipeline in action'),
2022-01-26 12:08:38 +05:30
mergeRequestButton: s__('MR widget|Back to the merge request'),
2021-01-03 14:25:43 +05:30
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() {
2022-04-04 11:22:00 +05:30
removeCookie(this.commitCookie);
2020-04-08 14:13:33 +05:30
},
},
};
</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">
2021-03-08 18:12:59 +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">
2021-03-08 18:12:59 +05:30
<template #beginnerLink="{ content }">
2020-04-08 14:13:33 +05:30
<gl-link :href="$options.beginnerLink" target="_blank">
{{ content }}
</gl-link>
</template>
2021-03-08 18:12:59 +05:30
<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"
2021-11-11 11:23:49 +05:30
:data-track-action="$options.trackEvent"
2020-11-24 15:15:51 +05:30
: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"
2021-11-11 11:23:49 +05:30
:data-track-action="$options.trackEvent"
2020-04-22 19:07:51 +05:30
: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>