2017-08-17 22:00:37 +05:30
|
|
|
<script>
|
2020-10-24 23:57:45 +05:30
|
|
|
import { GlTooltipDirective, GlButton } from '@gitlab/ui';
|
2022-11-25 23:54:43 +05:30
|
|
|
import ModalCopyButton from '~/vue_shared/components/modal_copy_button.vue';
|
|
|
|
import { s__, __ } from '~/locale';
|
|
|
|
import { isSafeURL } from '~/lib/utils/url_utility';
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
/**
|
|
|
|
* Renders the external url link in environments table.
|
|
|
|
*/
|
|
|
|
export default {
|
|
|
|
components: {
|
2020-10-24 23:57:45 +05:30
|
|
|
GlButton,
|
2022-11-25 23:54:43 +05:30
|
|
|
ModalCopyButton,
|
2018-11-18 11:00:15 +05:30
|
|
|
},
|
|
|
|
directives: {
|
2019-02-15 15:39:39 +05:30
|
|
|
GlTooltip: GlTooltipDirective,
|
2018-11-18 11:00:15 +05:30
|
|
|
},
|
|
|
|
props: {
|
|
|
|
externalUrl: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
2018-10-15 14:42:47 +05:30
|
|
|
},
|
2018-11-18 11:00:15 +05:30
|
|
|
},
|
2021-11-18 22:05:49 +05:30
|
|
|
i18n: {
|
|
|
|
title: s__('Environments|Open live environment'),
|
|
|
|
open: s__('Environments|Open'),
|
2022-11-25 23:54:43 +05:30
|
|
|
copy: __('Copy URL'),
|
|
|
|
copyTitle: s__('Environments|Copy live environment URL'),
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
isSafeUrl() {
|
|
|
|
return isSafeURL(this.externalUrl);
|
|
|
|
},
|
2018-11-18 11:00:15 +05:30
|
|
|
},
|
|
|
|
};
|
2017-08-17 22:00:37 +05:30
|
|
|
</script>
|
|
|
|
<template>
|
2020-10-24 23:57:45 +05:30
|
|
|
<gl-button
|
2022-11-25 23:54:43 +05:30
|
|
|
v-if="isSafeUrl"
|
2019-02-15 15:39:39 +05:30
|
|
|
v-gl-tooltip
|
2021-11-18 22:05:49 +05:30
|
|
|
:title="$options.i18n.title"
|
|
|
|
:aria-label="$options.i18n.title"
|
2018-11-08 19:23:39 +05:30
|
|
|
:href="externalUrl"
|
2020-10-24 23:57:45 +05:30
|
|
|
class="external-url"
|
2017-08-17 22:00:37 +05:30
|
|
|
target="_blank"
|
2020-10-24 23:57:45 +05:30
|
|
|
icon="external-link"
|
2017-08-17 22:00:37 +05:30
|
|
|
rel="noopener noreferrer nofollow"
|
2021-11-18 22:05:49 +05:30
|
|
|
>
|
|
|
|
{{ $options.i18n.open }}
|
|
|
|
</gl-button>
|
2022-11-25 23:54:43 +05:30
|
|
|
<modal-copy-button v-else :title="$options.i18n.copyTitle" :text="externalUrl">
|
|
|
|
{{ $options.i18n.copy }}
|
|
|
|
</modal-copy-button>
|
2017-08-17 22:00:37 +05:30
|
|
|
</template>
|