2017-09-10 17:25:29 +05:30
< script >
2022-06-21 17:19:12 +05:30
import { GlSprintf , GlLink , GlAlert } from '@gitlab/ui' ;
2023-03-04 22:38:38 +05:30
import { _ _ , sprintf } from '~/locale' ;
2023-05-27 22:25:52 +05:30
import {
TYPE _ALERT ,
TYPE _EPIC ,
TYPE _ISSUE ,
TYPE _MERGE _REQUEST ,
TYPE _TEST _CASE ,
} from '~/issues/constants' ;
2021-11-18 22:05:49 +05:30
2023-03-04 22:38:38 +05:30
export const i18n = Object . freeze ( {
alertMessage : _ _ (
"Someone edited the %{issuableType} at the same time you did. Review %{linkStart}the %{issuableType}%{linkEnd} and make sure you don't unintentionally overwrite their changes." ,
) ,
} ) ;
2019-09-30 21:07:59 +05:30
2018-12-13 13:39:08 +05:30
export default {
2021-11-18 22:05:49 +05:30
components : {
GlSprintf ,
GlLink ,
2022-06-21 17:19:12 +05:30
GlAlert ,
2021-11-18 22:05:49 +05:30
} ,
2023-03-04 22:38:38 +05:30
props : {
issuableType : {
type : String ,
required : true ,
validator ( value ) {
2023-05-27 22:25:52 +05:30
return [ TYPE _ALERT , TYPE _EPIC , TYPE _ISSUE , TYPE _MERGE _REQUEST , TYPE _TEST _CASE ] . includes (
value ,
) ;
2023-03-04 22:38:38 +05:30
} ,
} ,
} ,
2018-12-13 13:39:08 +05:30
computed : {
currentPath ( ) {
return window . location . pathname ;
2017-09-10 17:25:29 +05:30
} ,
2023-03-04 22:38:38 +05:30
alertMessage ( ) {
return sprintf ( this . $options . i18n . alertMessage , { issuableType : this . issuableType } ) ;
} ,
2018-12-13 13:39:08 +05:30
} ,
2023-03-04 22:38:38 +05:30
i18n ,
2018-12-13 13:39:08 +05:30
} ;
2017-09-10 17:25:29 +05:30
< / script >
< template >
2022-06-21 17:19:12 +05:30
< gl-alert variant = "danger" class = "gl-mb-5" :dismissible = "false" >
2023-03-04 22:38:38 +05:30
< gl-sprintf :message = "alertMessage" >
2021-11-18 22:05:49 +05:30
< template # link = "{ content }" >
< gl-link :href = "currentPath" target = "_blank" rel = "nofollow" >
{ { content } }
< / gl-link >
< / template >
< / gl-sprintf >
2022-06-21 17:19:12 +05:30
< / gl-alert >
2017-09-10 17:25:29 +05:30
< / template >