debian-mirror-gitlab/app/assets/javascripts/cycle_analytics/index.js

51 lines
1.3 KiB
JavaScript
Raw Normal View History

2021-04-17 20:07:23 +05:30
import Vue from 'vue';
2021-12-11 22:18:48 +05:30
import {
extractFilterQueryParameters,
extractPaginationQueryParameters,
} from '~/analytics/shared/utils';
2021-04-17 20:07:23 +05:30
import Translate from '../vue_shared/translate';
import CycleAnalytics from './components/base.vue';
2021-06-08 01:23:25 +05:30
import createStore from './store';
2021-12-11 22:18:48 +05:30
import { buildCycleAnalyticsInitialData } from './utils';
2021-04-17 20:07:23 +05:30
Vue.use(Translate);
export default () => {
2021-06-08 01:23:25 +05:30
const store = createStore();
2021-04-17 20:07:23 +05:30
const el = document.querySelector('#js-cycle-analytics');
2021-12-11 22:18:48 +05:30
const { noAccessSvgPath, noDataSvgPath } = el.dataset;
const initialData = buildCycleAnalyticsInitialData({ ...el.dataset, gon });
2021-06-08 01:23:25 +05:30
2021-12-11 22:18:48 +05:30
const pagination = extractPaginationQueryParameters(window.location.search);
const {
selectedAuthor,
selectedMilestone,
selectedAssigneeList,
selectedLabelList,
} = extractFilterQueryParameters(window.location.search);
2021-11-11 11:23:49 +05:30
2021-06-08 01:23:25 +05:30
store.dispatch('initializeVsa', {
2021-12-11 22:18:48 +05:30
...initialData,
selectedAuthor,
selectedMilestone,
selectedAssigneeList,
selectedLabelList,
pagination,
2021-06-08 01:23:25 +05:30
});
2021-04-17 20:07:23 +05:30
// eslint-disable-next-line no-new
new Vue({
el,
name: 'CycleAnalytics',
2021-11-18 22:05:49 +05:30
apolloProvider: {},
2021-06-08 01:23:25 +05:30
store,
2021-04-17 20:07:23 +05:30
render: (createElement) =>
createElement(CycleAnalytics, {
props: {
noDataSvgPath,
noAccessSvgPath,
},
}),
});
};