fix: new destinations

This commit is contained in:
Andras Bacsai 2022-07-06 16:42:31 +02:00 committed by GitHub
parent 331e13b7cb
commit 52b712d90b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 13 deletions

View File

@ -43,7 +43,7 @@ export async function getDestination(request: FastifyRequest) {
const destination = await prisma.destinationDocker.findFirst({
where: { id, teams: { some: { id: teamId === '0' ? undefined : teamId } } }
});
if (!destination) {
if (!destination && id !== 'new') {
throw { status: 404, message: `Destination not found.` };
}
const settings = await listSettings();
@ -62,10 +62,7 @@ export async function getDestination(request: FastifyRequest) {
// // await saveSshKey(destination);
// payload.state = await checkContainer(engine, 'coolify-haproxy');
} else {
let containerName = 'coolify-proxy';
if (!settings.isTraefikUsed) {
containerName = 'coolify-haproxy';
}
const containerName = 'coolify-proxy';
payload.state =
destination?.engine && (await checkContainer(destination.engine, containerName));
}

View File

@ -34,18 +34,12 @@
return destination;
}
});
async function newDestination() {
const { id } = await post('/destinations/new', {});
return await goto(`/destinations/${id}`, { replaceState: true });
}
</script>
<div class="flex space-x-1 p-6 font-bold">
<div class="mr-4 text-2xl tracking-tight">{$t('index.destinations')}</div>
{#if $appSession.isAdmin}
<button
on:click={newDestination}
class="add-icon bg-sky-600 hover:bg-sky-500">
<a href="/destinations/new" class="add-icon bg-sky-600 hover:bg-sky-500">
<svg
class="w-6"
xmlns="http://www.w3.org/2000/svg"
@ -59,7 +53,7 @@
d="M12 6v6m0 0v6m0-6h6m-6 0H6"
/></svg
>
</button>
</a>
{/if}
</div>
<div class="flex-col justify-center">