feat: Autodeploy pause

This commit is contained in:
Andras Bacsai
2022-03-11 22:36:21 +01:00
parent 7c273a3a48
commit fa6cf068c7
10 changed files with 127 additions and 30 deletions

View File

@@ -28,6 +28,8 @@
branch: undefined
};
let showSave = false;
let autodeploy = application.settings.autodeploy || true;
async function loadRepositoriesByPage(page = 0) {
return await get(`${apiUrl}/installation/repositories?per_page=100&page=${page}`, {
Authorization: `token ${$gitTokens.githubToken}`
@@ -69,7 +71,14 @@
`/applications/${id}/configuration/repository.json?repository=${selected.repository}&branch=${selected.branch}`
);
if (data.used) {
errorNotification('This branch is already used by another application.');
const sure = confirm(
`This branch is already used by another application. Webhooks won't work in this case for both applications. Are you sure you want to use it?`
);
if (sure) {
autodeploy = false;
showSave = true;
return true;
}
showSave = false;
return true;
}
@@ -172,7 +181,7 @@
class="w-96"
disabled={!selected.repository}
bind:value={selected.branch}
on:change={() => (showSave = true)}
on:change={isBranchAlreadyUsed}
>
{#if !selected.repository}
<option value="" disabled selected>Select a repository first</option>