2020-03-13 15:44:24 +05:30
|
|
|
import Vue from 'vue';
|
2021-02-22 17:27:13 +05:30
|
|
|
import VueApollo from 'vue-apollo';
|
|
|
|
import createDefaultClient from '~/lib/graphql';
|
2021-03-08 18:12:59 +05:30
|
|
|
import { parseBoolean } from '~/lib/utils/common_utils';
|
2020-03-13 15:44:24 +05:30
|
|
|
import ProjectPipelinesCharts from './components/app.vue';
|
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
Vue.use(VueApollo);
|
|
|
|
|
|
|
|
const apolloProvider = new VueApollo({
|
|
|
|
defaultClient: createDefaultClient(),
|
|
|
|
});
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
const mountPipelineChartsApp = (el) => {
|
|
|
|
const { projectPath } = el.dataset;
|
2020-03-13 15:44:24 +05:30
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
const shouldRenderDeploymentFrequencyCharts = parseBoolean(
|
|
|
|
el.dataset.shouldRenderDeploymentFrequencyCharts,
|
|
|
|
);
|
2020-03-13 15:44:24 +05:30
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
2021-03-08 18:12:59 +05:30
|
|
|
name: 'ProjectPipelinesChartsApp',
|
2020-03-13 15:44:24 +05:30
|
|
|
components: {
|
2021-03-08 18:12:59 +05:30
|
|
|
ProjectPipelinesCharts,
|
|
|
|
},
|
|
|
|
apolloProvider,
|
|
|
|
provide: {
|
|
|
|
projectPath,
|
|
|
|
shouldRenderDeploymentFrequencyCharts,
|
2020-03-13 15:44:24 +05:30
|
|
|
},
|
2021-03-08 18:12:59 +05:30
|
|
|
render: (createElement) => createElement(ProjectPipelinesCharts, {}),
|
2020-03-13 15:44:24 +05:30
|
|
|
});
|
|
|
|
};
|
2021-02-22 17:27:13 +05:30
|
|
|
|
|
|
|
export default () => {
|
|
|
|
const el = document.querySelector('#js-project-pipelines-charts-app');
|
|
|
|
return !el ? {} : mountPipelineChartsApp(el);
|
|
|
|
};
|