summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/pages/projects/new/index.js
blob: 88f4db3ec08862b9cce667a86e8650301bd58256 (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
import initProjectVisibilitySelector from '../../../project_visibility';
import initProjectNew from '../../../projects/project_new';
import { __ } from '~/locale';
import { deprecatedCreateFlash as createFlash } from '~/flash';

document.addEventListener('DOMContentLoaded', () => {
  initProjectVisibilitySelector();
  initProjectNew.bindEvents();

  import(
    /* webpackChunkName: 'experiment_new_project_creation' */ '../../../projects/experiment_new_project_creation'
  )
    .then((m) => {
      const el = document.querySelector('.js-experiment-new-project-creation');

      if (!el) {
        return;
      }

      const config = {
        hasErrors: 'hasErrors' in el.dataset,
        isCiCdAvailable: 'isCiCdAvailable' in el.dataset,
        newProjectGuidelines: el.dataset.newProjectGuidelines,
      };
      m.default(el, config);
    })
    .catch(() => {
      createFlash(__('An error occurred while loading project creation UI'));
    });
});