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({
|
2021-12-11 22:18:48 +05:30
|
|
|
defaultClient: createDefaultClient(),
|
2021-02-22 17:27:13 +05:30
|
|
|
});
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
const mountPipelineChartsApp = (el) => {
|
2022-01-26 12:08:38 +05:30
|
|
|
const { projectPath, failedPipelinesLink, coverageChartPath, defaultBranch } = el.dataset;
|
2020-03-13 15:44:24 +05:30
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
const shouldRenderDoraCharts = parseBoolean(el.dataset.shouldRenderDoraCharts);
|
2021-12-11 22:18:48 +05:30
|
|
|
const shouldRenderQualitySummary = parseBoolean(el.dataset.shouldRenderQualitySummary);
|
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,
|
2022-01-26 12:08:38 +05:30
|
|
|
failedPipelinesLink,
|
2021-04-29 21:17:54 +05:30
|
|
|
shouldRenderDoraCharts,
|
2021-12-11 22:18:48 +05:30
|
|
|
shouldRenderQualitySummary,
|
2022-01-26 12:08:38 +05:30
|
|
|
coverageChartPath,
|
|
|
|
defaultBranch,
|
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);
|
|
|
|
};
|