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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
<script>
import { uniqueId } from 'lodash';
import { GlLink, GlIcon, GlButton, GlPopover, GlTooltipDirective as GlTooltip } from '@gitlab/ui';
import GitlabExperiment from '~/experimentation/components/gitlab_experiment.vue';
import { isExperimentVariant } from '~/experimentation/utils';
import eventHub from '~/invite_members/event_hub';
import { s__, __ } from '~/locale';
import { ACTION_LABELS } from '../constants';
import IncludedInTrialIndicator from './included_in_trial_indicator.vue';
export default {
name: 'LearnGitlabSectionLink',
components: {
GlLink,
GlIcon,
GlButton,
GlPopover,
GitlabExperiment,
IncludedInTrialIndicator,
},
directives: {
GlTooltip,
},
i18n: {
contactAdmin: s__('LearnGitlab|Contact your administrator to start a free Ultimate trial.'),
viewAdminList: s__('LearnGitlab|View administrator list'),
watchHow: __('Watch how'),
},
props: {
action: {
required: true,
type: String,
},
value: {
required: true,
type: Object,
},
},
data() {
return {
popoverId: uniqueId('contact-admin-'),
};
},
computed: {
showInviteModalLink() {
return (
this.action === 'userAdded' && isExperimentVariant('invite_for_help_continuous_onboarding')
);
},
openInNewTab() {
return ACTION_LABELS[this.action]?.openInNewTab === true || this.value.openInNewTab === true;
},
},
methods: {
openModal() {
eventHub.$emit('openModal', { source: 'learn_gitlab' });
},
actionLabelValue(value) {
return ACTION_LABELS[this.action][value];
},
},
};
</script>
<template>
<div class="gl-mb-4">
<div class="flex align-items-center">
<span v-if="value.completed" class="gl-text-green-500">
<gl-icon name="check-circle-filled" :size="16" data-testid="completed-icon" />
{{ actionLabelValue('title') }}
<included-in-trial-indicator v-if="actionLabelValue('trialRequired')" />
</span>
<div v-else-if="showInviteModalLink">
<gl-link
data-track-action="click_link"
:data-track-label="actionLabelValue('trackLabel')"
data-track-property="Growth::Activation::Experiment::InviteForHelpContinuousOnboarding"
data-testid="invite-for-help-continuous-onboarding-experiment-link"
@click="openModal"
>{{ actionLabelValue('title') }}</gl-link
>
<included-in-trial-indicator v-if="actionLabelValue('trialRequired')" />
</div>
<div v-else-if="value.enabled">
<gl-link
:target="openInNewTab ? '_blank' : '_self'"
:href="value.url"
data-testid="uncompleted-learn-gitlab-link"
data-track-action="click_link"
:data-track-label="actionLabelValue('trackLabel')"
>{{ actionLabelValue('title') }}</gl-link
>
<included-in-trial-indicator v-if="actionLabelValue('trialRequired')" />
</div>
<template v-else>
<div data-testid="disabled-learn-gitlab-link">{{ actionLabelValue('title') }}</div>
<gl-button
:id="popoverId"
category="tertiary"
icon="question-o"
class="ml-auto"
:aria-label="$options.i18n.contactAdmin"
size="small"
data-testid="contact-admin-popover-trigger"
/>
<gl-popover
:target="popoverId"
placement="top"
triggers="hover focus"
data-testid="contact-admin-popover"
>
<p>{{ $options.i18n.contactAdmin }}</p>
<gl-link
:href="value.url"
class="font-size-inherit"
data-testid="view-administrator-link-text"
>
{{ $options.i18n.viewAdminList }}
</gl-link>
</gl-popover>
</template>
<gitlab-experiment name="video_tutorials_continuous_onboarding">
<template #control></template>
<template #candidate>
<gl-button
v-if="actionLabelValue('videoTutorial')"
v-gl-tooltip
category="tertiary"
icon="live-preview"
:title="$options.i18n.watchHow"
:aria-label="$options.i18n.watchHow"
:href="actionLabelValue('videoTutorial')"
target="_blank"
class="ml-auto"
size="small"
data-testid="video-tutorial-link"
data-track-action="click_video_link"
:data-track-label="actionLabelValue('trackLabel')"
data-track-property="Growth::Conversion::Experiment::LearnGitLab"
data-track-experiment="video_tutorials_continuous_onboarding"
/>
</template>
</gitlab-experiment>
</div>
</div>
</template>
|