projectsettings: add update project repo linked account

This commit is contained in:
Simone Gotti 2019-05-19 17:34:53 +02:00
parent 449096c0a3
commit 6d0899681c
2 changed files with 42 additions and 1 deletions

View File

@ -74,6 +74,21 @@
</div>
</div>
</div>
<div class="panel-block is-block">
<div>
<h4 class="title is-4">Change remote repository linked account</h4>
<div class="message is-danger">
<div
class="message-body"
>This operation will change the linked account associated with the project remote repository to the current user linked account</div>
</div>
<button class="button is-danger" @click="updateRepoLinkedAccount()">Change</button>
<div v-if="updateRepoLinkedAccountError" class="message is-danger">
<div class="message-body">{{ updateRepoLinkedAccountError }}</div>
</div>
</div>
</div>
</nav>
</div>
</template>
@ -83,7 +98,8 @@ import {
fetchProject,
fetchVariables,
updateProject,
deleteProject
deleteProject,
projectUpdateRepoLinkedAccount
} from "@/util/data.js";
import { projectGroupLink } from "@/util/link.js";
@ -102,6 +118,7 @@ export default {
return {
updateProjectError: null,
deleteProjectError: null,
updateRepoLinkedAccountError: null,
project: null,
projectIsPrivate: false,
variables: [],
@ -124,6 +141,7 @@ export default {
resetErrors() {
this.updateProjectError = null;
this.deleteProjectError = null;
this.updateRepoLinkedAccountError = null;
},
async updateProject() {
this.resetErrors();
@ -171,6 +189,21 @@ export default {
)
);
}
},
async updateRepoLinkedAccount() {
this.resetErrors();
let projectref = [
this.ownertype,
this.ownername,
...this.projectref
].join("/");
let { error } = await projectUpdateRepoLinkedAccount(projectref);
if (error) {
this.updateRepoLinkedAccountError = error;
return;
}
}
},
created: async function() {

View File

@ -286,6 +286,14 @@ export async function deleteProject(projectref) {
return await fetch(apiurl(path), init)
}
export async function projectUpdateRepoLinkedAccount(projectref) {
let path = "/projects/" + encodeURIComponent(projectref) + "/updaterepolinkedaccount"
let init = {
method: "PUT",
}
return await fetch(apiurl(path), init)
}
export async function deleteProjectGroup(projectgroupref) {
let path = "/projectgroups/" + encodeURIComponent(projectgroupref)
let init = {