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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
1.3 KiB
JavaScript
Raw Normal View History

2021-03-11 19:13:27 +05:30
// This is a false violation of @gitlab/no-runtime-template-compiler, since it
// creates a new Vue instance by spreading a _valid_ Vue component definition
// into the Vue constructor.
/* eslint-disable @gitlab/no-runtime-template-compiler */
2018-12-13 13:39:08 +05:30
import Vue from 'vue';
2020-07-28 23:09:34 +05:30
import VueApollo from 'vue-apollo';
2021-03-11 19:13:27 +05:30
import MrWidgetOptions from 'ee_else_ce/vue_merge_request_widget/mr_widget_options.vue';
2020-07-28 23:09:34 +05:30
import createDefaultClient from '~/lib/graphql';
2021-11-11 11:23:49 +05:30
import { parseBoolean } from '~/lib/utils/common_utils';
2021-03-11 19:13:27 +05:30
import Translate from '../vue_shared/translate';
2018-03-17 18:26:18 +05:30
Vue.use(Translate);
2020-07-28 23:09:34 +05:30
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
2021-12-11 22:18:48 +05:30
defaultClient: createDefaultClient(),
2020-07-28 23:09:34 +05:30
});
2017-08-17 22:00:37 +05:30
2018-03-27 19:54:05 +05:30
export default () => {
2020-03-13 15:44:24 +05:30
if (gl.mrWidget) return;
2017-08-17 22:00:37 +05:30
gl.mrWidgetData.gitlabLogo = gon.gitlab_logo;
2020-07-28 23:09:34 +05:30
gl.mrWidgetData.defaultAvatarUrl = gon.default_avatar_url;
2017-08-17 22:00:37 +05:30
2021-03-08 18:12:59 +05:30
const vm = new Vue({
el: '#js-vue-mr-widget',
2021-06-08 01:23:25 +05:30
provide: {
artifactsEndpoint: gl.mrWidgetData.artifacts_endpoint,
artifactsEndpointPlaceholder: gl.mrWidgetData.artifacts_endpoint_placeholder,
2021-11-11 11:23:49 +05:30
falsePositiveDocUrl: gl.mrWidgetData.false_positive_doc_url,
canViewFalsePositive: parseBoolean(gl.mrWidgetData.can_view_false_positive),
2021-06-08 01:23:25 +05:30
},
2021-03-08 18:12:59 +05:30
...MrWidgetOptions,
apolloProvider,
});
2017-08-17 22:00:37 +05:30
window.gl.mrWidget = {
checkStatus: vm.checkStatus,
};
2018-03-27 19:54:05 +05:30
};