2020-03-13 15:09:21 +00:00
|
|
|
<script>
|
2020-08-19 18:10:34 +00:00
|
|
|
import { GlPopover, GlButton, GlTooltipDirective } from '@gitlab/ui';
|
2020-03-13 15:09:21 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
maxTextLength: 95,
|
|
|
|
components: {
|
|
|
|
GlPopover,
|
2020-08-19 18:10:34 +00:00
|
|
|
GlButton,
|
2020-03-13 15:09:21 +00:00
|
|
|
},
|
|
|
|
directives: {
|
|
|
|
GlTooltip: GlTooltipDirective,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
target: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
value: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
tooltipText: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
displayValue() {
|
|
|
|
if (this.value.length > this.$options.maxTextLength) {
|
|
|
|
return `${this.value.substring(0, this.$options.maxTextLength)}...`;
|
|
|
|
}
|
|
|
|
return this.value;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div id="popover-container">
|
2021-03-25 06:09:02 +00:00
|
|
|
<gl-popover :target="target" placement="top" container="popover-container">
|
2021-02-02 18:09:42 +00:00
|
|
|
<div
|
|
|
|
class="gl-display-flex gl-justify-content-space-between gl-align-items-center gl-word-break-all"
|
|
|
|
>
|
2020-08-19 18:10:34 +00:00
|
|
|
<div class="ci-popover-value gl-pr-3">
|
|
|
|
{{ displayValue }}
|
|
|
|
</div>
|
|
|
|
<gl-button
|
2020-03-13 15:09:21 +00:00
|
|
|
v-gl-tooltip
|
2020-08-19 18:10:34 +00:00
|
|
|
category="tertiary"
|
|
|
|
icon="copy-to-clipboard"
|
2020-03-13 15:09:21 +00:00
|
|
|
:title="tooltipText"
|
|
|
|
:data-clipboard-text="value"
|
2020-08-19 18:10:34 +00:00
|
|
|
:aria-label="__('Copy to clipboard')"
|
|
|
|
/>
|
2020-03-13 15:09:21 +00:00
|
|
|
</div>
|
|
|
|
</gl-popover>
|
|
|
|
</div>
|
|
|
|
</template>
|