Commit 87e336b0 authored by Michael Lunøe's avatar Michael Lunøe Committed by Phil Hughes

fixup! Refactor(issues analytics): move filter into vue

Refactor(dataZoomConfig): simplify logic compose config
parent c6158f0a
...@@ -8,6 +8,7 @@ import { getMonthNames } from '~/lib/utils/datetime_utility'; ...@@ -8,6 +8,7 @@ import { getMonthNames } from '~/lib/utils/datetime_utility';
import { getSvgIconPathContent } from '~/lib/utils/icon_utils'; import { getSvgIconPathContent } from '~/lib/utils/icon_utils';
import { mergeUrlParams } from '~/lib/utils/url_utility'; import { mergeUrlParams } from '~/lib/utils/url_utility';
import IssuesAnalyticsTable from './issues_analytics_table.vue'; import IssuesAnalyticsTable from './issues_analytics_table.vue';
import FilteredSearchIssueAnalytics from '../filtered_search_issues_analytics';
import { transformFilters } from '../utils'; import { transformFilters } from '../utils';
export default { export default {
...@@ -91,15 +92,21 @@ export default { ...@@ -91,15 +92,21 @@ export default {
showFiltersEmptyState() { showFiltersEmptyState() {
return !this.loading && !this.showChart && this.hasFilters; return !this.loading && !this.showChart && this.hasFilters;
}, },
dataZoomConfig() {
const config = {
type: 'slider',
startValue: 0,
};
if (this.svgs['scroll-handle']) {
return { ...config, handleIcon: this.svgs['scroll-handle'] };
}
return config;
},
chartOptions() { chartOptions() {
return { return {
dataZoom: [ dataZoom: [this.dataZoomConfig],
{
type: 'slider',
startValue: 0,
handleIcon: this.svgs['scroll-handle'],
},
],
}; };
}, },
series() { series() {
...@@ -134,6 +141,9 @@ export default { ...@@ -134,6 +141,9 @@ export default {
}, },
}, },
created() { created() {
this.filterManager = new FilteredSearchIssueAnalytics(this.appliedFilters);
this.filterManager.setup();
this.setSvg('scroll-handle'); this.setSvg('scroll-handle');
}, },
mounted() { mounted() {
......
import Vue from 'vue'; import Vue from 'vue';
import IssuesAnalytics from './components/issues_analytics.vue'; import IssuesAnalytics from './components/issues_analytics.vue';
import store from './stores'; import store from './stores';
import FilteredSearchIssueAnalytics from './filtered_search_issues_analytics';
import { urlParamsToObject } from '~/lib/utils/common_utils'; import { urlParamsToObject } from '~/lib/utils/common_utils';
export default () => { export default () => {
...@@ -28,10 +27,6 @@ export default () => { ...@@ -28,10 +27,6 @@ export default () => {
components: { components: {
IssuesAnalytics, IssuesAnalytics,
}, },
mounted() {
this.filterManager = new FilteredSearchIssueAnalytics(store.state.issueAnalytics.filters);
this.filterManager.setup();
},
render(createElement) { render(createElement) {
return createElement('issues-analytics', { return createElement('issues-analytics', {
props: { props: {
......
...@@ -8,6 +8,13 @@ import { createLocalVue, shallowMount } from '@vue/test-utils'; ...@@ -8,6 +8,13 @@ import { createLocalVue, shallowMount } from '@vue/test-utils';
import { GlEmptyState, GlLoadingIcon } from '@gitlab/ui'; import { GlEmptyState, GlLoadingIcon } from '@gitlab/ui';
import { createStore } from 'ee/issues_analytics/stores'; import { createStore } from 'ee/issues_analytics/stores';
const mockFilterManagerSetup = jest.fn();
jest.mock('ee/issues_analytics/filtered_search_issues_analytics', () =>
jest.fn().mockImplementation(() => ({
setup: mockFilterManagerSetup,
})),
);
const localVue = createLocalVue(); const localVue = createLocalVue();
localVue.use(Vuex); localVue.use(Vuex);
......
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