1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
<script>
import { GlDisclosureDropdown, GlTooltipDirective } from '@gitlab/ui';
import { getHTTPProtocol } from '~/lib/utils/url_utility';
import { __, sprintf } from '~/locale';
import CloneDropdownItem from './clone_dropdown_item.vue';
export default {
components: {
GlDisclosureDropdown,
CloneDropdownItem,
},
directives: {
GlTooltip: GlTooltipDirective,
},
props: {
sshLink: {
type: String,
required: false,
default: '',
},
httpLink: {
type: String,
required: false,
default: '',
},
},
computed: {
httpLabel() {
const protocol = this.httpLink ? getHTTPProtocol(this.httpLink)?.toUpperCase() : '';
return sprintf(__('Clone with %{protocol}'), { protocol });
},
},
labels: {
defaultLabel: __('Clone'),
ssh: __('Clone with SSH'),
},
};
</script>
<template>
<gl-disclosure-dropdown
:toggle-text="$options.labels.defaultLabel"
category="primary"
variant="confirm"
placement="right"
>
<clone-dropdown-item
v-if="sshLink"
:label="$options.labels.ssh"
:link="sshLink"
qa-selector="copy_ssh_url_button"
/>
<clone-dropdown-item
v-if="httpLink"
:label="httpLabel"
:link="httpLink"
qa-selector="copy_http_url_button"
/>
</gl-disclosure-dropdown>
</template>
|