2021-02-01 10:08:56 -05:00
|
|
|
import PersistentUserCallout from '~/persistent_user_callout';
|
2019-11-01 17:06:43 -04:00
|
|
|
import initGkeDropdowns from './gke_cluster';
|
|
|
|
import initGkeNamespace from './gke_cluster_namespace';
|
|
|
|
|
|
|
|
const newClusterViews = [':clusters:new', ':clusters:create_gcp', ':clusters:create_user'];
|
|
|
|
|
2020-12-23 16:10:24 -05:00
|
|
|
const isProjectLevelCluster = (page) => page.startsWith('project:clusters');
|
2019-11-01 17:06:43 -04:00
|
|
|
|
2020-12-23 16:10:24 -05:00
|
|
|
export default (document) => {
|
2019-11-01 17:06:43 -04:00
|
|
|
const { page } = document.body.dataset;
|
2020-12-23 16:10:24 -05:00
|
|
|
const isNewClusterView = newClusterViews.some((view) => page.endsWith(view));
|
2019-11-01 17:06:43 -04:00
|
|
|
|
|
|
|
if (!isNewClusterView) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const callout = document.querySelector('.gcp-signup-offer');
|
|
|
|
PersistentUserCallout.factory(callout);
|
|
|
|
|
|
|
|
initGkeDropdowns();
|
|
|
|
|
2021-01-15 07:10:42 -05:00
|
|
|
if (isProjectLevelCluster(page)) {
|
|
|
|
initGkeNamespace();
|
|
|
|
}
|
|
|
|
|
2019-11-26 19:06:23 -05:00
|
|
|
import(/* webpackChunkName: 'eks_cluster' */ '~/create_cluster/eks_cluster')
|
|
|
|
.then(({ default: initCreateEKSCluster }) => {
|
|
|
|
const el = document.querySelector('.js-create-eks-cluster-form-container');
|
2019-11-01 17:06:43 -04:00
|
|
|
|
2019-11-26 19:06:23 -05:00
|
|
|
if (el) {
|
|
|
|
initCreateEKSCluster(el);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(() => {});
|
2019-11-01 17:06:43 -04:00
|
|
|
};
|