Commit 59fa8146 authored by Brandon Labuschagne's avatar Brandon Labuschagne

Improve VSM date tooltip

Add copy to the tooltip which more
accurately describes how data is collected.

Changelog: changed
MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62194
EE: true
parent 712f99a7
...@@ -65,7 +65,7 @@ To filter results: ...@@ -65,7 +65,7 @@ To filter results:
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/13216) in GitLab 12.4. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/13216) in GitLab 12.4.
GitLab provides the ability to filter analytics based on a date range. To filter results: GitLab provides the ability to filter analytics based on a date range. Data is shown for workflow items created during the selected date range. To filter results:
1. Select a group. 1. Select a group.
1. Optionally select a project. 1. Optionally select a project.
......
...@@ -54,9 +54,14 @@ export default { ...@@ -54,9 +54,14 @@ export default {
}, },
data() { data() {
return { return {
maxDateRangeTooltip: sprintf(__('Date range cannot exceed %{maxDateRange} days.'), { maxDateRangeTooltip: sprintf(
maxDateRange: this.maxDateRange, __(
}), 'Showing data for workflow items created in this date range. Date range cannot exceed %{maxDateRange} days.',
),
{
maxDateRange: this.maxDateRange,
},
),
}; };
}, },
computed: { computed: {
...@@ -105,6 +110,7 @@ export default { ...@@ -105,6 +110,7 @@ export default {
</span> </span>
<gl-icon <gl-icon
v-gl-tooltip v-gl-tooltip
data-testid="helper-icon"
:title="maxDateRangeTooltip" :title="maxDateRangeTooltip"
name="question" name="question"
:size="14" :size="14"
......
...@@ -2,6 +2,7 @@ import { GlDaterangePicker } from '@gitlab/ui'; ...@@ -2,6 +2,7 @@ import { GlDaterangePicker } from '@gitlab/ui';
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import Daterange from 'ee/analytics/shared/components/daterange.vue'; import Daterange from 'ee/analytics/shared/components/daterange.vue';
import { useFakeDate } from 'helpers/fake_date'; import { useFakeDate } from 'helpers/fake_date';
import { createMockDirective, getBinding } from 'helpers/vue_mock_directive';
const defaultProps = { const defaultProps = {
startDate: new Date(2019, 8, 1), startDate: new Date(2019, 8, 1),
...@@ -19,6 +20,7 @@ describe('Daterange component', () => { ...@@ -19,6 +20,7 @@ describe('Daterange component', () => {
...defaultProps, ...defaultProps,
...props, ...props,
}, },
directives: { GlTooltip: createMockDirective() },
}); });
}; };
...@@ -76,6 +78,16 @@ describe('Daterange component', () => { ...@@ -76,6 +78,16 @@ describe('Daterange component', () => {
it('displays the correct number of selected days in the indicator', () => { it('displays the correct number of selected days in the indicator', () => {
expect(findDateRangeIndicator().find('span').text()).toBe('10 days'); expect(findDateRangeIndicator().find('span').text()).toBe('10 days');
}); });
it('displays a tooltip', () => {
const icon = wrapper.find('[data-testid="helper-icon"]');
const tooltip = getBinding(icon.element, 'gl-tooltip');
expect(tooltip).toBeDefined();
expect(icon.attributes('title')).toBe(
'Showing data for workflow items created in this date range. Date range cannot exceed 30 days.',
);
});
}); });
}); });
......
...@@ -10437,9 +10437,6 @@ msgstr "" ...@@ -10437,9 +10437,6 @@ msgstr ""
msgid "Date range" msgid "Date range"
msgstr "" msgstr ""
msgid "Date range cannot exceed %{maxDateRange} days."
msgstr ""
msgid "Date range must be shorter than %{max_range} days." msgid "Date range must be shorter than %{max_range} days."
msgstr "" msgstr ""
...@@ -30192,6 +30189,9 @@ msgstr "" ...@@ -30192,6 +30189,9 @@ msgstr ""
msgid "Showing all issues" msgid "Showing all issues"
msgstr "" msgstr ""
msgid "Showing data for workflow items created in this date range. Date range cannot exceed %{maxDateRange} days."
msgstr ""
msgid "Showing graphs based on events of the last %{timerange} days." msgid "Showing graphs based on events of the last %{timerange} days."
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment