project(group)create: add private checkbox
This commit is contained in:
parent
5d6f6b8290
commit
4a7baaab02
|
@ -6,6 +6,15 @@
|
||||||
<input class="input" type="text" placeholder="Project name" v-model="projectName">
|
<input class="input" type="text" placeholder="Project name" v-model="projectName">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<div class="control">
|
||||||
|
<label class="checkbox">
|
||||||
|
<input type="checkbox" v-model="projectIsPrivate">
|
||||||
|
Private
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h4 class="title is-4">Available remote repositories</h4>
|
<h4 class="title is-4">Available remote repositories</h4>
|
||||||
<div v-for="remoteSource in remoteSources" v-bind:key="remoteSource.id">
|
<div v-for="remoteSource in remoteSources" v-bind:key="remoteSource.id">
|
||||||
<remoterepos
|
<remoterepos
|
||||||
|
@ -59,6 +68,7 @@ export default {
|
||||||
remoteSources: null,
|
remoteSources: null,
|
||||||
remoteRepos: [],
|
remoteRepos: [],
|
||||||
projectName: "",
|
projectName: "",
|
||||||
|
projectIsPrivate: false,
|
||||||
remoteRepoPath: null,
|
remoteRepoPath: null,
|
||||||
selectedRemoteSource: null
|
selectedRemoteSource: null
|
||||||
};
|
};
|
||||||
|
@ -94,10 +104,16 @@ export default {
|
||||||
}
|
}
|
||||||
let parentref = refArray.join("/");
|
let parentref = refArray.join("/");
|
||||||
|
|
||||||
|
let visibility = "public";
|
||||||
|
if (this.projectIsPrivate) {
|
||||||
|
visibility = "private";
|
||||||
|
}
|
||||||
|
|
||||||
this.startProjectLoading();
|
this.startProjectLoading();
|
||||||
let { error } = await createProject(
|
let { error } = await createProject(
|
||||||
parentref,
|
parentref,
|
||||||
this.projectName,
|
this.projectName,
|
||||||
|
visibility,
|
||||||
this.selectedRemoteSource.name,
|
this.selectedRemoteSource.name,
|
||||||
this.remoteRepoPath
|
this.remoteRepoPath
|
||||||
);
|
);
|
||||||
|
|
|
@ -11,6 +11,15 @@
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<div class="control">
|
||||||
|
<label class="checkbox">
|
||||||
|
<input type="checkbox" v-model="projectGroupIsPrivate">
|
||||||
|
Private
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="field is-grouped">
|
<div class="field is-grouped">
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<button
|
<button
|
||||||
|
@ -45,7 +54,8 @@ export default {
|
||||||
createProjectGroupError: null,
|
createProjectGroupError: null,
|
||||||
createProjectGroupLoading: false,
|
createProjectGroupLoading: false,
|
||||||
createProjectGroupLoadingTimeout: null,
|
createProjectGroupLoadingTimeout: null,
|
||||||
projectGroupName: ""
|
projectGroupName: "",
|
||||||
|
projectGroupIsPrivate: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -75,10 +85,16 @@ export default {
|
||||||
}
|
}
|
||||||
let parentref = refArray.join("/");
|
let parentref = refArray.join("/");
|
||||||
|
|
||||||
|
let visibility = "public";
|
||||||
|
if (this.projectGroupIsPrivate) {
|
||||||
|
visibility = "private";
|
||||||
|
}
|
||||||
|
|
||||||
this.startProjectGroupLoading();
|
this.startProjectGroupLoading();
|
||||||
let { error } = await createProjectGroup(
|
let { error } = await createProjectGroup(
|
||||||
parentref,
|
parentref,
|
||||||
this.projectGroupName
|
this.projectGroupName,
|
||||||
|
visibility
|
||||||
);
|
);
|
||||||
this.stopProjectGroupLoading();
|
this.stopProjectGroupLoading();
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|
|
@ -196,27 +196,27 @@ export async function userRemoteRepos(remotesourceid) {
|
||||||
return await fetch(apiurl(path));
|
return await fetch(apiurl(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function createProjectGroup(parentref, name) {
|
export async function createProjectGroup(parentref, name, visibility) {
|
||||||
let path = "/projectgroups"
|
let path = "/projectgroups"
|
||||||
let init = {
|
let init = {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
name: name,
|
name: name,
|
||||||
parent_ref: parentref,
|
parent_ref: parentref,
|
||||||
visibility: "public",
|
visibility: visibility
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return await fetch(apiurl(path), init)
|
return await fetch(apiurl(path), init)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function createProject(parentref, name, remotesourcename, remoterepopath) {
|
export async function createProject(parentref, name, visibility, remotesourcename, remoterepopath) {
|
||||||
let path = "/projects"
|
let path = "/projects"
|
||||||
let init = {
|
let init = {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
name: name,
|
name: name,
|
||||||
parent_ref: parentref,
|
parent_ref: parentref,
|
||||||
visibility: "public",
|
visibility: visibility,
|
||||||
remote_source_name: remotesourcename,
|
remote_source_name: remotesourcename,
|
||||||
repo_path: remoterepopath,
|
repo_path: remoterepopath,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue