40 lines
997 B
JavaScript
40 lines
997 B
JavaScript
import { defaultDataIdFromObject } from 'apollo-cache-inmemory';
|
|
import Vue from 'vue';
|
|
import VueApollo from 'vue-apollo';
|
|
import createDefaultClient from '~/lib/graphql';
|
|
import TerraformList from './components/terraform_list.vue';
|
|
import resolvers from './graphql/resolvers';
|
|
|
|
Vue.use(VueApollo);
|
|
|
|
export default () => {
|
|
const el = document.querySelector('#js-terraform-list');
|
|
|
|
if (!el) {
|
|
return null;
|
|
}
|
|
|
|
const defaultClient = createDefaultClient(resolvers, {
|
|
cacheConfig: {
|
|
dataIdFromObject: (object) => {
|
|
return object.id || defaultDataIdFromObject(object);
|
|
},
|
|
},
|
|
});
|
|
|
|
const { emptyStateImage, projectPath } = el.dataset;
|
|
|
|
return new Vue({
|
|
el,
|
|
apolloProvider: new VueApollo({ defaultClient }),
|
|
render(createElement) {
|
|
return createElement(TerraformList, {
|
|
props: {
|
|
emptyStateImage,
|
|
projectPath,
|
|
terraformAdmin: el.hasAttribute('data-terraform-admin'),
|
|
},
|
|
});
|
|
},
|
|
});
|
|
};
|