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">
|
||||
</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>
|
||||
<div v-for="remoteSource in remoteSources" v-bind:key="remoteSource.id">
|
||||
<remoterepos
|
||||
|
@ -59,6 +68,7 @@ export default {
|
|||
remoteSources: null,
|
||||
remoteRepos: [],
|
||||
projectName: "",
|
||||
projectIsPrivate: false,
|
||||
remoteRepoPath: null,
|
||||
selectedRemoteSource: null
|
||||
};
|
||||
|
@ -94,10 +104,16 @@ export default {
|
|||
}
|
||||
let parentref = refArray.join("/");
|
||||
|
||||
let visibility = "public";
|
||||
if (this.projectIsPrivate) {
|
||||
visibility = "private";
|
||||
}
|
||||
|
||||
this.startProjectLoading();
|
||||
let { error } = await createProject(
|
||||
parentref,
|
||||
this.projectName,
|
||||
visibility,
|
||||
this.selectedRemoteSource.name,
|
||||
this.remoteRepoPath
|
||||
);
|
||||
|
|
|
@ -11,6 +11,15 @@
|
|||
>
|
||||
</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="control">
|
||||
<button
|
||||
|
@ -45,7 +54,8 @@ export default {
|
|||
createProjectGroupError: null,
|
||||
createProjectGroupLoading: false,
|
||||
createProjectGroupLoadingTimeout: null,
|
||||
projectGroupName: ""
|
||||
projectGroupName: "",
|
||||
projectGroupIsPrivate: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
@ -75,10 +85,16 @@ export default {
|
|||
}
|
||||
let parentref = refArray.join("/");
|
||||
|
||||
let visibility = "public";
|
||||
if (this.projectGroupIsPrivate) {
|
||||
visibility = "private";
|
||||
}
|
||||
|
||||
this.startProjectGroupLoading();
|
||||
let { error } = await createProjectGroup(
|
||||
parentref,
|
||||
this.projectGroupName
|
||||
this.projectGroupName,
|
||||
visibility
|
||||
);
|
||||
this.stopProjectGroupLoading();
|
||||
if (error) {
|
||||
|
|
|
@ -196,27 +196,27 @@ export async function userRemoteRepos(remotesourceid) {
|
|||
return await fetch(apiurl(path));
|
||||
}
|
||||
|
||||
export async function createProjectGroup(parentref, name) {
|
||||
export async function createProjectGroup(parentref, name, visibility) {
|
||||
let path = "/projectgroups"
|
||||
let init = {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
name: name,
|
||||
parent_ref: parentref,
|
||||
visibility: "public",
|
||||
visibility: visibility
|
||||
})
|
||||
}
|
||||
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 init = {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
name: name,
|
||||
parent_ref: parentref,
|
||||
visibility: "public",
|
||||
visibility: visibility,
|
||||
remote_source_name: remotesourcename,
|
||||
repo_path: remoterepopath,
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue