2021-09-04 01:27:46 +05:30
|
|
|
import Vue from 'vue';
|
|
|
|
import VueApollo from 'vue-apollo';
|
|
|
|
import createDefaultClient from '~/lib/graphql';
|
2021-10-27 15:23:28 +05:30
|
|
|
import GroupRunnersApp from './group_runners_app.vue';
|
2021-09-04 01:27:46 +05:30
|
|
|
|
|
|
|
Vue.use(VueApollo);
|
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
export const initGroupRunners = (selector = '#js-group-runners') => {
|
2021-09-04 01:27:46 +05:30
|
|
|
const el = document.querySelector(selector);
|
|
|
|
|
|
|
|
if (!el) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2021-11-11 11:23:49 +05:30
|
|
|
const {
|
|
|
|
registrationToken,
|
|
|
|
runnerInstallHelpPage,
|
|
|
|
groupId,
|
|
|
|
groupFullPath,
|
|
|
|
groupRunnersLimitedCount,
|
|
|
|
} = el.dataset;
|
2021-09-04 01:27:46 +05:30
|
|
|
|
|
|
|
const apolloProvider = new VueApollo({
|
|
|
|
defaultClient: createDefaultClient(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
assumeImmutableResults: true,
|
|
|
|
},
|
|
|
|
),
|
|
|
|
});
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
|
|
|
apolloProvider,
|
|
|
|
provide: {
|
2021-11-11 11:23:49 +05:30
|
|
|
runnerInstallHelpPage,
|
2021-10-27 15:23:28 +05:30
|
|
|
groupId,
|
2021-09-04 01:27:46 +05:30
|
|
|
},
|
|
|
|
render(h) {
|
2021-10-27 15:23:28 +05:30
|
|
|
return h(GroupRunnersApp, {
|
2021-09-04 01:27:46 +05:30
|
|
|
props: {
|
|
|
|
registrationToken,
|
2021-11-11 11:23:49 +05:30
|
|
|
groupFullPath,
|
|
|
|
groupRunnersLimitedCount: parseInt(groupRunnersLimitedCount, 10),
|
2021-09-04 01:27:46 +05:30
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|