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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

57 lines
1.3 KiB
JavaScript
Raw Normal View History

2021-12-11 22:18:48 +05:30
import { GlToast } from '@gitlab/ui';
2021-09-04 01:27:46 +05:30
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql';
2022-11-25 23:54:43 +05:30
import { createLocalState } from '../graphql/list/local_state';
2021-10-27 15:23:28 +05:30
import GroupRunnersApp from './group_runners_app.vue';
2021-09-04 01:27:46 +05:30
2021-12-11 22:18:48 +05:30
Vue.use(GlToast);
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,
2022-06-21 17:19:12 +05:30
onlineContactTimeoutSecs,
staleTimeoutSecs,
2022-07-23 23:45:48 +05:30
emptyStateSvgPath,
emptyStateFilteredSvgPath,
2021-11-11 11:23:49 +05:30
} = el.dataset;
2021-09-04 01:27:46 +05:30
2022-11-25 23:54:43 +05:30
const { cacheConfig, typeDefs, localMutations } = createLocalState();
2021-09-04 01:27:46 +05:30
const apolloProvider = new VueApollo({
2022-11-25 23:54:43 +05:30
defaultClient: createDefaultClient({}, { cacheConfig, typeDefs }),
2021-09-04 01:27:46 +05:30
});
return new Vue({
el,
apolloProvider,
provide: {
2021-11-11 11:23:49 +05:30
runnerInstallHelpPage,
2022-11-25 23:54:43 +05:30
localMutations,
2021-10-27 15:23:28 +05:30
groupId,
2022-06-21 17:19:12 +05:30
onlineContactTimeoutSecs: parseInt(onlineContactTimeoutSecs, 10),
staleTimeoutSecs: parseInt(staleTimeoutSecs, 10),
2022-07-23 23:45:48 +05:30
emptyStateSvgPath,
emptyStateFilteredSvgPath,
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,
2021-09-04 01:27:46 +05:30
},
});
},
});
};