diff --git a/src/components/projectsettings.vue b/src/components/projectsettings.vue index 81bc42b..52a2bc1 100644 --- a/src/components/projectsettings.vue +++ b/src/components/projectsettings.vue @@ -74,6 +74,21 @@ +
+
+

Change remote repository linked account

+
+
This operation will change the linked account associated with the project remote repository to the current user linked account
+
+ + +
+
{{ updateRepoLinkedAccountError }}
+
+
+
@@ -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() { diff --git a/src/util/data.js b/src/util/data.js index f5712c8..20e7512 100644 --- a/src/util/data.js +++ b/src/util/data.js @@ -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 = {