summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/projects/prune_objects_button.js
blob: dba73f6a19d993d6486aedde8158e29b4f884a1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import Vue from 'vue';
import PruneUnreachableObjectsButton from './prune_unreachable_objects_button.vue';

export default (selector = '#js-project-prune-unreachable-objects-button') => {
  const el = document.querySelector(selector);

  if (!el) return;

  const { pruneObjectsPath, pruneObjectsDocPath } = el.dataset;

  // eslint-disable-next-line no-new
  new Vue({
    el,
    render(createElement) {
      return createElement(PruneUnreachableObjectsButton, {
        props: {
          pruneObjectsPath,
          pruneObjectsDocPath,
        },
      });
    },
  });
};