2022-04-08 08:08:48 -04:00
|
|
|
import '~/webpack';
|
2021-06-16 14:10:35 -04:00
|
|
|
|
2021-01-05 07:10:36 -05:00
|
|
|
import setConfigs from '@gitlab/ui/dist/config';
|
2021-02-14 13:09:20 -05:00
|
|
|
import Vue from 'vue';
|
2021-01-05 07:10:36 -05:00
|
|
|
import GlFeatureFlagsPlugin from '~/vue_shared/gl_feature_flags_plugin';
|
2021-02-14 13:09:20 -05:00
|
|
|
import Translate from '~/vue_shared/translate';
|
2021-01-05 07:10:36 -05:00
|
|
|
|
2021-02-01 10:08:56 -05:00
|
|
|
import JiraConnectApp from './components/app.vue';
|
2021-01-13 04:10:52 -05:00
|
|
|
import createStore from './store';
|
2021-12-02 04:10:59 -05:00
|
|
|
import { sizeToParent } from './utils';
|
2020-11-05 13:08:48 -05:00
|
|
|
|
2021-12-02 04:10:59 -05:00
|
|
|
export function initJiraConnect() {
|
2021-02-02 07:10:15 -05:00
|
|
|
const el = document.querySelector('.js-jira-connect-app');
|
2021-01-05 07:10:36 -05:00
|
|
|
if (!el) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
setConfigs();
|
|
|
|
Vue.use(Translate);
|
|
|
|
Vue.use(GlFeatureFlagsPlugin);
|
|
|
|
|
2022-03-10 22:08:14 -05:00
|
|
|
const {
|
|
|
|
groupsPath,
|
|
|
|
subscriptions,
|
2022-05-04 14:08:35 -04:00
|
|
|
addSubscriptionsPath,
|
2022-03-10 22:08:14 -05:00
|
|
|
subscriptionsPath,
|
|
|
|
usersPath,
|
|
|
|
gitlabUserPath,
|
|
|
|
oauthMetadata,
|
|
|
|
} = el.dataset;
|
2021-04-14 11:09:04 -04:00
|
|
|
sizeToParent();
|
2021-01-18 10:10:42 -05:00
|
|
|
|
2022-05-04 14:08:35 -04:00
|
|
|
const store = createStore({ subscriptions: JSON.parse(subscriptions) });
|
|
|
|
|
2020-11-05 13:08:48 -05:00
|
|
|
return new Vue({
|
|
|
|
el,
|
2021-01-13 04:10:52 -05:00
|
|
|
store,
|
2021-01-18 10:10:42 -05:00
|
|
|
provide: {
|
|
|
|
groupsPath,
|
2022-05-04 14:08:35 -04:00
|
|
|
addSubscriptionsPath,
|
2021-01-25 13:09:03 -05:00
|
|
|
subscriptionsPath,
|
2021-01-28 16:09:04 -05:00
|
|
|
usersPath,
|
2021-12-02 04:10:59 -05:00
|
|
|
gitlabUserPath,
|
2022-03-10 22:08:14 -05:00
|
|
|
oauthMetadata: oauthMetadata ? JSON.parse(oauthMetadata) : null,
|
2021-01-18 10:10:42 -05:00
|
|
|
},
|
2020-11-05 13:08:48 -05:00
|
|
|
render(createElement) {
|
2021-01-18 10:10:42 -05:00
|
|
|
return createElement(JiraConnectApp);
|
2020-11-05 13:08:48 -05:00
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-03-22 08:07:28 -04:00
|
|
|
initJiraConnect();
|