debian-mirror-gitlab/app/assets/javascripts/projects/new/index.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

92 lines
2.2 KiB
JavaScript
Raw Normal View History

2021-11-18 22:05:49 +05:30
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql';
import { parseBoolean } from '~/lib/utils/common_utils';
import NewProjectCreationApp from './components/app.vue';
import NewProjectUrlSelect from './components/new_project_url_select.vue';
2022-04-04 11:22:00 +05:30
import DeploymentTargetSelect from './components/deployment_target_select.vue';
2021-11-18 22:05:49 +05:30
export function initNewProjectCreation() {
const el = document.querySelector('.js-new-project-creation');
const {
pushToCreateProjectCommand,
workingWithProjectsHelpPath,
newProjectGuidelines,
hasErrors,
isCiCdAvailable,
2023-05-27 22:25:52 +05:30
parentGroupUrl,
parentGroupName,
projectsUrl,
2023-06-20 00:43:36 +05:30
rootPath,
2023-05-27 22:25:52 +05:30
canImportProjects,
2021-11-18 22:05:49 +05:30
} = el.dataset;
const props = {
hasErrors: parseBoolean(hasErrors),
isCiCdAvailable: parseBoolean(isCiCdAvailable),
newProjectGuidelines,
2023-05-27 22:25:52 +05:30
parentGroupUrl,
parentGroupName,
projectsUrl,
2023-06-20 00:43:36 +05:30
rootPath,
2023-05-27 22:25:52 +05:30
canImportProjects: parseBoolean(canImportProjects),
2021-11-18 22:05:49 +05:30
};
const provide = {
workingWithProjectsHelpPath,
pushToCreateProjectCommand,
};
return new Vue({
el,
provide,
render(h) {
return h(NewProjectCreationApp, { props });
},
});
}
export function initNewProjectUrlSelect() {
const elements = document.querySelectorAll('.js-vue-new-project-url-select');
if (!elements.length) {
return;
}
Vue.use(VueApollo);
elements.forEach(
(el) =>
new Vue({
el,
apolloProvider: new VueApollo({
2021-12-11 22:18:48 +05:30
defaultClient: createDefaultClient(),
2021-11-18 22:05:49 +05:30
}),
provide: {
namespaceFullPath: el.dataset.namespaceFullPath,
namespaceId: el.dataset.namespaceId,
rootUrl: el.dataset.rootUrl,
trackLabel: el.dataset.trackLabel,
userNamespaceId: el.dataset.userNamespaceId,
2023-03-04 22:38:38 +05:30
inputId: el.dataset.inputId,
inputName: el.dataset.inputName,
2021-11-18 22:05:49 +05:30
},
render: (createElement) => createElement(NewProjectUrlSelect),
}),
);
}
2022-04-04 11:22:00 +05:30
export function initDeploymentTargetSelect() {
const el = document.querySelector('.js-deployment-target-select');
if (!el) {
return null;
}
return new Vue({
el,
render: (createElement) => createElement(DeploymentTargetSelect),
});
}