fix: git deployments

This commit is contained in:
Arman
2025-03-13 15:41:26 +01:00
parent 0a999e8be1
commit e819b2d62a
3 changed files with 18 additions and 15 deletions
+2
View File
@@ -30,6 +30,8 @@ export function deploymentStatusConverter(status: string) {
return 'waiting';
case 'queued':
return 'waiting';
case 'cancelled':
return 'failed';
case 'failed':
return 'failed';
}
@@ -142,7 +142,10 @@
{/if}
{#if showCreateDeployment}
<CreateGitDeploymentModal bind:show={showCreateDeployment} site={data.site} />
<CreateGitDeploymentModal
bind:show={showCreateDeployment}
site={data.site}
installations={data.installations} />
{/if}
{#if showConnectManual}
<CreateManualDeploymentModal bind:show={showConnectManual} site={data.site} />
@@ -16,7 +16,7 @@
export let show = false;
export let site: Models.Site;
let installations = { installations: [], total: 0 };
export let installations: Models.InstallationList;
let hasRepository = !!site?.providerRepositoryId;
let selectedRepository: string = site.providerRepositoryId;
let branch: string = null;
@@ -25,19 +25,14 @@
let error = '';
async function loadInstallations() {
try {
installations = await sdk.forProject.vcs.listInstallations();
if (!site?.installationId && installations.total > 0) {
installation.set(installations.installations[0]);
}
$installation = installations.installations.find(
(installation) => installation.$id === site.installationId
);
if (!$installation?.$id) {
$installation = installations.installations[0];
}
} catch (error) {
console.log(error);
if (!site?.installationId && installations?.total > 0) {
installation.set(installations.installations[0]);
}
$installation = installations.installations.find(
(installation) => installation.$id === site.installationId
);
if (!$installation?.$id) {
$installation = installations.installations[0];
}
}
@@ -50,6 +45,7 @@
site.providerRepositoryId
);
}
selectedRepository = $repository?.id;
const branchList = await sdk.forProject.vcs.listRepositoryBranches(
$installation.$id,
selectedRepository
@@ -98,6 +94,8 @@
error = e.message;
}
}
$: console.log($repository);
</script>
<Modal title="Create Git deployment" bind:show onSubmit={createDeployment} bind:error>