@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,170 +0,0 @@
|
|
|
1
|
-
import { setStoryTimeout } from '../../../../utils/test_utils';
|
|
2
|
-
import { DOCUMENTATION_SOURCE_TYPES, MESSAGE_MODEL_ROLES, CHAT_RESET_MESSAGE, CHAT_CLEAR_MESSAGE, CHAT_INCLUDE_MESSAGE } from './constants';
|
|
3
|
-
import { getMockContextItems } from './components/duo_chat_context/mock_context_data';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* This component has been migrated to the Duo-UI library (https://gitlab.com/gitlab-org/duo-ui).
|
|
7
|
-
*
|
|
8
|
-
* Please use the corresponding component in Duo-UI going forward.
|
|
9
|
-
* All future development and maintenance for Duo components should take place in Duo-UI.
|
|
10
|
-
*
|
|
11
|
-
* 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.
|
|
12
|
-
*/
|
|
13
|
-
const MOCK_SOURCES = [{
|
|
14
|
-
title: 'GitLab Handbook',
|
|
15
|
-
source_type: DOCUMENTATION_SOURCE_TYPES.HANDBOOK.value,
|
|
16
|
-
source_url: '/handbook/'
|
|
17
|
-
}, {
|
|
18
|
-
stage: 'Mock Stage',
|
|
19
|
-
group: 'Mock Group',
|
|
20
|
-
source_type: DOCUMENTATION_SOURCE_TYPES.DOC.value,
|
|
21
|
-
source_url: '/company/team/'
|
|
22
|
-
}, {
|
|
23
|
-
date: '2023-04-21',
|
|
24
|
-
author: 'Test User',
|
|
25
|
-
source_type: DOCUMENTATION_SOURCE_TYPES.BLOG.value,
|
|
26
|
-
source_url: '/blog/'
|
|
27
|
-
}];
|
|
28
|
-
const MOCK_RESPONSE_MESSAGE = {
|
|
29
|
-
id: '123',
|
|
30
|
-
content: 'Here is a simple JavaScript function to sum two numbers:\n\n ```js\n function sum(a, b) {\n return a + b;\n }\n ```\n \n To use it:\n \n ```js\n const result = sum(5, 3); // result = 8\n ```\n \n This function takes two number parameters, a and b. It returns the sum of adding them together.\n',
|
|
31
|
-
contentHtml: '<p data-sourcepos="1:1-1:56" dir="auto">Here is a simple JavaScript function to sum two numbers:</p>\n<div class="gl-relative markdown-code-block js-markdown-code">\n<pre data-sourcepos="3:1-7:3" data-canonical-lang="js" class="code highlight js-syntax-highlight language-javascript" lang="javascript" v-pre="true"><code><span id="LC1" class="line" lang="javascript"><span class="kd">function</span> <span class="nf">sum</span><span class="p">(</span><span class="nx">a</span><span class="p">,</span> <span class="nx">b</span><span class="p">)</span> <span class="p">{</span></span>\n<span id="LC2" class="line" lang="javascript"> <span class="k">return</span> <span class="nx">a</span> <span class="o">+</span> <span class="nx">b</span><span class="p">;</span></span>\n<span id="LC3" class="line" lang="javascript"><span class="p">}</span></span></code></pre>\n<copy-code></copy-code>\n<insert-code-snippet></insert-code-snippet>\n</div>\n<p data-sourcepos="9:1-9:10" dir="auto">To use it:</p>\n<div class="gl-relative markdown-code-block js-markdown-code">\n<pre data-sourcepos="11:1-13:3" data-canonical-lang="js" class="code highlight js-syntax-highlight language-javascript" lang="javascript" v-pre="true"><code><span id="LC1" class="line" lang="javascript"><span class="kd">const</span> <span class="nx">result</span> <span class="o">=</span> <span class="nf">sum</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">3</span><span class="p">);</span> <span class="c1">// result = 8</span></span></code></pre>\n<copy-code></copy-code>\n</div>\n<p data-sourcepos="15:1-15:95" dir="auto">This function takes two number parameters, a and b. It returns the sum of adding them together.</p>',
|
|
32
|
-
role: MESSAGE_MODEL_ROLES.assistant,
|
|
33
|
-
extras: {
|
|
34
|
-
sources: MOCK_SOURCES,
|
|
35
|
-
contextItems: getMockContextItems().slice(0, 2)
|
|
36
|
-
},
|
|
37
|
-
requestId: '987',
|
|
38
|
-
errors: [],
|
|
39
|
-
timestamp: '2021-04-21T12:00:00.000Z'
|
|
40
|
-
};
|
|
41
|
-
const generateSeparateChunks = n => {
|
|
42
|
-
const res = [];
|
|
43
|
-
for (let i = 1; i <= n; i += 1) {
|
|
44
|
-
res.push({
|
|
45
|
-
chunkId: i,
|
|
46
|
-
content: `chunk #${i}`,
|
|
47
|
-
role: MESSAGE_MODEL_ROLES.assistant,
|
|
48
|
-
requestId: '987',
|
|
49
|
-
errors: [],
|
|
50
|
-
timestamp: '2021-04-21T12:00:00.000Z'
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
return res;
|
|
54
|
-
};
|
|
55
|
-
const MOCK_RESPONSE_MESSAGE_FOR_STREAMING = {
|
|
56
|
-
id: '123',
|
|
57
|
-
content: `To change your password in GitLab:
|
|
58
|
-
|
|
59
|
-
1. Log in to your GitLab account.
|
|
60
|
-
2. Select your avatar in the top right corner and choose Edit profile.
|
|
61
|
-
3. On the left sidebar, select Password.
|
|
62
|
-
4. Enter your current password in the Current password field.
|
|
63
|
-
5. Enter your new password in the New password and Password confirmation fields.
|
|
64
|
-
6. Select Save password.
|
|
65
|
-
7. If you don't know your current password, select the I forgot my password link to reset it.
|
|
66
|
-
|
|
67
|
-
GitLab enforces password requirements when you choose a new password.
|
|
68
|
-
|
|
69
|
-
~~~yaml
|
|
70
|
-
# And here is a
|
|
71
|
-
# code block
|
|
72
|
-
everyone:
|
|
73
|
-
likes:
|
|
74
|
-
yaml: true
|
|
75
|
-
~~~
|
|
76
|
-
which is rendered while streaming.
|
|
77
|
-
`,
|
|
78
|
-
role: 'assistant',
|
|
79
|
-
extras: {
|
|
80
|
-
contextItems: getMockContextItems().slice(0, 2)
|
|
81
|
-
},
|
|
82
|
-
requestId: '987',
|
|
83
|
-
errors: [],
|
|
84
|
-
timestamp: '2021-04-21T12:00:00.000Z'
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
// Utility function for delay
|
|
88
|
-
async function delayRandom() {
|
|
89
|
-
let min = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 16;
|
|
90
|
-
let max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 267;
|
|
91
|
-
const delay = Math.floor(Math.random() * (max - min + 1)) + min;
|
|
92
|
-
// eslint-disable-next-line no-promise-executor-return
|
|
93
|
-
return new Promise(resolve => setStoryTimeout(resolve, delay));
|
|
94
|
-
}
|
|
95
|
-
function generateMockResponseChunks() {
|
|
96
|
-
try {
|
|
97
|
-
let requestId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
98
|
-
return async function* () {
|
|
99
|
-
const chunkSize = 5;
|
|
100
|
-
const contentLength = MOCK_RESPONSE_MESSAGE_FOR_STREAMING.content.length;
|
|
101
|
-
const chunkCount = Math.ceil(contentLength / chunkSize);
|
|
102
|
-
for (let chunkId = 0; chunkId < chunkCount; chunkId += 1) {
|
|
103
|
-
const start = chunkId * chunkSize;
|
|
104
|
-
const end = Math.min((chunkId + 1) * chunkSize, contentLength);
|
|
105
|
-
const chunk = {
|
|
106
|
-
...MOCK_RESPONSE_MESSAGE_FOR_STREAMING,
|
|
107
|
-
requestId,
|
|
108
|
-
content: MOCK_RESPONSE_MESSAGE_FOR_STREAMING.content.substring(start, end),
|
|
109
|
-
chunkId: chunkId + 1
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
// eslint-disable-next-line no-await-in-loop
|
|
113
|
-
await delayRandom();
|
|
114
|
-
yield chunk;
|
|
115
|
-
}
|
|
116
|
-
yield {
|
|
117
|
-
...MOCK_RESPONSE_MESSAGE_FOR_STREAMING,
|
|
118
|
-
requestId,
|
|
119
|
-
content: MOCK_RESPONSE_MESSAGE_FOR_STREAMING.content,
|
|
120
|
-
chunkId: null
|
|
121
|
-
};
|
|
122
|
-
}();
|
|
123
|
-
} catch (e) {
|
|
124
|
-
return Promise.reject(e);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
const MOCK_USER_PROMPT_MESSAGE = {
|
|
128
|
-
id: '456',
|
|
129
|
-
chunkId: null,
|
|
130
|
-
content: 'How to create a new template?',
|
|
131
|
-
contentHtml: '<p>How to create a new template?</p>',
|
|
132
|
-
role: MESSAGE_MODEL_ROLES.user,
|
|
133
|
-
requestId: '987',
|
|
134
|
-
errors: [],
|
|
135
|
-
timestamp: '2021-04-21T12:00:00.000Z',
|
|
136
|
-
extras: {
|
|
137
|
-
contextItems: getMockContextItems().slice(0, 2)
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
const renderMarkdown = content => content;
|
|
141
|
-
const renderGFM = el => {
|
|
142
|
-
const codeBlock = el.querySelectorAll('.markdown-code-block');
|
|
143
|
-
codeBlock.forEach(block => {
|
|
144
|
-
block === null || block === void 0 ? void 0 : block.classList.add('duo-chat-markdown', 'duo-chat-compact-markdown');
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
const SLASH_COMMANDS = [{
|
|
148
|
-
name: CHAT_RESET_MESSAGE,
|
|
149
|
-
shouldSubmit: true,
|
|
150
|
-
description: 'Reset conversation, ignore the previous messages.'
|
|
151
|
-
}, {
|
|
152
|
-
name: CHAT_CLEAR_MESSAGE,
|
|
153
|
-
shouldSubmit: true,
|
|
154
|
-
description: 'Delete all messages in this conversation.'
|
|
155
|
-
}, {
|
|
156
|
-
name: '/tests',
|
|
157
|
-
description: 'Write tests for the selected snippet.'
|
|
158
|
-
}, {
|
|
159
|
-
name: '/refactor',
|
|
160
|
-
description: 'Refactor the selected snippet.'
|
|
161
|
-
}, {
|
|
162
|
-
name: '/explain',
|
|
163
|
-
description: 'Explain the selected snippet.'
|
|
164
|
-
}];
|
|
165
|
-
const INCLUDE_SLASH_COMMAND = {
|
|
166
|
-
name: CHAT_INCLUDE_MESSAGE,
|
|
167
|
-
description: 'Include additional context in the conversation.'
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
export { INCLUDE_SLASH_COMMAND, MOCK_RESPONSE_MESSAGE, MOCK_RESPONSE_MESSAGE_FOR_STREAMING, MOCK_USER_PROMPT_MESSAGE, SLASH_COMMANDS, generateMockResponseChunks, generateSeparateChunks, renderGFM, renderMarkdown };
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import GlAlert from '../../../base/alert/alert';
|
|
2
|
-
import GlButton from '../../../base/button/button';
|
|
3
|
-
import FeedbackModal from './user_feedback_modal';
|
|
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
|
-
const i18n = {
|
|
15
|
-
FEEDBACK_LINK_TEXT: 'Give feedback to improve this answer.',
|
|
16
|
-
FEEDBACK_THANKS: 'Thank you for your feedback.'
|
|
17
|
-
};
|
|
18
|
-
var script = {
|
|
19
|
-
name: 'GlDuoUserFeedback',
|
|
20
|
-
components: {
|
|
21
|
-
GlAlert,
|
|
22
|
-
GlButton,
|
|
23
|
-
FeedbackModal
|
|
24
|
-
},
|
|
25
|
-
props: {
|
|
26
|
-
/**
|
|
27
|
-
* Whether the message already has gotten feedback
|
|
28
|
-
*/
|
|
29
|
-
feedbackReceived: {
|
|
30
|
-
type: Boolean,
|
|
31
|
-
required: false,
|
|
32
|
-
default: false
|
|
33
|
-
},
|
|
34
|
-
/**
|
|
35
|
-
* The text to be displayed as the feedback link/button.
|
|
36
|
-
*/
|
|
37
|
-
feedbackLinkText: {
|
|
38
|
-
type: String,
|
|
39
|
-
required: false,
|
|
40
|
-
default: i18n.FEEDBACK_LINK_TEXT
|
|
41
|
-
},
|
|
42
|
-
/**
|
|
43
|
-
* The URL of a page to provide more explanations on the experiment. If provided, clicking
|
|
44
|
-
* the feedback link will open a new tab with the URL instead of showing the feedback modal.
|
|
45
|
-
*/
|
|
46
|
-
feedbackLinkUrl: {
|
|
47
|
-
type: String,
|
|
48
|
-
required: false,
|
|
49
|
-
default: ''
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
computed: {
|
|
53
|
-
shouldRenderModal() {
|
|
54
|
-
return !this.feedbackReceived && !this.feedbackLinkUrl;
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
methods: {
|
|
58
|
-
notify(event) {
|
|
59
|
-
/**
|
|
60
|
-
* Notify listeners about the feedback form submission.
|
|
61
|
-
* @param {*} event An event, containing the feedback choices and the extended feedback text.
|
|
62
|
-
*/
|
|
63
|
-
this.$emit('feedback', event);
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
i18n
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
/* script */
|
|
70
|
-
const __vue_script__ = script;
|
|
71
|
-
|
|
72
|
-
/* template */
|
|
73
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-w-full gl-pt-4"},[_c('div',[(!_vm.feedbackReceived)?_c('gl-button',{attrs:{"variant":"link","target":"_blank","href":_vm.feedbackLinkUrl,"button-text-classes":"!gl-whitespace-normal gl-text-left"},on:{"click":function($event){_vm.shouldRenderModal && _vm.$refs.feedbackModal.show();}}},[_vm._v(_vm._s(_vm.feedbackLinkText))]):_c('gl-alert',{attrs:{"variant":"success","dismissible":false}},[_vm._v("\n "+_vm._s(_vm.$options.i18n.FEEDBACK_THANKS)+"\n ")])],1),_vm._v(" "),(_vm.shouldRenderModal)?_c('feedback-modal',{ref:"feedbackModal",on:{"feedback-submitted":_vm.notify},scopedSlots:_vm._u([{key:"feedback-extra-fields",fn:function(){return [_vm._t("feedback-extra-fields")]},proxy:true}],null,true)}):_vm._e()],1)};
|
|
74
|
-
var __vue_staticRenderFns__ = [];
|
|
75
|
-
|
|
76
|
-
/* style */
|
|
77
|
-
const __vue_inject_styles__ = undefined;
|
|
78
|
-
/* scoped */
|
|
79
|
-
const __vue_scope_id__ = undefined;
|
|
80
|
-
/* module identifier */
|
|
81
|
-
const __vue_module_identifier__ = undefined;
|
|
82
|
-
/* functional template */
|
|
83
|
-
const __vue_is_functional_template__ = false;
|
|
84
|
-
/* style inject */
|
|
85
|
-
|
|
86
|
-
/* style inject SSR */
|
|
87
|
-
|
|
88
|
-
/* style inject shadow dom */
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const __vue_component__ = __vue_normalize__(
|
|
93
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
94
|
-
__vue_inject_styles__,
|
|
95
|
-
__vue_script__,
|
|
96
|
-
__vue_scope_id__,
|
|
97
|
-
__vue_is_functional_template__,
|
|
98
|
-
__vue_module_identifier__,
|
|
99
|
-
false,
|
|
100
|
-
undefined,
|
|
101
|
-
undefined,
|
|
102
|
-
undefined
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
export default __vue_component__;
|
|
106
|
-
export { i18n };
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import GlModal from '../../../base/modal/modal';
|
|
2
|
-
import GlAlert from '../../../base/alert/alert';
|
|
3
|
-
import GlFormGroup from '../../../base/form/form_group/form_group';
|
|
4
|
-
import GlFormTextarea from '../../../base/form/form_textarea/form_textarea';
|
|
5
|
-
import GlFormCheckboxGroup from '../../../base/form/form_checkbox/form_checkbox_group';
|
|
6
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
7
|
-
|
|
8
|
-
//
|
|
9
|
-
const i18n = {
|
|
10
|
-
MODAL: {
|
|
11
|
-
TITLE: 'Give feedback on GitLab Duo',
|
|
12
|
-
DESCRIPTION: 'To help improve GitLab Duo, send your feeback to GitLab team members.',
|
|
13
|
-
ALERT: 'GitLab team members cannot see the AI content. Please be as descriptive as possible.',
|
|
14
|
-
OPTIONS_LABEL: 'How could the AI content be improved?',
|
|
15
|
-
SITUATION_DESCRIPTION_LABEL: 'What were you doing?',
|
|
16
|
-
SITUATION_DESCRIPTION_PLACEHOLDER: 'The situation in which you interacted with GitLab Duo Chat.',
|
|
17
|
-
IMPROVEMENT_SUGGESTION_LABEL: 'How could the response be improved?',
|
|
18
|
-
IMPROVEMENT_SUGGESTION_PLACEHOLDER: 'How the response might better meet your needs.',
|
|
19
|
-
MORE_LABEL: 'More information',
|
|
20
|
-
MORE_PLACEHOLDER: 'How could the content be improved?',
|
|
21
|
-
REQUIRED_VALIDATION_ERROR: 'Select at least one option.',
|
|
22
|
-
FEEDBACK_OPTIONS: {
|
|
23
|
-
helpful: 'Helpful',
|
|
24
|
-
unhelpful: 'Unhelpful or irrelevant',
|
|
25
|
-
incorrect: 'Factually incorrect',
|
|
26
|
-
long: 'Too long',
|
|
27
|
-
abuse: 'Abusive or offensive',
|
|
28
|
-
other: 'Something else'
|
|
29
|
-
},
|
|
30
|
-
ACTIONS: {
|
|
31
|
-
submit: 'Submit',
|
|
32
|
-
cancel: 'Cancel'
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const feedbackOptions = [{
|
|
37
|
-
text: i18n.MODAL.FEEDBACK_OPTIONS.helpful,
|
|
38
|
-
value: 'helpful'
|
|
39
|
-
}, {
|
|
40
|
-
text: i18n.MODAL.FEEDBACK_OPTIONS.unhelpful,
|
|
41
|
-
value: 'unhelpful'
|
|
42
|
-
}, {
|
|
43
|
-
text: i18n.MODAL.FEEDBACK_OPTIONS.incorrect,
|
|
44
|
-
value: 'incorrect'
|
|
45
|
-
}, {
|
|
46
|
-
text: i18n.MODAL.FEEDBACK_OPTIONS.long,
|
|
47
|
-
value: 'long'
|
|
48
|
-
}, {
|
|
49
|
-
text: i18n.MODAL.FEEDBACK_OPTIONS.abuse,
|
|
50
|
-
value: 'abuse'
|
|
51
|
-
}, {
|
|
52
|
-
text: i18n.MODAL.FEEDBACK_OPTIONS.other,
|
|
53
|
-
value: 'other'
|
|
54
|
-
}];
|
|
55
|
-
var script = {
|
|
56
|
-
name: 'DuoChatFeedbackModal',
|
|
57
|
-
components: {
|
|
58
|
-
GlModal,
|
|
59
|
-
GlAlert,
|
|
60
|
-
GlFormCheckboxGroup,
|
|
61
|
-
GlFormGroup,
|
|
62
|
-
GlFormTextarea
|
|
63
|
-
},
|
|
64
|
-
inject: {
|
|
65
|
-
modalTitle: {
|
|
66
|
-
default: i18n.MODAL.TITLE
|
|
67
|
-
},
|
|
68
|
-
modalAlert: {
|
|
69
|
-
default: i18n.MODAL.ALERT
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
data() {
|
|
73
|
-
return {
|
|
74
|
-
selectedFeedbackOptions: [],
|
|
75
|
-
extendedFeedback: '',
|
|
76
|
-
isValid: null
|
|
77
|
-
};
|
|
78
|
-
},
|
|
79
|
-
watch: {
|
|
80
|
-
selectedFeedbackOptions(options) {
|
|
81
|
-
this.isValid = options.length > 0;
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
methods: {
|
|
85
|
-
close() {
|
|
86
|
-
this.$refs.feedbackModal.hide();
|
|
87
|
-
},
|
|
88
|
-
show() {
|
|
89
|
-
this.$refs.feedbackModal.show();
|
|
90
|
-
},
|
|
91
|
-
onFeedbackSubmit(e) {
|
|
92
|
-
if (this.selectedFeedbackOptions.length) {
|
|
93
|
-
this.$emit('feedback-submitted', {
|
|
94
|
-
feedbackChoices: this.selectedFeedbackOptions,
|
|
95
|
-
extendedTextFeedback: this.extendedFeedback
|
|
96
|
-
});
|
|
97
|
-
this.close();
|
|
98
|
-
this.isValid = null;
|
|
99
|
-
} else {
|
|
100
|
-
e === null || e === void 0 ? void 0 : e.preventDefault();
|
|
101
|
-
this.isValid = false;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
actions: {
|
|
106
|
-
primary: {
|
|
107
|
-
text: i18n.MODAL.ACTIONS.submit
|
|
108
|
-
},
|
|
109
|
-
cancel: {
|
|
110
|
-
text: i18n.MODAL.ACTIONS.cancel
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
feedbackOptions,
|
|
114
|
-
i18n
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
/* script */
|
|
118
|
-
const __vue_script__ = script;
|
|
119
|
-
|
|
120
|
-
/* template */
|
|
121
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-modal',{ref:"feedbackModal",attrs:{"modal-id":"feedbackModal","title":_vm.modalTitle,"action-primary":_vm.$options.actions.primary,"action-cancel":_vm.$options.actions.cancel,"visible":false,"size":"sm"},on:{"primary":_vm.onFeedbackSubmit,"canceled":_vm.close}},[_c('p',[_vm._v(_vm._s(_vm.$options.i18n.MODAL.DESCRIPTION))]),_vm._v(" "),_c('gl-form-group',{attrs:{"invalid-feedback":_vm.$options.i18n.MODAL.REQUIRED_VALIDATION_ERROR,"state":_vm.isValid,"label":_vm.$options.i18n.MODAL.OPTIONS_LABEL,"data-testid":"feedback-options"}},[_c('gl-form-checkbox-group',{attrs:{"options":_vm.$options.feedbackOptions},model:{value:(_vm.selectedFeedbackOptions),callback:function ($$v) {_vm.selectedFeedbackOptions=$$v;},expression:"selectedFeedbackOptions"}})],1),_vm._v(" "),_c('gl-alert',{staticClass:"gl-mb-5",attrs:{"dismissible":false}},[_vm._v(_vm._s(_vm.modalAlert))]),_vm._v(" "),_vm._t("feedback-extra-fields",function(){return [_c('gl-form-group',{attrs:{"label":_vm.$options.i18n.MODAL.MORE_LABEL,"optional":""}},[_c('gl-form-textarea',{attrs:{"placeholder":_vm.$options.i18n.MODAL.MORE_PLACEHOLDER},model:{value:(_vm.extendedFeedback),callback:function ($$v) {_vm.extendedFeedback=$$v;},expression:"extendedFeedback"}})],1)]})],2)};
|
|
122
|
-
var __vue_staticRenderFns__ = [];
|
|
123
|
-
|
|
124
|
-
/* style */
|
|
125
|
-
const __vue_inject_styles__ = undefined;
|
|
126
|
-
/* scoped */
|
|
127
|
-
const __vue_scope_id__ = undefined;
|
|
128
|
-
/* module identifier */
|
|
129
|
-
const __vue_module_identifier__ = undefined;
|
|
130
|
-
/* functional template */
|
|
131
|
-
const __vue_is_functional_template__ = false;
|
|
132
|
-
/* style inject */
|
|
133
|
-
|
|
134
|
-
/* style inject SSR */
|
|
135
|
-
|
|
136
|
-
/* style inject shadow dom */
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const __vue_component__ = __vue_normalize__(
|
|
141
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
142
|
-
__vue_inject_styles__,
|
|
143
|
-
__vue_script__,
|
|
144
|
-
__vue_scope_id__,
|
|
145
|
-
__vue_is_functional_template__,
|
|
146
|
-
__vue_module_identifier__,
|
|
147
|
-
false,
|
|
148
|
-
undefined,
|
|
149
|
-
undefined,
|
|
150
|
-
undefined
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
export default __vue_component__;
|
|
154
|
-
export { feedbackOptions, i18n };
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import GlIcon from '../../../../../base/icon/icon';
|
|
2
|
-
import GlCollapse from '../../../../../base/collapse/collapse';
|
|
3
|
-
import GlButton from '../../../../../base/button/button';
|
|
4
|
-
import { GlTooltipDirective } from '../../../../../../directives/tooltip';
|
|
5
|
-
import { translate } from '../../../../../../utils/i18n';
|
|
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: 'GlDuoWorkflowPanel',
|
|
18
|
-
components: {
|
|
19
|
-
GlCollapse,
|
|
20
|
-
GlButton,
|
|
21
|
-
GlIcon
|
|
22
|
-
},
|
|
23
|
-
directives: {
|
|
24
|
-
GlTooltip: GlTooltipDirective
|
|
25
|
-
},
|
|
26
|
-
props: {
|
|
27
|
-
/**
|
|
28
|
-
* The icon to show in the header.
|
|
29
|
-
*/
|
|
30
|
-
headerIcon: {
|
|
31
|
-
type: String,
|
|
32
|
-
required: false,
|
|
33
|
-
default: ''
|
|
34
|
-
},
|
|
35
|
-
/**
|
|
36
|
-
* The text used as the title and aria-label for the button when the collapse is collapsed
|
|
37
|
-
*/
|
|
38
|
-
expandPanelButtonTitle: {
|
|
39
|
-
type: String,
|
|
40
|
-
required: false,
|
|
41
|
-
default: translate('GlDuoWorkflowPanel.expandButtonTitle', 'Expand')
|
|
42
|
-
},
|
|
43
|
-
/**
|
|
44
|
-
* The text used as the title and aria-label for the button when the collapse is expanded
|
|
45
|
-
*/
|
|
46
|
-
collapsePanelButtonTitle: {
|
|
47
|
-
type: String,
|
|
48
|
-
required: false,
|
|
49
|
-
default: translate('GlDuoWorkflowPanel.collapseButtonTitle', 'Collapse')
|
|
50
|
-
},
|
|
51
|
-
/**
|
|
52
|
-
* Whether the panel is expanded or not
|
|
53
|
-
*/
|
|
54
|
-
expanded: {
|
|
55
|
-
type: Boolean,
|
|
56
|
-
required: false,
|
|
57
|
-
default: true
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
computed: {
|
|
61
|
-
buttonIcon() {
|
|
62
|
-
return this.expanded ? 'chevron-up' : 'chevron-down';
|
|
63
|
-
},
|
|
64
|
-
buttonTitle() {
|
|
65
|
-
return this.expanded ? this.collapsePanelButtonTitle : this.expandPanelButtonTitle;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
/* script */
|
|
71
|
-
const __vue_script__ = script;
|
|
72
|
-
|
|
73
|
-
/* template */
|
|
74
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('div',{staticClass:"gl-flex gl-flex-nowrap gl-items-center"},[(_vm.headerIcon)?_c('gl-icon',{staticClass:"gl-mr-3",attrs:{"name":_vm.headerIcon,"size":24}}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-flex gl-flex-grow gl-items-baseline"},[_c('h2',{staticClass:"gl-mb-0"},[_vm._t("title")],2),_vm._v(" "),_c('small',{staticClass:"gl-ml-3"},[_vm._t("subtitle")],2)]),_vm._v(" "),_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip"}],attrs:{"category":"tertiary","icon":_vm.buttonIcon,"title":_vm.buttonTitle,"aria-label":_vm.buttonTitle},on:{"click":function($event){return _vm.$emit('toggle-panel')}}})],1),_vm._v(" "),_c('gl-collapse',{attrs:{"visible":_vm.expanded}},[_c('div',{staticClass:"gl-ml-7 gl-mt-4 gl-flex-grow"},[_vm._t("content")],2)])],1)};
|
|
75
|
-
var __vue_staticRenderFns__ = [];
|
|
76
|
-
|
|
77
|
-
/* style */
|
|
78
|
-
const __vue_inject_styles__ = undefined;
|
|
79
|
-
/* scoped */
|
|
80
|
-
const __vue_scope_id__ = undefined;
|
|
81
|
-
/* module identifier */
|
|
82
|
-
const __vue_module_identifier__ = undefined;
|
|
83
|
-
/* functional template */
|
|
84
|
-
const __vue_is_functional_template__ = false;
|
|
85
|
-
/* style inject */
|
|
86
|
-
|
|
87
|
-
/* style inject SSR */
|
|
88
|
-
|
|
89
|
-
/* style inject shadow dom */
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const __vue_component__ = __vue_normalize__(
|
|
94
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
95
|
-
__vue_inject_styles__,
|
|
96
|
-
__vue_script__,
|
|
97
|
-
__vue_scope_id__,
|
|
98
|
-
__vue_is_functional_template__,
|
|
99
|
-
__vue_module_identifier__,
|
|
100
|
-
false,
|
|
101
|
-
undefined,
|
|
102
|
-
undefined,
|
|
103
|
-
undefined
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
export default __vue_component__;
|