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
|
<script>
import { GlButton } from '@gitlab/ui';
import { __, s__ } from '~/locale';
import Tracking from '~/tracking';
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { pipelineEditorTrackingOptions, TEMPLATE_REPOSITORY_URL } from '../../constants';
export default {
i18n: {
browseTemplates: __('Browse templates'),
help: __('Help'),
jobAssistant: s__('JobAssistant|Job assistant'),
aiAssistant: s__('PipelinesAiAssistant|Ai assistant'),
},
TEMPLATE_REPOSITORY_URL,
components: {
GlButton,
},
mixins: [glFeatureFlagMixin(), Tracking.mixin()],
inject: ['aiChatAvailable'],
props: {
showDrawer: {
type: Boolean,
required: true,
},
showJobAssistantDrawer: {
type: Boolean,
required: true,
},
showAiAssistantDrawer: {
type: Boolean,
required: true,
},
},
computed: {
isAiConfigChatAvailable() {
return this.glFeatures.aiCiConfigGenerator && this.aiChatAvailable;
},
},
methods: {
toggleDrawer() {
if (this.showDrawer) {
this.$emit('close-drawer');
} else {
this.$emit('open-drawer');
this.trackHelpDrawerClick();
}
},
toggleJobAssistantDrawer() {
this.$emit(
this.showJobAssistantDrawer ? 'close-job-assistant-drawer' : 'open-job-assistant-drawer',
);
},
toggleAiAssistantDrawer() {
this.$emit(
this.showAiAssistantDrawer ? 'close-ai-assistant-drawer' : 'open-ai-assistant-drawer',
);
},
trackHelpDrawerClick() {
const { label, actions } = pipelineEditorTrackingOptions;
this.track(actions.openHelpDrawer, { label });
},
trackTemplateBrowsing() {
const { label, actions } = pipelineEditorTrackingOptions;
this.track(actions.browseTemplates, { label });
},
},
};
</script>
<template>
<div class="gl-display-flex gl-p-3 gl-gap-3 gl-border-solid gl-border-gray-100 gl-border-1">
<gl-button
:href="$options.TEMPLATE_REPOSITORY_URL"
size="small"
icon="external-link"
target="_blank"
data-testid="template-repo-link"
data-qa-selector="template_repo_link"
@click="trackTemplateBrowsing"
>
{{ $options.i18n.browseTemplates }}
</gl-button>
<gl-button
icon="information-o"
size="small"
data-testid="drawer-toggle"
data-qa-selector="drawer_toggle"
@click="toggleDrawer"
>
{{ $options.i18n.help }}
</gl-button>
<gl-button
v-if="glFeatures.ciJobAssistantDrawer"
icon="bulb"
size="small"
data-testid="job-assistant-drawer-toggle"
data-qa-selector="job_assistant_drawer_toggle"
@click="toggleJobAssistantDrawer"
>
{{ $options.i18n.jobAssistant }}
</gl-button>
<gl-button
v-if="isAiConfigChatAvailable"
icon="bulb"
size="small"
data-testid="ai-assistant-drawer-toggle"
data-qa-selector="ai_assistant_drawer_toggle"
@click="toggleAiAssistantDrawer"
>
{{ $options.i18n.aiAssistant }}
</gl-button>
</div>
</template>
|