diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-21 18:09:27 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-21 18:09:27 +0000 |
commit | bd7e8cd64b1eb9b2d5aa2f83e547d2a5b519b26c (patch) | |
tree | 292f1690eec2707d091ede0188706ec92da16427 /app/assets/javascripts/runner/admin_runners/index.js | |
parent | a8f5aaa7081cc2d400fbac1106d9e94d02d70ab4 (diff) | |
download | gitlab-ce-bd7e8cd64b1eb9b2d5aa2f83e547d2a5b519b26c.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/runner/admin_runners/index.js')
-rw-r--r-- | app/assets/javascripts/runner/admin_runners/index.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/app/assets/javascripts/runner/admin_runners/index.js b/app/assets/javascripts/runner/admin_runners/index.js new file mode 100644 index 00000000000..1eec1019b73 --- /dev/null +++ b/app/assets/javascripts/runner/admin_runners/index.js @@ -0,0 +1,43 @@ +import Vue from 'vue'; +import VueApollo from 'vue-apollo'; +import createDefaultClient from '~/lib/graphql'; +import AdminRunnersApp from './admin_runners_app.vue'; + +Vue.use(VueApollo); + +export const initAdminRunners = (selector = '#js-admin-runners') => { + const el = document.querySelector(selector); + + if (!el) { + return null; + } + + // TODO `activeRunnersCount` should be implemented using a GraphQL API + // https://gitlab.com/gitlab-org/gitlab/-/issues/333806 + const { activeRunnersCount, registrationToken, runnerInstallHelpPage } = el.dataset; + + const apolloProvider = new VueApollo({ + defaultClient: createDefaultClient( + {}, + { + assumeImmutableResults: true, + }, + ), + }); + + return new Vue({ + el, + apolloProvider, + provide: { + runnerInstallHelpPage, + }, + render(h) { + return h(AdminRunnersApp, { + props: { + activeRunnersCount: parseInt(activeRunnersCount, 10), + registrationToken, + }, + }); + }, + }); +}; |