debian-mirror-gitlab/app/assets/javascripts/create_cluster/init_create_cluster.js

36 lines
1 KiB
JavaScript
Raw Normal View History

2021-03-11 19:13:27 +05:30
import PersistentUserCallout from '~/persistent_user_callout';
2019-12-26 22:10:19 +05:30
import initGkeDropdowns from './gke_cluster';
import initGkeNamespace from './gke_cluster_namespace';
const newClusterViews = [':clusters:new', ':clusters:create_gcp', ':clusters:create_user'];
2021-03-08 18:12:59 +05:30
const isProjectLevelCluster = (page) => page.startsWith('project:clusters');
2019-12-26 22:10:19 +05:30
2021-03-08 18:12:59 +05:30
export default (document) => {
2019-12-26 22:10:19 +05:30
const { page } = document.body.dataset;
2021-03-08 18:12:59 +05:30
const isNewClusterView = newClusterViews.some((view) => page.endsWith(view));
2019-12-26 22:10:19 +05:30
if (!isNewClusterView) {
return;
}
const callout = document.querySelector('.gcp-signup-offer');
PersistentUserCallout.factory(callout);
initGkeDropdowns();
2021-03-08 18:12:59 +05:30
if (isProjectLevelCluster(page)) {
initGkeNamespace();
}
2020-01-01 13:55:28 +05:30
import(/* webpackChunkName: 'eks_cluster' */ '~/create_cluster/eks_cluster')
.then(({ default: initCreateEKSCluster }) => {
const el = document.querySelector('.js-create-eks-cluster-form-container');
2019-12-26 22:10:19 +05:30
2020-01-01 13:55:28 +05:30
if (el) {
initCreateEKSCluster(el);
}
})
.catch(() => {});
2019-12-26 22:10:19 +05:30
};