@gitlab/ui 66.18.0 → 66.20.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 +19 -0
- package/dist/components/base/banner/banner.js +1 -1
- package/dist/components/experimental/duo/user_feedback/user_feedback.js +94 -0
- package/dist/components/experimental/duo/user_feedback/user_feedback_modal.js +121 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +1 -0
- package/dist/tokens/css/tokens.css +1 -1
- package/dist/tokens/css/tokens.dark.css +1 -1
- package/dist/tokens/js/tokens.dark.js +1 -1
- package/dist/tokens/js/tokens.js +1 -1
- package/dist/tokens/scss/_tokens.dark.scss +1 -1
- package/dist/tokens/scss/_tokens.scss +1 -1
- package/package.json +2 -2
- package/src/components/base/banner/banner.scss +3 -27
- package/src/components/base/banner/banner.vue +1 -1
- package/src/components/experimental/duo/user_feedback/user_feedback.md +40 -0
- package/src/components/experimental/duo/user_feedback/user_feedback.spec.js +80 -0
- package/src/components/experimental/duo/user_feedback/user_feedback.stories.js +47 -0
- package/src/components/experimental/duo/user_feedback/user_feedback.vue +76 -0
- package/src/components/experimental/duo/user_feedback/user_feedback_modal.spec.js +61 -0
- package/src/components/experimental/duo/user_feedback/user_feedback_modal.vue +124 -0
- package/src/index.js +1 -0
package/dist/index.js
CHANGED
|
@@ -87,6 +87,7 @@ export { default as GlAccordionItem } from './components/base/accordion/accordio
|
|
|
87
87
|
export { default as GlCarousel } from './components/base/carousel/carousel';
|
|
88
88
|
export { default as GlCarouselSlide } from './components/base/carousel/carousel_slide';
|
|
89
89
|
export { default as GlExperimentBadge } from './components/experimental/experiment_badge/experiment_badge';
|
|
90
|
+
export { default as GlDuoUserFeedback } from './components/experimental/duo/user_feedback/user_feedback';
|
|
90
91
|
export { default as GlAnimatedNumber } from './components/utilities/animated_number/animated_number';
|
|
91
92
|
export { default as GlFriendlyWrap } from './components/utilities/friendly_wrap/friendly_wrap';
|
|
92
93
|
export { default as GlIntersperse } from './components/utilities/intersperse/intersperse';
|
package/dist/tokens/js/tokens.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "66.
|
|
3
|
+
"version": "66.20.0",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
90
|
"@arkweid/lefthook": "0.7.7",
|
|
91
|
-
"@babel/core": "^7.
|
|
91
|
+
"@babel/core": "^7.23.0",
|
|
92
92
|
"@babel/preset-env": "^7.22.20",
|
|
93
93
|
"@babel/preset-react": "^7.22.15",
|
|
94
94
|
"@gitlab/eslint-plugin": "19.0.0",
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
.gl-banner {
|
|
2
|
-
@include gl-border-1;
|
|
3
|
-
@include gl-border-gray-100;
|
|
4
|
-
@include gl-border-solid;
|
|
5
|
-
@include gl-display-flex;
|
|
6
|
-
@include gl-font-base;
|
|
7
|
-
@include gl-px-8;
|
|
8
|
-
@include gl-py-6;
|
|
9
|
-
@include gl-rounded-base;
|
|
10
|
-
@include gl-relative;
|
|
11
|
-
|
|
12
|
-
p {
|
|
13
|
-
@include gl-line-height-20;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
1
|
.gl-banner-illustration {
|
|
18
2
|
@include gl-flex-shrink-0;
|
|
19
3
|
@include gl-mr-6;
|
|
@@ -28,26 +12,18 @@
|
|
|
28
12
|
}
|
|
29
13
|
|
|
30
14
|
.gl-banner-title {
|
|
31
|
-
@include gl-
|
|
32
|
-
@include gl-font-weight-bold;
|
|
33
|
-
@include gl-mt-0;
|
|
15
|
+
@include gl-heading-scale-500;
|
|
34
16
|
@include gl-mb-3;
|
|
35
|
-
@include gl-line-height-20;
|
|
36
17
|
}
|
|
37
18
|
|
|
38
19
|
.gl-banner-close {
|
|
39
20
|
@include gl-absolute;
|
|
40
|
-
@include gl-top-
|
|
41
|
-
@include gl-right-
|
|
21
|
+
@include gl-top-3;
|
|
22
|
+
@include gl-right-3;
|
|
42
23
|
}
|
|
43
24
|
|
|
44
25
|
// Introduction variant
|
|
45
26
|
.gl-banner-introduction {
|
|
46
27
|
@include gl-bg-blue-50;
|
|
47
28
|
@include gl-border-blue-300;
|
|
48
|
-
|
|
49
|
-
.gl-banner-title {
|
|
50
|
-
@include gl-font-size-h-display;
|
|
51
|
-
@include gl-line-height-28;
|
|
52
|
-
}
|
|
53
29
|
}
|
|
@@ -108,7 +108,7 @@ export default {
|
|
|
108
108
|
|
|
109
109
|
<template>
|
|
110
110
|
<gl-card
|
|
111
|
-
class="gl-
|
|
111
|
+
class="gl-pl-6 gl-pr-8 gl-py-6"
|
|
112
112
|
:class="{ 'gl-banner-introduction': isIntroducing, 'gl-border-none!': embedded }"
|
|
113
113
|
body-class="gl-display-flex gl-p-0!"
|
|
114
114
|
>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
The main entry point component for gathering the user feedback for AI features.
|
|
2
|
+
|
|
3
|
+
The component consists of a textual button and a connected modal with the actual form, emitting
|
|
4
|
+
the form data on submission.
|
|
5
|
+
|
|
6
|
+
## Custom button text
|
|
7
|
+
|
|
8
|
+
The component allows to customize the button text, presented to the user.
|
|
9
|
+
|
|
10
|
+
```html
|
|
11
|
+
<gl-duo-user-feedback feedback-link-text="Leave your custom feedback" />
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Linking to a separate feedback form
|
|
15
|
+
|
|
16
|
+
The main goal of this component is to provide the advanced feedback form. However, it might not
|
|
17
|
+
be necessary for all consumers. In such a case, the component allows to bypass the default
|
|
18
|
+
form and link to an external feedback page/form.
|
|
19
|
+
|
|
20
|
+
```html
|
|
21
|
+
<gl-duo-user-feedback feedback-link-url="https://gitlab.com" />
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Listening to the feedback form submission
|
|
25
|
+
|
|
26
|
+
This component emits the `feedback` event with all the options selected in the feedback form.
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<gl-duo-user-feedback @feedback="myEventTracker" />
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The returned event contains two props (`feedbackChoices` and `extendedTextFeedback`) coming from
|
|
33
|
+
the underlying `FeedbackModal` component. Here's the example of a possible event:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"feedbackChoices": ["unhelpful", "long"],
|
|
38
|
+
"extendedTextFeedback": "The answer was too long to understand"
|
|
39
|
+
}
|
|
40
|
+
```
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { nextTick } from 'vue';
|
|
2
|
+
import { shallowMount } from '@vue/test-utils';
|
|
3
|
+
import { GlButton } from '../../../../index';
|
|
4
|
+
import DuoChatFeedbackModal from './user_feedback_modal.vue';
|
|
5
|
+
import UserFeedback, { i18n } from './user_feedback.vue';
|
|
6
|
+
|
|
7
|
+
describe('UserFeedback', () => {
|
|
8
|
+
let wrapper;
|
|
9
|
+
const eventName = 'test_event_name';
|
|
10
|
+
|
|
11
|
+
const createComponent = ({ props, data = {} } = {}) => {
|
|
12
|
+
wrapper = shallowMount(UserFeedback, {
|
|
13
|
+
data() {
|
|
14
|
+
return data;
|
|
15
|
+
},
|
|
16
|
+
propsData: {
|
|
17
|
+
eventName,
|
|
18
|
+
...props,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const findButton = () => wrapper.findComponent(GlButton);
|
|
24
|
+
const findModal = () => wrapper.findComponent(DuoChatFeedbackModal);
|
|
25
|
+
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
createComponent();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe('rendering with no feedback registered', () => {
|
|
31
|
+
it('renders a button to provide feedback', () => {
|
|
32
|
+
expect(findButton().exists()).toBe(true);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('renders the feedback modal', () => {
|
|
36
|
+
expect(findModal().exists()).toBe(true);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it.each`
|
|
41
|
+
feedbackLinkText | expectedButtonText
|
|
42
|
+
${'Foo'} | ${'Foo'}
|
|
43
|
+
${undefined} | ${i18n.FEEDBACK_LINK_TEXT}
|
|
44
|
+
`(
|
|
45
|
+
'renders "$expectedButtonText" as button text when "$feedbackLinkText" is passed as the feedback link text',
|
|
46
|
+
({ feedbackLinkText, expectedButtonText } = {}) => {
|
|
47
|
+
createComponent({ props: { feedbackLinkText } });
|
|
48
|
+
expect(findButton().text()).toBe(expectedButtonText);
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
it('does not render the modal if custom URL is passed for the feedback link', () => {
|
|
53
|
+
const feedbackLinkUrl = 'https://example.com';
|
|
54
|
+
createComponent({ props: { feedbackLinkUrl } });
|
|
55
|
+
expect(findButton().attributes('href')).toBe(feedbackLinkUrl);
|
|
56
|
+
expect(findModal().exists()).toBe(false);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
describe('event handling', () => {
|
|
60
|
+
const passedFeedback = { feedbackOptions: ['helpful'], extendedFeedback: 'Foo bar' };
|
|
61
|
+
|
|
62
|
+
it('emits the event, containing the form data, when modal emits', () => {
|
|
63
|
+
findModal().vm.$emit('feedback-submitted', passedFeedback);
|
|
64
|
+
expect(wrapper.emitted('feedback')).toHaveLength(1);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('renders the thank you text instead of a button', async () => {
|
|
68
|
+
findModal().vm.$emit('feedback-submitted', passedFeedback);
|
|
69
|
+
await nextTick();
|
|
70
|
+
expect(findButton().exists()).toBe(false);
|
|
71
|
+
expect(wrapper.text()).toContain(i18n.FEEDBACK_THANKS);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('does not render the modal after feedback submitted', async () => {
|
|
75
|
+
findModal().vm.$emit('feedback-submitted', passedFeedback);
|
|
76
|
+
await nextTick();
|
|
77
|
+
expect(findModal().exists()).toBe(false);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import GlUserFeedback from './user_feedback.vue';
|
|
2
|
+
import readme from './user_feedback.md';
|
|
3
|
+
|
|
4
|
+
const generateProps = ({ feedbackLinkText, feedbackLinkUrl } = {}) => ({
|
|
5
|
+
feedbackLinkText,
|
|
6
|
+
feedbackLinkUrl,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const Template = (args, { argTypes }) => ({
|
|
10
|
+
components: { GlUserFeedback },
|
|
11
|
+
props: Object.keys(argTypes),
|
|
12
|
+
data() {
|
|
13
|
+
return {
|
|
14
|
+
eventOutput: '',
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
methods: {
|
|
18
|
+
logEvent(event) {
|
|
19
|
+
this.eventOutput = JSON.stringify(event);
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
template: `
|
|
23
|
+
<div>
|
|
24
|
+
<gl-user-feedback
|
|
25
|
+
:feedback-link-text="feedbackLinkText"
|
|
26
|
+
:feedback-link-url="feedbackLinkUrl"
|
|
27
|
+
@feedback="logEvent"/>
|
|
28
|
+
<p v-if="eventOutput"><code>{{ eventOutput }}</code></p>
|
|
29
|
+
</div>
|
|
30
|
+
`,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const Default = Template.bind({});
|
|
34
|
+
Default.args = generateProps();
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
title: 'experimental/duo/user-feedback',
|
|
38
|
+
component: GlUserFeedback,
|
|
39
|
+
parameters: {
|
|
40
|
+
storyshots: { disable: true },
|
|
41
|
+
docs: {
|
|
42
|
+
description: {
|
|
43
|
+
component: readme,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { GlButton } from '../../../../index';
|
|
3
|
+
import FeedbackModal from './user_feedback_modal.vue';
|
|
4
|
+
|
|
5
|
+
export const i18n = {
|
|
6
|
+
FEEDBACK_LINK_TEXT: 'Give feedback to improve this answer.',
|
|
7
|
+
FEEDBACK_THANKS: 'Thank you for your feedback.',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
name: 'GlDuoUserFeedback',
|
|
12
|
+
components: {
|
|
13
|
+
GlButton,
|
|
14
|
+
FeedbackModal,
|
|
15
|
+
},
|
|
16
|
+
props: {
|
|
17
|
+
/**
|
|
18
|
+
* The text to be displayed as the feedback link/button.
|
|
19
|
+
*/
|
|
20
|
+
feedbackLinkText: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: false,
|
|
23
|
+
default: i18n.FEEDBACK_LINK_TEXT,
|
|
24
|
+
},
|
|
25
|
+
/**
|
|
26
|
+
* The URL of a page to provide more explanations on the experiment. If provided, clicking
|
|
27
|
+
* the feedback link will open a new tab with the URL instead of showing the feedback modal.
|
|
28
|
+
*/
|
|
29
|
+
feedbackLinkUrl: {
|
|
30
|
+
type: String,
|
|
31
|
+
required: false,
|
|
32
|
+
default: '',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
data() {
|
|
36
|
+
return {
|
|
37
|
+
feedbackReceived: false,
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
computed: {
|
|
41
|
+
shouldRenderModal() {
|
|
42
|
+
return !this.feedbackReceived && !this.feedbackLinkUrl;
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
methods: {
|
|
46
|
+
notify(event) {
|
|
47
|
+
/**
|
|
48
|
+
* Notify listeners about the feedback form submission.
|
|
49
|
+
* @param {*} event An event, containing the feedback choices and the extended feedback text.
|
|
50
|
+
*/
|
|
51
|
+
this.$emit('feedback', event);
|
|
52
|
+
this.feedbackReceived = true;
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
i18n,
|
|
56
|
+
};
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<template>
|
|
60
|
+
<div class="gl-pt-4">
|
|
61
|
+
<div>
|
|
62
|
+
<gl-button
|
|
63
|
+
v-if="!feedbackReceived"
|
|
64
|
+
variant="link"
|
|
65
|
+
target="_blank"
|
|
66
|
+
:href="feedbackLinkUrl"
|
|
67
|
+
@click="shouldRenderModal && $refs.feedbackModal.show()"
|
|
68
|
+
>{{ feedbackLinkText }}</gl-button
|
|
69
|
+
>
|
|
70
|
+
<span v-else class="gl-text-gray-500">
|
|
71
|
+
{{ $options.i18n.FEEDBACK_THANKS }}
|
|
72
|
+
</span>
|
|
73
|
+
</div>
|
|
74
|
+
<feedback-modal v-if="shouldRenderModal" ref="feedbackModal" @feedback-submitted="notify" />
|
|
75
|
+
</div>
|
|
76
|
+
</template>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import { GlModal, GlFormCheckboxGroup, GlFormCheckbox, GlFormTextarea } from '../../../../index';
|
|
3
|
+
import FeedbackModal, { feedbackOptions } from './user_feedback_modal.vue';
|
|
4
|
+
|
|
5
|
+
describe('FeedbackModal', () => {
|
|
6
|
+
let wrapper;
|
|
7
|
+
|
|
8
|
+
const findModal = () => wrapper.findComponent(GlModal);
|
|
9
|
+
const findOptions = () => wrapper.findComponent('[data-testid="feedback-options"]');
|
|
10
|
+
const findOptionsCheckboxes = () => findOptions().findAllComponents(GlFormCheckbox);
|
|
11
|
+
const findTextarea = () => wrapper.findComponent(GlFormTextarea);
|
|
12
|
+
const selectOption = (index = 0) => {
|
|
13
|
+
wrapper
|
|
14
|
+
.findAllComponents(GlFormCheckboxGroup)
|
|
15
|
+
.at(index)
|
|
16
|
+
.vm.$emit('input', [feedbackOptions[index].value]);
|
|
17
|
+
};
|
|
18
|
+
const createComponent = () => {
|
|
19
|
+
wrapper = shallowMount(FeedbackModal, {
|
|
20
|
+
stubs: {
|
|
21
|
+
GlModal,
|
|
22
|
+
GlFormCheckboxGroup,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
beforeEach(() => {
|
|
28
|
+
createComponent();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('renders the feedback options', () => {
|
|
32
|
+
const checkboxes = findOptionsCheckboxes();
|
|
33
|
+
feedbackOptions.forEach((option, index) => {
|
|
34
|
+
expect(checkboxes.at(index).text()).toBe(option.text);
|
|
35
|
+
expect(checkboxes.at(index).attributes('value')).toBe(option.value);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('renders the textarea field for additional feedback', () => {
|
|
40
|
+
expect(findTextarea().exists()).toBe(true);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
describe('interaction', () => {
|
|
44
|
+
it('emits the feedback event when the submit button is clicked', () => {
|
|
45
|
+
selectOption();
|
|
46
|
+
findModal().vm.$emit('primary');
|
|
47
|
+
expect(wrapper.emitted('feedback-submitted')).toEqual([
|
|
48
|
+
[
|
|
49
|
+
{
|
|
50
|
+
feedbackChoices: [feedbackOptions[0].value],
|
|
51
|
+
extendedTextFeedback: '',
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
]);
|
|
55
|
+
});
|
|
56
|
+
it('does not emit event if there is no option selected', () => {
|
|
57
|
+
findModal().vm.$emit('primary');
|
|
58
|
+
expect(wrapper.emitted('feedback-submitted')).toBeUndefined();
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { GlModal, GlFormCheckboxGroup, GlFormGroup, GlFormTextarea } from '../../../../index';
|
|
3
|
+
|
|
4
|
+
export const i18n = {
|
|
5
|
+
MODAL_TITLE: 'Give feedback on AI content',
|
|
6
|
+
MODAL_DESCRIPTION:
|
|
7
|
+
'To help improve the quality of the content, send your feedback to GitLab team members.',
|
|
8
|
+
MODAL_OPTIONS_LABEL: 'How was the AI content?',
|
|
9
|
+
MODAL_MORE_LABEL: 'More information',
|
|
10
|
+
MODAL_MORE_PLACEHOLDER: 'How could the content be improved?',
|
|
11
|
+
MODAL_FEEDBACK_OPTIONS: {
|
|
12
|
+
helpful: 'Helpful',
|
|
13
|
+
unhelpful: 'Unhelpful or irrelevant',
|
|
14
|
+
incorrect: 'Factually incorrect',
|
|
15
|
+
long: 'Too long',
|
|
16
|
+
abuse: 'Abusive or offensive',
|
|
17
|
+
other: 'Something else',
|
|
18
|
+
},
|
|
19
|
+
MODAL_ACTIONS: {
|
|
20
|
+
submit: 'Submit',
|
|
21
|
+
cancel: 'Cancel',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const feedbackOptions = [
|
|
26
|
+
{
|
|
27
|
+
text: i18n.MODAL_FEEDBACK_OPTIONS.helpful,
|
|
28
|
+
value: 'helpful',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
text: i18n.MODAL_FEEDBACK_OPTIONS.unhelpful,
|
|
32
|
+
value: 'unhelpful',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
text: i18n.MODAL_FEEDBACK_OPTIONS.incorrect,
|
|
36
|
+
value: 'incorrect',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
text: i18n.MODAL_FEEDBACK_OPTIONS.long,
|
|
40
|
+
value: 'long',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
text: i18n.MODAL_FEEDBACK_OPTIONS.abuse,
|
|
44
|
+
value: 'abuse',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
text: i18n.MODAL_FEEDBACK_OPTIONS.other,
|
|
48
|
+
value: 'other',
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
export default {
|
|
53
|
+
name: 'DuoChatFeedbackModal',
|
|
54
|
+
components: {
|
|
55
|
+
GlModal,
|
|
56
|
+
GlFormCheckboxGroup,
|
|
57
|
+
GlFormGroup,
|
|
58
|
+
GlFormTextarea,
|
|
59
|
+
},
|
|
60
|
+
data() {
|
|
61
|
+
return {
|
|
62
|
+
selectedFeedbackOptions: [],
|
|
63
|
+
extendedFeedback: '',
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
methods: {
|
|
67
|
+
show() {
|
|
68
|
+
this.$refs.feedbackModal.show();
|
|
69
|
+
},
|
|
70
|
+
onFeedbackSubmit() {
|
|
71
|
+
if (this.selectedFeedbackOptions.length) {
|
|
72
|
+
this.$emit('feedback-submitted', {
|
|
73
|
+
feedbackChoices: this.selectedFeedbackOptions,
|
|
74
|
+
extendedTextFeedback: this.extendedFeedback,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
onFeedbackCanceled() {
|
|
79
|
+
this.$refs.feedbackModal.hide();
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
actions: {
|
|
83
|
+
primary: {
|
|
84
|
+
text: i18n.MODAL_ACTIONS.submit,
|
|
85
|
+
},
|
|
86
|
+
cancel: {
|
|
87
|
+
text: i18n.MODAL_ACTIONS.cancel,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
feedbackOptions,
|
|
91
|
+
i18n,
|
|
92
|
+
};
|
|
93
|
+
</script>
|
|
94
|
+
<template>
|
|
95
|
+
<gl-modal
|
|
96
|
+
ref="feedbackModal"
|
|
97
|
+
modal-id="feedbackModal"
|
|
98
|
+
:title="$options.i18n.MODAL_TITLE"
|
|
99
|
+
:action-primary="$options.actions.primary"
|
|
100
|
+
:action-cancel="$options.actions.cancel"
|
|
101
|
+
:visible="false"
|
|
102
|
+
size="sm"
|
|
103
|
+
@primary="onFeedbackSubmit"
|
|
104
|
+
@canceled="onFeedbackCanceled"
|
|
105
|
+
>
|
|
106
|
+
<p>{{ $options.i18n.MODAL_DESCRIPTION }}</p>
|
|
107
|
+
<gl-form-group
|
|
108
|
+
:label="$options.i18n.MODAL_OPTIONS_LABEL"
|
|
109
|
+
:optional="false"
|
|
110
|
+
data-testid="feedback-options"
|
|
111
|
+
>
|
|
112
|
+
<gl-form-checkbox-group
|
|
113
|
+
v-model="selectedFeedbackOptions"
|
|
114
|
+
:options="$options.feedbackOptions"
|
|
115
|
+
/>
|
|
116
|
+
</gl-form-group>
|
|
117
|
+
<gl-form-group :label="$options.i18n.MODAL_MORE_LABEL" optional>
|
|
118
|
+
<gl-form-textarea
|
|
119
|
+
v-model="extendedFeedback"
|
|
120
|
+
:placeholder="$options.i18n.MODAL_MORE_PLACEHOLDER"
|
|
121
|
+
/>
|
|
122
|
+
</gl-form-group>
|
|
123
|
+
</gl-modal>
|
|
124
|
+
</template>
|
package/src/index.js
CHANGED
|
@@ -98,6 +98,7 @@ export { default as GlCarouselSlide } from './components/base/carousel/carousel_
|
|
|
98
98
|
|
|
99
99
|
// Experimental
|
|
100
100
|
export { default as GlExperimentBadge } from './components/experimental/experiment_badge/experiment_badge.vue';
|
|
101
|
+
export { default as GlDuoUserFeedback } from './components/experimental/duo/user_feedback/user_feedback.vue';
|
|
101
102
|
|
|
102
103
|
// Utilities
|
|
103
104
|
export { default as GlAnimatedNumber } from './components/utilities/animated_number/animated_number.vue';
|