Commit b06f1cdd authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera

Merge branch 'okr-modal-copy-button' into 'master'

Migrate button in modal_copy_button.vue

Closes #219777

See merge request gitlab-org/gitlab!43714
parents 0e935b65 d4cb2b77
<script> <script>
import $ from 'jquery'; import $ from 'jquery';
import { GlDeprecatedButton, GlTooltipDirective, GlIcon } from '@gitlab/ui'; import { GlButton, GlTooltipDirective } from '@gitlab/ui';
import Clipboard from 'clipboard'; import Clipboard from 'clipboard';
import { __ } from '~/locale'; import { __ } from '~/locale';
export default { export default {
components: { components: {
GlDeprecatedButton, GlButton,
GlIcon,
}, },
directives: { directives: {
GlTooltip: GlTooltipDirective, GlTooltip: GlTooltipDirective,
}, },
props: { props: {
text: { text: {
type: String, type: String,
...@@ -55,15 +52,12 @@ export default { ...@@ -55,15 +52,12 @@ export default {
default: null, default: null,
}, },
}, },
copySuccessText: __('Copied'), copySuccessText: __('Copied'),
computed: { computed: {
modalDomId() { modalDomId() {
return this.modalId ? `#${this.modalId}` : ''; return this.modalId ? `#${this.modalId}` : '';
}, },
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.clipboard = new Clipboard(this.$el, { this.clipboard = new Clipboard(this.$el, {
...@@ -83,13 +77,11 @@ export default { ...@@ -83,13 +77,11 @@ export default {
.on('error', e => this.$emit('error', e)); .on('error', e => this.$emit('error', e));
}); });
}, },
destroyed() { destroyed() {
if (this.clipboard) { if (this.clipboard) {
this.clipboard.destroy(); this.clipboard.destroy();
} }
}, },
methods: { methods: {
updateTooltip(target) { updateTooltip(target) {
const $target = $(target); const $target = $(target);
...@@ -112,15 +104,12 @@ export default { ...@@ -112,15 +104,12 @@ export default {
}; };
</script> </script>
<template> <template>
<gl-deprecated-button <gl-button
v-gl-tooltip="{ placement: tooltipPlacement, container: tooltipContainer }" v-gl-tooltip="{ placement: tooltipPlacement, container: tooltipContainer }"
:class="cssClasses" :class="cssClasses"
:data-clipboard-target="target" :data-clipboard-target="target"
:data-clipboard-text="text" :data-clipboard-text="text"
:title="title" :title="title"
> icon="copy-to-clipboard"
<slot> />
<gl-icon name="copy-to-clipboard" />
</slot>
</gl-deprecated-button>
</template> </template>
---
title: Update button in modal_copy_button.vue to use GlButton from GitLab UI
merge_request: 43714
author:
type: other
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment