summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/clusters/agents/index.js
blob: 5796c9e308da92b90037e402453c3cb78bce3fe7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql';
import AgentShowPage from 'ee_else_ce/clusters/agents/components/show.vue';

Vue.use(VueApollo);

export default () => {
  const el = document.querySelector('#js-cluster-agent-details');

  if (!el) {
    return null;
  }

  const defaultClient = createDefaultClient();
  const { agentName, projectPath, activityEmptyStateImage } = el.dataset;

  return new Vue({
    el,
    apolloProvider: new VueApollo({ defaultClient }),
    provide: { agentName, projectPath, activityEmptyStateImage },
    render(createElement) {
      return createElement(AgentShowPage, {
        props: {
          agentName,
          projectPath,
        },
      });
    },
  });
};