2020-02-24 16:09:08 -05:00
< script >
2020-08-26 14:11:43 -04:00
import { GlModal , GlSprintf , GlLink , GlButton } from '@gitlab/ui' ;
2022-02-01 16:12:02 -05:00
import { getCookie , removeCookie } from '~/lib/utils/common_utils' ;
2021-11-05 02:13:16 -04:00
import { _ _ , s _ _ } from '~/locale' ;
2020-03-31 14:07:42 -04:00
import Tracking from '~/tracking' ;
const trackingMixin = Tracking . mixin ( ) ;
2020-02-24 16:09:08 -05:00
export default {
beginnerLink :
'https://about.gitlab.com/blog/2018/01/22/a-beginners-guide-to-continuous-integration/' ,
2020-08-26 14:11:43 -04:00
goToTrackValuePipelines : 10 ,
goToTrackValueMergeRequest : 20 ,
2020-04-01 11:07:45 -04:00
trackEvent : 'click_button' ,
2020-02-24 16:09:08 -05:00
components : {
GlModal ,
GlSprintf ,
2020-08-26 14:11:43 -04:00
GlButton ,
2020-02-24 16:09:08 -05:00
GlLink ,
} ,
2020-03-31 14:07:42 -04:00
mixins : [ trackingMixin ] ,
2020-02-24 16:09:08 -05:00
props : {
goToPipelinesPath : {
type : String ,
required : true ,
} ,
2020-08-26 14:11:43 -04:00
projectMergeRequestsPath : {
type : String ,
required : false ,
default : '' ,
} ,
2020-02-24 16:09:08 -05:00
commitCookie : {
type : String ,
required : true ,
} ,
2020-03-31 14:07:42 -04:00
humanAccess : {
type : String ,
required : true ,
} ,
2020-11-09 16:08:48 -05:00
exampleLink : {
type : String ,
required : true ,
} ,
codeQualityLink : {
type : String ,
required : true ,
} ,
2020-03-31 14:07:42 -04:00
} ,
data ( ) {
return {
2020-04-01 11:07:45 -04:00
trackLabel : 'congratulate_first_pipeline' ,
2020-03-31 14:07:42 -04:00
} ;
2020-02-24 16:09:08 -05:00
} ,
2020-04-01 11:07:45 -04:00
computed : {
tracking ( ) {
return {
label : this . trackLabel ,
property : this . humanAccess ,
} ;
} ,
2020-08-26 14:11:43 -04:00
goToMergeRequestPath ( ) {
return this . commitCookiePath || this . projectMergeRequestsPath ;
} ,
commitCookiePath ( ) {
2022-02-01 16:12:02 -05:00
const cookieVal = getCookie ( this . commitCookie ) ;
2020-08-26 14:11:43 -04:00
if ( cookieVal !== 'true' ) return cookieVal ;
return '' ;
} ,
2020-04-01 11:07:45 -04:00
} ,
2020-10-19 05:08:58 -04:00
i18n : {
2021-11-05 02:13:16 -04:00
modalTitle : _ _ ( "That's it, well done!" ) ,
2020-10-19 05:08:58 -04:00
pipelinesButton : s _ _ ( 'MR widget|See your pipeline in action' ) ,
2021-11-22 16:10:35 -05:00
mergeRequestButton : s _ _ ( 'MR widget|Back to the merge request' ) ,
2020-10-19 05:08:58 -04:00
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-02-24 16:09:08 -05:00
mounted ( ) {
2020-03-31 14:07:42 -04:00
this . track ( ) ;
2020-02-24 16:09:08 -05:00
this . disableModalFromRenderingAgain ( ) ;
} ,
methods : {
disableModalFromRenderingAgain ( ) {
2022-02-01 16:12:02 -05:00
removeCookie ( this . commitCookie ) ;
2020-02-24 16:09:08 -05:00
} ,
} ,
} ;
< / script >
< template >
2020-10-19 05:08:58 -04:00
< 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-02-24 16:09:08 -05:00
< p >
2020-10-19 05:08:58 -04:00
< gl-sprintf :message = "$options.i18n.bodyMessage" >
2020-12-23 07:10:26 -05:00
< template # codeQualityLink = "{ content }" >
2020-11-09 16:08:48 -05:00
< gl-link :href = "codeQualityLink" target = "_blank" class = "font-size-inherit" > { {
2020-07-17 20:09:34 -04:00
content
} } < / gl-link >
< / template >
< / gl-sprintf >
2020-02-24 16:09:08 -05:00
< / p >
2020-10-19 05:08:58 -04:00
< gl-sprintf :message = "$options.i18n.helpMessage" >
2020-12-23 07:10:26 -05:00
< template # beginnerLink = "{ content }" >
2020-02-24 16:09:08 -05:00
< gl-link :href = "$options.beginnerLink" target = "_blank" >
{ { content } }
< / gl-link >
< / template >
2020-12-23 07:10:26 -05:00
< template # exampleLink = "{ content }" >
2020-11-09 16:08:48 -05:00
< gl-link :href = "exampleLink" target = "_blank" >
2020-02-24 16:09:08 -05:00
{ { content } }
< / gl-link >
< / template >
< / gl-sprintf >
< template # modal -footer >
2020-08-26 14:11:43 -04:00
< gl-button
v - if = "projectMergeRequestsPath"
ref = "goToMergeRequest"
: href = "goToMergeRequestPath"
: data - track - property = "humanAccess"
: data - track - value = "$options.goToTrackValueMergeRequest"
2021-09-15 14:11:29 -04:00
: data - track - action = "$options.trackEvent"
2020-08-26 14:11:43 -04:00
: data - track - label = "trackLabel"
>
2020-10-19 05:08:58 -04:00
{ { $options . i18n . mergeRequestButton } }
2020-08-26 14:11:43 -04:00
< / gl-button >
< gl-button
ref = "goToPipelines"
2020-04-01 11:07:45 -04:00
: href = "goToPipelinesPath"
2022-05-12 05:08:08 -04:00
variant = "confirm"
2020-04-01 11:07:45 -04:00
: data - track - property = "humanAccess"
2020-08-26 14:11:43 -04:00
: data - track - value = "$options.goToTrackValuePipelines"
2021-09-15 14:11:29 -04:00
: data - track - action = "$options.trackEvent"
2020-04-01 11:07:45 -04:00
: data - track - label = "trackLabel"
>
2020-10-19 05:08:58 -04:00
{ { $options . i18n . pipelinesButton } }
2020-08-26 14:11:43 -04:00
< / gl-button >
2020-02-24 16:09:08 -05:00
< / template >
< / gl-modal >
< / template >