diff options
Diffstat (limited to 'app/assets/javascripts/pages/projects/ci/lints/show/index.js')
-rw-r--r-- | app/assets/javascripts/pages/projects/ci/lints/show/index.js | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/app/assets/javascripts/pages/projects/ci/lints/show/index.js b/app/assets/javascripts/pages/projects/ci/lints/show/index.js index 8e8a843da0b..957801320c9 100644 --- a/app/assets/javascripts/pages/projects/ci/lints/show/index.js +++ b/app/assets/javascripts/pages/projects/ci/lints/show/index.js @@ -1,3 +1,17 @@ -import CILintEditor from '../ci_lint_editor'; +import createFlash from '~/flash'; +import { __ } from '~/locale'; -document.addEventListener('DOMContentLoaded', () => new CILintEditor()); +const ERROR = __('An error occurred while rendering the linter'); + +document.addEventListener('DOMContentLoaded', () => { + if (gon?.features?.ciLintVue) { + import(/* webpackChunkName: 'ciLintIndex' */ '~/ci_lint/index') + .then(module => module.default()) + .catch(() => createFlash(ERROR)); + } else { + import(/* webpackChunkName: 'ciLintEditor' */ '../ci_lint_editor') + // eslint-disable-next-line new-cap + .then(module => new module.default()) + .catch(() => createFlash(ERROR)); + } +}); |