@gitlab/ui 104.2.0 → 105.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +0 -5
- package/dist/tailwind.css +1 -1
- package/dist/tailwind.css.map +1 -1
- package/package.json +1 -3
- package/src/index.js +0 -5
- package/src/scss/components.scss +0 -3
- package/translations.js +0 -57
- package/dist/components/experimental/duo/chat/components/duo_chat_context/constants.js +0 -21
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_details_modal/duo_chat_context_item_details_modal.js +0 -159
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu.js +0 -273
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_category_items.js +0 -77
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_item.js +0 -89
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items.js +0 -147
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items_loading.js +0 -61
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_popover/duo_chat_context_item_popover.js +0 -137
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_selections/duo_chat_context_item_selections.js +0 -163
- package/dist/components/experimental/duo/chat/components/duo_chat_context/mock_context_data.js +0 -308
- package/dist/components/experimental/duo/chat/components/duo_chat_context/utils.js +0 -140
- package/dist/components/experimental/duo/chat/components/duo_chat_conversation/duo_chat_conversation.js +0 -109
- package/dist/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.js +0 -111
- package/dist/components/experimental/duo/chat/components/duo_chat_message/buttons_utils.js +0 -33
- package/dist/components/experimental/duo/chat/components/duo_chat_message/constants.js +0 -14
- package/dist/components/experimental/duo/chat/components/duo_chat_message/copy_code_element.js +0 -24
- package/dist/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.js +0 -300
- package/dist/components/experimental/duo/chat/components/duo_chat_message/insert_code_snippet_element.js +0 -56
- package/dist/components/experimental/duo/chat/components/duo_chat_message/utils.js +0 -17
- package/dist/components/experimental/duo/chat/components/duo_chat_message_sources/duo_chat_message_sources.js +0 -115
- package/dist/components/experimental/duo/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.js +0 -72
- package/dist/components/experimental/duo/chat/constants.js +0 -35
- package/dist/components/experimental/duo/chat/duo_chat.js +0 -553
- package/dist/components/experimental/duo/chat/markdown_renderer.js +0 -25
- package/dist/components/experimental/duo/chat/mock_data.js +0 -170
- package/dist/components/experimental/duo/user_feedback/user_feedback.js +0 -106
- package/dist/components/experimental/duo/user_feedback/user_feedback_modal.js +0 -154
- package/dist/components/experimental/duo/workflow/components/duo_workflow_panel/duo_workflow_panel.js +0 -106
- package/dist/components/experimental/duo/workflow/components/duo_workflow_prompt/duo_workflow_prompt.js +0 -246
- package/src/components/experimental/duo/chat/components/duo_chat_context/constants.js +0 -21
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_details_modal/duo_chat_context_item_details_modal.vue +0 -182
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu.md +0 -44
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu.vue +0 -288
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_category_items.vue +0 -54
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_item.vue +0 -86
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items.vue +0 -168
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items_loading.vue +0 -43
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_popover/duo_chat_context_item_popover.vue +0 -170
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_selections/duo_chat_context_item_selections.vue +0 -196
- package/src/components/experimental/duo/chat/components/duo_chat_context/mock_context_data.js +0 -362
- package/src/components/experimental/duo/chat/components/duo_chat_context/utils.js +0 -169
- package/src/components/experimental/duo/chat/components/duo_chat_conversation/duo_chat_conversation.md +0 -27
- package/src/components/experimental/duo/chat/components/duo_chat_conversation/duo_chat_conversation.vue +0 -99
- package/src/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.md +0 -10
- package/src/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.scss +0 -44
- package/src/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.vue +0 -112
- package/src/components/experimental/duo/chat/components/duo_chat_message/buttons_utils.js +0 -39
- package/src/components/experimental/duo/chat/components/duo_chat_message/constants.js +0 -12
- package/src/components/experimental/duo/chat/components/duo_chat_message/copy_code_element.js +0 -24
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.md +0 -69
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.scss +0 -105
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.vue +0 -363
- package/src/components/experimental/duo/chat/components/duo_chat_message/insert_code_snippet_element.js +0 -51
- package/src/components/experimental/duo/chat/components/duo_chat_message/utils.js +0 -18
- package/src/components/experimental/duo/chat/components/duo_chat_message_sources/duo_chat_message_sources.md +0 -10
- package/src/components/experimental/duo/chat/components/duo_chat_message_sources/duo_chat_message_sources.vue +0 -91
- package/src/components/experimental/duo/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.md +0 -10
- package/src/components/experimental/duo/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.vue +0 -45
- package/src/components/experimental/duo/chat/constants.js +0 -37
- package/src/components/experimental/duo/chat/duo_chat.md +0 -202
- package/src/components/experimental/duo/chat/duo_chat.scss +0 -413
- package/src/components/experimental/duo/chat/duo_chat.vue +0 -751
- package/src/components/experimental/duo/chat/markdown_renderer.js +0 -29
- package/src/components/experimental/duo/chat/mock_data.js +0 -187
- package/src/components/experimental/duo/chat/variables.scss +0 -9
- package/src/components/experimental/duo/user_feedback/user_feedback.md +0 -90
- package/src/components/experimental/duo/user_feedback/user_feedback.vue +0 -95
- package/src/components/experimental/duo/user_feedback/user_feedback_modal.vue +0 -167
- package/src/components/experimental/duo/workflow/components/duo_workflow_panel/duo_workflow_panel.md +0 -42
- package/src/components/experimental/duo/workflow/components/duo_workflow_panel/duo_workflow_panel.vue +0 -96
- package/src/components/experimental/duo/workflow/components/duo_workflow_prompt/duo_workflow_prompt.md +0 -46
- package/src/components/experimental/duo/workflow/components/duo_workflow_prompt/duo_workflow_prompt.vue +0 -270
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
import debounce from 'lodash/debounce';
|
|
2
|
-
import { translate } from '../../../../../../../utils/i18n';
|
|
3
|
-
import GlCard from '../../../../../../base/card/card';
|
|
4
|
-
import GlDuoChatContextItemSelections from '../duo_chat_context_item_selections/duo_chat_context_item_selections';
|
|
5
|
-
import { contextItemsValidator, categoriesValidator, wrapIndex } from '../utils';
|
|
6
|
-
import GlDuoChatContextItemMenuCategoryItems from './duo_chat_context_item_menu_category_items';
|
|
7
|
-
import GlDuoChatContextItemMenuSearchItems from './duo_chat_context_item_menu_search_items';
|
|
8
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* This component has been migrated to the Duo-UI library (https://gitlab.com/gitlab-org/duo-ui).
|
|
12
|
-
*
|
|
13
|
-
* Please use the corresponding component in Duo-UI going forward.
|
|
14
|
-
* All future development and maintenance for Duo components should take place in Duo-UI.
|
|
15
|
-
*
|
|
16
|
-
* For more details, see the migration epic: https://gitlab.com/groups/gitlab-org/-/epics/15344 or reach out to the Duo-Chat team in #g_duo_chat.
|
|
17
|
-
*/
|
|
18
|
-
const SEARCH_DEBOUNCE_MS = 30;
|
|
19
|
-
var script = {
|
|
20
|
-
name: 'GlDuoChatContextItemMenu',
|
|
21
|
-
components: {
|
|
22
|
-
GlCard,
|
|
23
|
-
GlDuoChatContextItemMenuCategoryItems,
|
|
24
|
-
GlDuoChatContextItemMenuSearchItems,
|
|
25
|
-
GlDuoChatContextItemSelections
|
|
26
|
-
},
|
|
27
|
-
props: {
|
|
28
|
-
/**
|
|
29
|
-
* Whether the menu is open.
|
|
30
|
-
*/
|
|
31
|
-
open: {
|
|
32
|
-
type: Boolean,
|
|
33
|
-
required: true
|
|
34
|
-
},
|
|
35
|
-
/**
|
|
36
|
-
* Array of selected context items.
|
|
37
|
-
*/
|
|
38
|
-
selections: {
|
|
39
|
-
type: Array,
|
|
40
|
-
required: true,
|
|
41
|
-
validator: contextItemsValidator
|
|
42
|
-
},
|
|
43
|
-
/**
|
|
44
|
-
* Whether the menu is in a loading state.
|
|
45
|
-
*/
|
|
46
|
-
loading: {
|
|
47
|
-
type: Boolean,
|
|
48
|
-
required: true
|
|
49
|
-
},
|
|
50
|
-
/**
|
|
51
|
-
* Error message to display, if any.
|
|
52
|
-
*/
|
|
53
|
-
error: {
|
|
54
|
-
type: [String, null],
|
|
55
|
-
required: false,
|
|
56
|
-
default: null
|
|
57
|
-
},
|
|
58
|
-
/**
|
|
59
|
-
* Array of available categories for context items.
|
|
60
|
-
*/
|
|
61
|
-
categories: {
|
|
62
|
-
type: Array,
|
|
63
|
-
required: true,
|
|
64
|
-
validator: categoriesValidator
|
|
65
|
-
},
|
|
66
|
-
/**
|
|
67
|
-
* Array of search results for context items.
|
|
68
|
-
*/
|
|
69
|
-
results: {
|
|
70
|
-
type: Array,
|
|
71
|
-
required: true,
|
|
72
|
-
validator: contextItemsValidator
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
data() {
|
|
76
|
-
return {
|
|
77
|
-
selectedCategory: null,
|
|
78
|
-
searchQuery: '',
|
|
79
|
-
activeIndex: 0
|
|
80
|
-
};
|
|
81
|
-
},
|
|
82
|
-
computed: {
|
|
83
|
-
showCategorySelection() {
|
|
84
|
-
return this.open && !this.selectedCategory;
|
|
85
|
-
},
|
|
86
|
-
allResultsAreDisabled() {
|
|
87
|
-
return this.results.every(result => !result.metadata.enabled);
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
watch: {
|
|
91
|
-
open(isOpen) {
|
|
92
|
-
if (!isOpen) {
|
|
93
|
-
this.resetSelection();
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
searchQuery(query) {
|
|
97
|
-
this.debouncedSearch(query);
|
|
98
|
-
},
|
|
99
|
-
results(newResults) {
|
|
100
|
-
const firstEnabledIndex = newResults.findIndex(result => result.metadata.enabled);
|
|
101
|
-
this.activeIndex = firstEnabledIndex >= 0 ? firstEnabledIndex : 0;
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
methods: {
|
|
105
|
-
selectCategory(category) {
|
|
106
|
-
this.searchQuery = '';
|
|
107
|
-
this.selectedCategory = category;
|
|
108
|
-
this.$emit('search', {
|
|
109
|
-
category: category.value,
|
|
110
|
-
query: ''
|
|
111
|
-
});
|
|
112
|
-
},
|
|
113
|
-
debouncedSearch: debounce(function search(query) {
|
|
114
|
-
/**
|
|
115
|
-
* Emitted when a search should be performed.
|
|
116
|
-
* @property {Object} filter
|
|
117
|
-
* @property {string} filter.category - The value of the selected category
|
|
118
|
-
* @property {string} filter.query - The search query
|
|
119
|
-
*/
|
|
120
|
-
this.$emit('search', {
|
|
121
|
-
category: this.selectedCategory.value,
|
|
122
|
-
query
|
|
123
|
-
});
|
|
124
|
-
}, SEARCH_DEBOUNCE_MS),
|
|
125
|
-
selectItem(item) {
|
|
126
|
-
if (!item.metadata.enabled) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Emitted when a context item is selected.
|
|
132
|
-
* @property {Object} item - The selected context item
|
|
133
|
-
*/
|
|
134
|
-
this.$emit('select', this.results.find(result => result.id === item.id));
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Emitted when the menu should be closed.
|
|
138
|
-
*/
|
|
139
|
-
this.$emit('close');
|
|
140
|
-
this.resetSelection();
|
|
141
|
-
},
|
|
142
|
-
removeItem(item) {
|
|
143
|
-
/**
|
|
144
|
-
* Emitted when a context item should be removed.
|
|
145
|
-
* @property {Object} item - The context item to be removed
|
|
146
|
-
*/
|
|
147
|
-
this.$emit('remove', item);
|
|
148
|
-
},
|
|
149
|
-
resetSelection() {
|
|
150
|
-
this.selectedCategory = null;
|
|
151
|
-
this.searchQuery = '';
|
|
152
|
-
this.activeIndex = 0;
|
|
153
|
-
},
|
|
154
|
-
async scrollActiveItemIntoView() {
|
|
155
|
-
await this.$nextTick();
|
|
156
|
-
const activeItem = document.getElementById(`dropdown-item-${this.activeIndex}`);
|
|
157
|
-
if (activeItem) {
|
|
158
|
-
activeItem.scrollIntoView({
|
|
159
|
-
block: 'nearest',
|
|
160
|
-
inline: 'start'
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
handleKeyUp(e) {
|
|
165
|
-
switch (e.key) {
|
|
166
|
-
case 'ArrowDown':
|
|
167
|
-
case 'ArrowUp':
|
|
168
|
-
e.preventDefault();
|
|
169
|
-
this.moveActiveIndex(e.key === 'ArrowDown' ? 1 : -1);
|
|
170
|
-
this.scrollActiveItemIntoView();
|
|
171
|
-
break;
|
|
172
|
-
case 'Enter':
|
|
173
|
-
e.preventDefault();
|
|
174
|
-
if (this.showCategorySelection) {
|
|
175
|
-
this.selectCategory(this.categories[this.activeIndex]);
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
if (!this.results.length) {
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
this.selectItem(this.results[this.activeIndex]);
|
|
182
|
-
break;
|
|
183
|
-
case 'Escape':
|
|
184
|
-
e.preventDefault();
|
|
185
|
-
if (this.showCategorySelection) {
|
|
186
|
-
this.$emit('close');
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
this.selectedCategory = null;
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Emitted when the parent GlDuoChat component should refocus on the main prompt input
|
|
193
|
-
*/
|
|
194
|
-
this.$emit('focus-prompt');
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
moveActiveIndex(step) {
|
|
199
|
-
if (this.showCategorySelection) {
|
|
200
|
-
// Categories cannot be disabled, so just loop to the next/prev one
|
|
201
|
-
this.activeIndex = wrapIndex(this.activeIndex, step, this.categories.length);
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// Return early if there are no results or all results are disabled
|
|
206
|
-
if (!this.results.length || this.allResultsAreDisabled) {
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// contextItems CAN be disabled, so loop to next/prev but ensure we don't land on a disabled one
|
|
211
|
-
let newIndex = this.activeIndex;
|
|
212
|
-
do {
|
|
213
|
-
newIndex = wrapIndex(newIndex, step, this.results.length);
|
|
214
|
-
if (newIndex === this.activeIndex) {
|
|
215
|
-
// If we've looped through all items and found no enabled ones, keep the current index
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
} while (!this.results[newIndex].metadata.enabled);
|
|
219
|
-
this.activeIndex = newIndex;
|
|
220
|
-
},
|
|
221
|
-
onGetContextItemContent(contextItem) {
|
|
222
|
-
/**
|
|
223
|
-
* Emit get-context-item-content event that tells clients to load the full file content for a selected context item.
|
|
224
|
-
* The fully hydrated context item should be updated in the context item selections.
|
|
225
|
-
* @param {*} event An event containing the context item to hydrate
|
|
226
|
-
*/
|
|
227
|
-
this.$emit('get-context-item-content', {
|
|
228
|
-
contextItem
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
},
|
|
232
|
-
i18n: {
|
|
233
|
-
selectedContextItemsTitle: translate('GlDuoChatContextItemMenu.selectedContextItemsTitle', 'Included references')
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
/* script */
|
|
238
|
-
const __vue_script__ = script;
|
|
239
|
-
|
|
240
|
-
/* template */
|
|
241
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[(_vm.selections.length)?_c('gl-duo-chat-context-item-selections',{staticClass:"gl-mb-3",attrs:{"selections":_vm.selections,"categories":_vm.categories,"removable":true,"title":_vm.$options.i18n.selectedContextItemsTitle,"default-collapsed":false},on:{"remove":_vm.removeItem,"get-content":_vm.onGetContextItemContent}}):_vm._e(),_vm._v(" "),(_vm.open)?_c('gl-card',{staticClass:"slash-commands !gl-absolute gl-bottom-0 gl-w-full gl-pl-0 gl-shadow-md",attrs:{"body-class":"!gl-p-2","data-testid":"context-item-menu"}},[(_vm.showCategorySelection)?_c('gl-duo-chat-context-item-menu-category-items',{attrs:{"active-index":_vm.activeIndex,"categories":_vm.categories},on:{"select":_vm.selectCategory,"active-index-change":function($event){_vm.activeIndex = $event;}}}):_c('gl-duo-chat-context-item-menu-search-items',{attrs:{"active-index":_vm.activeIndex,"category":_vm.selectedCategory,"loading":_vm.loading,"error":_vm.error,"results":_vm.results},on:{"select":_vm.selectItem,"keyup":_vm.handleKeyUp,"active-index-change":function($event){_vm.activeIndex = $event;}},model:{value:(_vm.searchQuery),callback:function ($$v) {_vm.searchQuery=$$v;},expression:"searchQuery"}})],1):_vm._e()],1)};
|
|
242
|
-
var __vue_staticRenderFns__ = [];
|
|
243
|
-
|
|
244
|
-
/* style */
|
|
245
|
-
const __vue_inject_styles__ = undefined;
|
|
246
|
-
/* scoped */
|
|
247
|
-
const __vue_scope_id__ = undefined;
|
|
248
|
-
/* module identifier */
|
|
249
|
-
const __vue_module_identifier__ = undefined;
|
|
250
|
-
/* functional template */
|
|
251
|
-
const __vue_is_functional_template__ = false;
|
|
252
|
-
/* style inject */
|
|
253
|
-
|
|
254
|
-
/* style inject SSR */
|
|
255
|
-
|
|
256
|
-
/* style inject shadow dom */
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
const __vue_component__ = __vue_normalize__(
|
|
261
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
262
|
-
__vue_inject_styles__,
|
|
263
|
-
__vue_script__,
|
|
264
|
-
__vue_scope_id__,
|
|
265
|
-
__vue_is_functional_template__,
|
|
266
|
-
__vue_module_identifier__,
|
|
267
|
-
false,
|
|
268
|
-
undefined,
|
|
269
|
-
undefined,
|
|
270
|
-
undefined
|
|
271
|
-
);
|
|
272
|
-
|
|
273
|
-
export default __vue_component__;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import GlDropdownItem from '../../../../../../base/dropdown/dropdown_item';
|
|
2
|
-
import GlIcon from '../../../../../../base/icon/icon';
|
|
3
|
-
import { categoriesValidator } from '../utils';
|
|
4
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* This component has been migrated to the Duo-UI library (https://gitlab.com/gitlab-org/duo-ui).
|
|
8
|
-
*
|
|
9
|
-
* Please use the corresponding component in Duo-UI going forward.
|
|
10
|
-
* All future development and maintenance for Duo components should take place in Duo-UI.
|
|
11
|
-
*
|
|
12
|
-
* For more details, see the migration epic: https://gitlab.com/groups/gitlab-org/-/epics/15344 or reach out to the Duo-Chat team in #g_duo_chat.
|
|
13
|
-
*/
|
|
14
|
-
var script = {
|
|
15
|
-
name: 'GlDuoChatContextItemMenuCategoryItems',
|
|
16
|
-
components: {
|
|
17
|
-
GlIcon,
|
|
18
|
-
GlDropdownItem
|
|
19
|
-
},
|
|
20
|
-
props: {
|
|
21
|
-
categories: {
|
|
22
|
-
type: Array,
|
|
23
|
-
required: true,
|
|
24
|
-
validator: categoriesValidator
|
|
25
|
-
},
|
|
26
|
-
activeIndex: {
|
|
27
|
-
type: Number,
|
|
28
|
-
required: true
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
methods: {
|
|
32
|
-
selectCategory(category) {
|
|
33
|
-
this.$emit('select', category);
|
|
34
|
-
},
|
|
35
|
-
setActiveIndex(index) {
|
|
36
|
-
this.$emit('active-index-change', index);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
/* script */
|
|
42
|
-
const __vue_script__ = script;
|
|
43
|
-
|
|
44
|
-
/* template */
|
|
45
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('ul',{staticClass:"gl-mb-0 gl-list-none gl-pl-0"},_vm._l((_vm.categories),function(category,index){return _c('gl-dropdown-item',{key:category.value,class:{ 'active-command': index === _vm.activeIndex },attrs:{"data-testid":"category-item"},on:{"click":function($event){return _vm.selectCategory(category)}}},[_c('div',{staticClass:"gl-flex gl-items-center",on:{"mouseenter":function($event){return _vm.setActiveIndex(index)}}},[_c('gl-icon',{staticClass:"gl-mr-2",attrs:{"name":category.icon}}),_vm._v("\n "+_vm._s(category.label)+"\n ")],1)])}),1)};
|
|
46
|
-
var __vue_staticRenderFns__ = [];
|
|
47
|
-
|
|
48
|
-
/* style */
|
|
49
|
-
const __vue_inject_styles__ = undefined;
|
|
50
|
-
/* scoped */
|
|
51
|
-
const __vue_scope_id__ = undefined;
|
|
52
|
-
/* module identifier */
|
|
53
|
-
const __vue_module_identifier__ = undefined;
|
|
54
|
-
/* functional template */
|
|
55
|
-
const __vue_is_functional_template__ = false;
|
|
56
|
-
/* style inject */
|
|
57
|
-
|
|
58
|
-
/* style inject SSR */
|
|
59
|
-
|
|
60
|
-
/* style inject shadow dom */
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const __vue_component__ = __vue_normalize__(
|
|
65
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
66
|
-
__vue_inject_styles__,
|
|
67
|
-
__vue_script__,
|
|
68
|
-
__vue_scope_id__,
|
|
69
|
-
__vue_is_functional_template__,
|
|
70
|
-
__vue_module_identifier__,
|
|
71
|
-
false,
|
|
72
|
-
undefined,
|
|
73
|
-
undefined,
|
|
74
|
-
undefined
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
export default __vue_component__;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import GlDuoChatContextItemPopover from '../duo_chat_context_item_popover/duo_chat_context_item_popover';
|
|
2
|
-
import GlTruncate from '../../../../../../utilities/truncate/truncate';
|
|
3
|
-
import GlIcon from '../../../../../../base/icon/icon';
|
|
4
|
-
import { categoryValidator, contextItemValidator, getContextItemSecondaryText, getContextItemIcon, getContextItemSource } from '../utils';
|
|
5
|
-
import GlBadge from '../../../../../../base/badge/badge';
|
|
6
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* This component has been migrated to the Duo-UI library (https://gitlab.com/gitlab-org/duo-ui).
|
|
10
|
-
*
|
|
11
|
-
* Please use the corresponding component in Duo-UI going forward.
|
|
12
|
-
* All future development and maintenance for Duo components should take place in Duo-UI.
|
|
13
|
-
*
|
|
14
|
-
* For more details, see the migration epic: https://gitlab.com/groups/gitlab-org/-/epics/15344 or reach out to the Duo-Chat team in #g_duo_chat.
|
|
15
|
-
*/
|
|
16
|
-
var script = {
|
|
17
|
-
name: 'GlDuoChatContextItemMenuSearchItem',
|
|
18
|
-
components: {
|
|
19
|
-
GlBadge,
|
|
20
|
-
GlTruncate,
|
|
21
|
-
GlIcon,
|
|
22
|
-
GlDuoChatContextItemPopover
|
|
23
|
-
},
|
|
24
|
-
props: {
|
|
25
|
-
category: {
|
|
26
|
-
type: Object,
|
|
27
|
-
required: true,
|
|
28
|
-
validator: categoryValidator
|
|
29
|
-
},
|
|
30
|
-
contextItem: {
|
|
31
|
-
type: Object,
|
|
32
|
-
required: true,
|
|
33
|
-
validator: contextItemValidator
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
computed: {
|
|
37
|
-
title() {
|
|
38
|
-
var _this$contextItem$met;
|
|
39
|
-
return ((_this$contextItem$met = this.contextItem.metadata) === null || _this$contextItem$met === void 0 ? void 0 : _this$contextItem$met.title) || '';
|
|
40
|
-
},
|
|
41
|
-
secondaryText() {
|
|
42
|
-
return getContextItemSecondaryText(this.contextItem);
|
|
43
|
-
},
|
|
44
|
-
icon() {
|
|
45
|
-
return getContextItemIcon(this.contextItem, this.category);
|
|
46
|
-
},
|
|
47
|
-
itemSource() {
|
|
48
|
-
return getContextItemSource(this.contextItem);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
/* script */
|
|
54
|
-
const __vue_script__ = script;
|
|
55
|
-
|
|
56
|
-
/* template */
|
|
57
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-flex gl-flex-col"},[_c('div',{staticClass:"gl-flex gl-items-center"},[_c('gl-icon',{staticClass:"gl-mr-2 gl-shrink-0",attrs:{"name":_vm.icon,"data-testid":"category-icon"}}),_vm._v(" "),_c('gl-truncate',{staticClass:"gl-min-w-0",attrs:{"text":_vm.title,"data-testid":"item-title"}}),_vm._v(" "),_c('gl-icon',{staticClass:"gl-ml-2 gl-shrink-0 gl-cursor-pointer gl-text-secondary",attrs:{"id":("info-icon-" + (_vm.contextItem.id)),"name":"information-o","size":12}}),_vm._v(" "),_c('gl-duo-chat-context-item-popover',{attrs:{"context-item":_vm.contextItem,"target":("info-icon-" + (_vm.contextItem.id)),"placement":"left"}})],1),_vm._v(" "),(_vm.secondaryText)?_c('div',{staticClass:"gl-align-items-center gl-mt-1 gl-flex gl-shrink-0 gl-whitespace-nowrap gl-text-secondary",attrs:{"data-testid":"item-secondary-text"}},[(_vm.itemSource)?_c('gl-badge',{staticClass:"gl-mr-1",attrs:{"variant":"neutral","data-testid":"context-item-source"}},[_vm._v(_vm._s(_vm.itemSource))]):_vm._e(),_vm._v(" "),_c('gl-truncate',{staticClass:"gl-min-w-0",attrs:{"position":"middle","text":_vm.secondaryText}})],1):_vm._e()])};
|
|
58
|
-
var __vue_staticRenderFns__ = [];
|
|
59
|
-
|
|
60
|
-
/* style */
|
|
61
|
-
const __vue_inject_styles__ = undefined;
|
|
62
|
-
/* scoped */
|
|
63
|
-
const __vue_scope_id__ = undefined;
|
|
64
|
-
/* module identifier */
|
|
65
|
-
const __vue_module_identifier__ = undefined;
|
|
66
|
-
/* functional template */
|
|
67
|
-
const __vue_is_functional_template__ = false;
|
|
68
|
-
/* style inject */
|
|
69
|
-
|
|
70
|
-
/* style inject SSR */
|
|
71
|
-
|
|
72
|
-
/* style inject shadow dom */
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const __vue_component__ = __vue_normalize__(
|
|
77
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
78
|
-
__vue_inject_styles__,
|
|
79
|
-
__vue_script__,
|
|
80
|
-
__vue_scope_id__,
|
|
81
|
-
__vue_is_functional_template__,
|
|
82
|
-
__vue_module_identifier__,
|
|
83
|
-
false,
|
|
84
|
-
undefined,
|
|
85
|
-
undefined,
|
|
86
|
-
undefined
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
export default __vue_component__;
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import GlDropdownItem from '../../../../../../base/dropdown/dropdown_item';
|
|
2
|
-
import GlFormInput from '../../../../../../base/form/form_input/form_input';
|
|
3
|
-
import GlAlert from '../../../../../../base/alert/alert';
|
|
4
|
-
import { sprintf, translate } from '../../../../../../../utils/i18n';
|
|
5
|
-
import { categoryValidator, contextItemsValidator } from '../utils';
|
|
6
|
-
import GlDuoChatContextItemMenuSearchItemsLoading from './duo_chat_context_item_menu_search_items_loading';
|
|
7
|
-
import GlDuoChatContextItemMenuSearchItem from './duo_chat_context_item_menu_search_item';
|
|
8
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* This component has been migrated to the Duo-UI library (https://gitlab.com/gitlab-org/duo-ui).
|
|
12
|
-
*
|
|
13
|
-
* Please use the corresponding component in Duo-UI going forward.
|
|
14
|
-
* All future development and maintenance for Duo components should take place in Duo-UI.
|
|
15
|
-
*
|
|
16
|
-
* For more details, see the migration epic: https://gitlab.com/groups/gitlab-org/-/epics/15344 or reach out to the Duo-Chat team in #g_duo_chat.
|
|
17
|
-
*/
|
|
18
|
-
var script = {
|
|
19
|
-
name: 'GlDuoChatContextItemMenuSearchItems',
|
|
20
|
-
components: {
|
|
21
|
-
GlAlert,
|
|
22
|
-
GlDropdownItem,
|
|
23
|
-
GlDuoChatContextItemMenuSearchItem,
|
|
24
|
-
GlDuoChatContextItemMenuSearchItemsLoading,
|
|
25
|
-
GlFormInput
|
|
26
|
-
},
|
|
27
|
-
model: {
|
|
28
|
-
prop: 'searchQuery',
|
|
29
|
-
event: 'update:searchQuery'
|
|
30
|
-
},
|
|
31
|
-
props: {
|
|
32
|
-
activeIndex: {
|
|
33
|
-
type: Number,
|
|
34
|
-
required: true
|
|
35
|
-
},
|
|
36
|
-
searchQuery: {
|
|
37
|
-
type: String,
|
|
38
|
-
required: true
|
|
39
|
-
},
|
|
40
|
-
category: {
|
|
41
|
-
type: Object,
|
|
42
|
-
required: true,
|
|
43
|
-
validator: categoryValidator
|
|
44
|
-
},
|
|
45
|
-
loading: {
|
|
46
|
-
type: Boolean,
|
|
47
|
-
required: true
|
|
48
|
-
},
|
|
49
|
-
error: {
|
|
50
|
-
type: [String, null],
|
|
51
|
-
required: false,
|
|
52
|
-
default: null
|
|
53
|
-
},
|
|
54
|
-
results: {
|
|
55
|
-
type: Array,
|
|
56
|
-
required: true,
|
|
57
|
-
validator: contextItemsValidator
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
data() {
|
|
61
|
-
return {
|
|
62
|
-
userInitiatedSearch: false,
|
|
63
|
-
numLoadingItems: 3
|
|
64
|
-
};
|
|
65
|
-
},
|
|
66
|
-
computed: {
|
|
67
|
-
showEmptyState() {
|
|
68
|
-
return Boolean(this.userInitiatedSearch && !this.loading && !this.error && !this.results.length);
|
|
69
|
-
},
|
|
70
|
-
searchInputPlaceholder() {
|
|
71
|
-
return sprintf(translate('GlDuoChatContextItemMenu.searchInputPlaceholder', 'Search %{categoryLabel}...'), {
|
|
72
|
-
categoryLabel: this.category.label.toLowerCase()
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
watch: {
|
|
77
|
-
searchQuery() {
|
|
78
|
-
this.userInitiatedSearch = true;
|
|
79
|
-
},
|
|
80
|
-
results(results) {
|
|
81
|
-
this.numLoadingItems = Math.max(1, results.length);
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
methods: {
|
|
85
|
-
selectItem(contextItem) {
|
|
86
|
-
this.$emit('select', contextItem);
|
|
87
|
-
this.userInitiatedSearch = false;
|
|
88
|
-
},
|
|
89
|
-
handleKeyUp(e) {
|
|
90
|
-
this.$emit('keyup', e);
|
|
91
|
-
},
|
|
92
|
-
setActiveIndex(index) {
|
|
93
|
-
var _this$results$index;
|
|
94
|
-
if ((_this$results$index = this.results[index]) !== null && _this$results$index !== void 0 && _this$results$index.metadata.enabled) {
|
|
95
|
-
this.$emit('active-index-change', index);
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
isActiveItem(contextItem, index) {
|
|
99
|
-
return index === this.activeIndex && contextItem.metadata.enabled;
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
i18n: {
|
|
103
|
-
emptyStateMessage: translate('GlDuoChatContextItemMenu.emptyStateMessage', 'No results found')
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
/* script */
|
|
108
|
-
const __vue_script__ = script;
|
|
109
|
-
|
|
110
|
-
/* template */
|
|
111
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('div',{staticClass:"gl-max-h-31 gl-overflow-y-scroll"},[(_vm.loading)?_c('gl-duo-chat-context-item-menu-search-items-loading',{attrs:{"rows":_vm.numLoadingItems}}):(_vm.error)?_c('gl-alert',{staticClass:"gl-m-3",attrs:{"variant":"danger","dismissible":false,"data-testid":"search-results-error"}},[_vm._v("\n "+_vm._s(_vm.error)+"\n ")]):(_vm.showEmptyState)?_c('div',{staticClass:"gl-rounded-base gl-p-3 gl-text-center gl-text-secondary",attrs:{"data-testid":"search-results-empty-state"}},[_vm._v("\n "+_vm._s(_vm.$options.i18n.emptyStateMessage)+"\n ")]):_c('ul',{staticClass:"gl-mb-1 gl-list-none gl-flex-row gl-pl-0"},_vm._l((_vm.results),function(contextItem,index){return _c('gl-dropdown-item',{key:contextItem.id,staticClass:"duo-chat-context-search-result-item",class:{
|
|
112
|
-
'active-command': _vm.isActiveItem(contextItem, index),
|
|
113
|
-
'gl-cursor-not-allowed [&>button]:focus-within:!gl-shadow-none':
|
|
114
|
-
!contextItem.metadata.enabled,
|
|
115
|
-
},attrs:{"id":("dropdown-item-" + index),"tabindex":!contextItem.metadata.enabled ? -1 : undefined,"data-testid":"search-result-item"},on:{"click":function($event){return _vm.selectItem(contextItem)}}},[_c('div',{on:{"mouseenter":function($event){return _vm.setActiveIndex(index)}}},[_c('gl-duo-chat-context-item-menu-search-item',{class:{ 'gl-text-secondary': !contextItem.metadata.enabled },attrs:{"context-item":contextItem,"category":_vm.category,"data-testid":"search-result-item-details"}})],1)])}),1)],1),_vm._v(" "),_c('gl-form-input',{ref:"contextMenuSearchInput",attrs:{"value":_vm.searchQuery,"placeholder":_vm.searchInputPlaceholder,"autofocus":"","data-testid":"context-menu-search-input"},on:{"input":function($event){return _vm.$emit('update:searchQuery', $event)},"keyup":_vm.handleKeyUp}})],1)};
|
|
116
|
-
var __vue_staticRenderFns__ = [];
|
|
117
|
-
|
|
118
|
-
/* style */
|
|
119
|
-
const __vue_inject_styles__ = undefined;
|
|
120
|
-
/* scoped */
|
|
121
|
-
const __vue_scope_id__ = undefined;
|
|
122
|
-
/* module identifier */
|
|
123
|
-
const __vue_module_identifier__ = undefined;
|
|
124
|
-
/* functional template */
|
|
125
|
-
const __vue_is_functional_template__ = false;
|
|
126
|
-
/* style inject */
|
|
127
|
-
|
|
128
|
-
/* style inject SSR */
|
|
129
|
-
|
|
130
|
-
/* style inject shadow dom */
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const __vue_component__ = __vue_normalize__(
|
|
135
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
136
|
-
__vue_inject_styles__,
|
|
137
|
-
__vue_script__,
|
|
138
|
-
__vue_scope_id__,
|
|
139
|
-
__vue_is_functional_template__,
|
|
140
|
-
__vue_module_identifier__,
|
|
141
|
-
false,
|
|
142
|
-
undefined,
|
|
143
|
-
undefined,
|
|
144
|
-
undefined
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
export default __vue_component__;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { translate } from '../../../../../../../utils/i18n';
|
|
2
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* This component has been migrated to the Duo-UI library (https://gitlab.com/gitlab-org/duo-ui).
|
|
6
|
-
*
|
|
7
|
-
* Please use the corresponding component in Duo-UI going forward.
|
|
8
|
-
* All future development and maintenance for Duo components should take place in Duo-UI.
|
|
9
|
-
*
|
|
10
|
-
* For more details, see the migration epic: https://gitlab.com/groups/gitlab-org/-/epics/15344 or reach out to the Duo-Chat team in #g_duo_chat.
|
|
11
|
-
*/
|
|
12
|
-
var script = {
|
|
13
|
-
name: 'GlDuoChatContextItemMenuSearchItemsLoading',
|
|
14
|
-
props: {
|
|
15
|
-
rows: {
|
|
16
|
-
type: Number,
|
|
17
|
-
required: true
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
i18n: {
|
|
21
|
-
loadingMessage: translate('GlDuoChatContextItemMenu.loadingMessage', 'Loading...')
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/* script */
|
|
26
|
-
const __vue_script__ = script;
|
|
27
|
-
|
|
28
|
-
/* template */
|
|
29
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_vm._l((_vm.rows),function(index){return _c('div',{key:index,staticClass:"gl-mx-3 gl-mb-4 gl-pt-3",attrs:{"data-testid":"search-results-loading"}},[_vm._m(0,true),_vm._v(" "),_c('div',{staticClass:"gl-animate-skeleton-loader gl-h-4 gl-w-1/2 gl-rounded-base"})])}),_vm._v(" "),_c('span',{staticClass:"gl-sr-only"},[_vm._v(_vm._s(_vm.$options.i18n.loadingMessage))])],2)};
|
|
30
|
-
var __vue_staticRenderFns__ = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-mb-2 gl-flex"},[_c('div',{staticClass:"gl-animate-skeleton-loader gl-mr-3 gl-h-5 gl-w-5 gl-rounded-base"}),_vm._v(" "),_c('div',{staticClass:"gl-animate-skeleton-loader gl-h-5 gl-grow gl-rounded-base"})])}];
|
|
31
|
-
|
|
32
|
-
/* style */
|
|
33
|
-
const __vue_inject_styles__ = undefined;
|
|
34
|
-
/* scoped */
|
|
35
|
-
const __vue_scope_id__ = undefined;
|
|
36
|
-
/* module identifier */
|
|
37
|
-
const __vue_module_identifier__ = undefined;
|
|
38
|
-
/* functional template */
|
|
39
|
-
const __vue_is_functional_template__ = false;
|
|
40
|
-
/* style inject */
|
|
41
|
-
|
|
42
|
-
/* style inject SSR */
|
|
43
|
-
|
|
44
|
-
/* style inject shadow dom */
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const __vue_component__ = __vue_normalize__(
|
|
49
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
50
|
-
__vue_inject_styles__,
|
|
51
|
-
__vue_script__,
|
|
52
|
-
__vue_scope_id__,
|
|
53
|
-
__vue_is_functional_template__,
|
|
54
|
-
__vue_module_identifier__,
|
|
55
|
-
false,
|
|
56
|
-
undefined,
|
|
57
|
-
undefined,
|
|
58
|
-
undefined
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
export default __vue_component__;
|