2021-11-11 11:23:49 +05:30
|
|
|
import { GlToast } from '@gitlab/ui';
|
2021-04-29 21:17:54 +05:30
|
|
|
import Vue from 'vue';
|
|
|
|
import VueApollo from 'vue-apollo';
|
|
|
|
import JobsTableApp from '~/jobs/components/table/jobs_table_app.vue';
|
|
|
|
import createDefaultClient from '~/lib/graphql';
|
2021-11-11 11:23:49 +05:30
|
|
|
import { parseBoolean } from '~/lib/utils/common_utils';
|
2022-05-07 20:08:51 +05:30
|
|
|
import cacheConfig from './graphql/cache_config';
|
2021-04-29 21:17:54 +05:30
|
|
|
|
|
|
|
Vue.use(VueApollo);
|
2021-11-11 11:23:49 +05:30
|
|
|
Vue.use(GlToast);
|
2021-04-29 21:17:54 +05:30
|
|
|
|
|
|
|
const apolloProvider = new VueApollo({
|
2022-05-07 20:08:51 +05:30
|
|
|
defaultClient: createDefaultClient(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
cacheConfig,
|
|
|
|
},
|
|
|
|
),
|
2021-04-29 21:17:54 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
export default (containerId = 'js-jobs-table') => {
|
|
|
|
const containerEl = document.getElementById(containerId);
|
|
|
|
|
|
|
|
if (!containerEl) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
const {
|
|
|
|
fullPath,
|
|
|
|
jobCounts,
|
|
|
|
jobStatuses,
|
|
|
|
pipelineEditorPath,
|
|
|
|
emptyStateSvgPath,
|
2021-11-11 11:23:49 +05:30
|
|
|
admin,
|
2021-06-08 01:23:25 +05:30
|
|
|
} = containerEl.dataset;
|
2021-04-29 21:17:54 +05:30
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el: containerEl,
|
|
|
|
apolloProvider,
|
|
|
|
provide: {
|
2021-06-08 01:23:25 +05:30
|
|
|
emptyStateSvgPath,
|
2021-04-29 21:17:54 +05:30
|
|
|
fullPath,
|
2021-06-08 01:23:25 +05:30
|
|
|
pipelineEditorPath,
|
2021-04-29 21:17:54 +05:30
|
|
|
jobStatuses: JSON.parse(jobStatuses),
|
|
|
|
jobCounts: JSON.parse(jobCounts),
|
2021-11-11 11:23:49 +05:30
|
|
|
admin: parseBoolean(admin),
|
2021-04-29 21:17:54 +05:30
|
|
|
},
|
|
|
|
render(createElement) {
|
|
|
|
return createElement(JobsTableApp);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|