diff options
Diffstat (limited to 'app/assets/javascripts/runner/group_runners/index.js')
-rw-r--r-- | app/assets/javascripts/runner/group_runners/index.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/app/assets/javascripts/runner/group_runners/index.js b/app/assets/javascripts/runner/group_runners/index.js new file mode 100644 index 00000000000..e14c583d73e --- /dev/null +++ b/app/assets/javascripts/runner/group_runners/index.js @@ -0,0 +1,40 @@ +import Vue from 'vue'; +import VueApollo from 'vue-apollo'; +import createDefaultClient from '~/lib/graphql'; +import GroupRunnersApp from './group_runners_app.vue'; + +Vue.use(VueApollo); + +export const initGroupRunners = (selector = '#js-group-runners') => { + const el = document.querySelector(selector); + + if (!el) { + return null; + } + + const { registrationToken, groupId } = el.dataset; + + const apolloProvider = new VueApollo({ + defaultClient: createDefaultClient( + {}, + { + assumeImmutableResults: true, + }, + ), + }); + + return new Vue({ + el, + apolloProvider, + provide: { + groupId, + }, + render(h) { + return h(GroupRunnersApp, { + props: { + registrationToken, + }, + }); + }, + }); +}; |