debian-mirror-gitlab/app/assets/javascripts/runner/admin_runners/index.js

44 lines
1,012 B
JavaScript
Raw Normal View History

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 AdminRunnersApp from './admin_runners_app.vue';
2021-09-04 01:27:46 +05:30
Vue.use(VueApollo);
2021-10-27 15:23:28 +05:30
export const initAdminRunners = (selector = '#js-admin-runners') => {
2021-09-04 01:27:46 +05:30
const el = document.querySelector(selector);
if (!el) {
return null;
}
2021-09-30 23:02:18 +05:30
// TODO `activeRunnersCount` should be implemented using a GraphQL API
// https://gitlab.com/gitlab-org/gitlab/-/issues/333806
2021-09-04 01:27:46 +05:30
const { activeRunnersCount, registrationToken, runnerInstallHelpPage } = el.dataset;
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
{},
{
assumeImmutableResults: true,
},
),
});
return new Vue({
el,
apolloProvider,
provide: {
runnerInstallHelpPage,
},
render(h) {
2021-10-27 15:23:28 +05:30
return h(AdminRunnersApp, {
2021-09-04 01:27:46 +05:30
props: {
activeRunnersCount: parseInt(activeRunnersCount, 10),
registrationToken,
},
});
},
});
};