Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: selectable destinations

Andras Bacsaib5b7338e92df
diff --git a/apps/api/src/routes/api/v1/destinations/handlers.ts b/apps/api/src/routes/api/v1/destinations/handlers.ts
index b5cd6baa4f..82857d5e08 100644
--- a/apps/api/src/routes/api/v1/destinations/handlers.ts
+++ b/apps/api/src/routes/api/v1/destinations/handlers.ts
@@ -6,11 +6,12 @@ import { asyncExecShell, decrypt, errorHandler, executeDockerCmd, listSettings,
import { checkContainer, dockerInstance, getEngine } from '../../../../lib/docker';
import type { OnlyId } from '../../../../types';
-import type { CheckDestination, NewDestination, Proxy, SaveDestinationSettings } from './types';
+import type { CheckDestination, ListDestinations, NewDestination, Proxy, SaveDestinationSettings } from './types';
-export async function listDestinations(request: FastifyRequest) {
+export async function listDestinations(request: FastifyRequest<ListDestinations>) {
try {
const teamId = request.user.teamId;
+ const { onlyVerified = false } = request.query
let destinations = []
if (teamId === '0') {
destinations = await prisma.destinationDocker.findMany({ include: { teams: true } });
@@ -20,6 +21,9 @@ export async function listDestinations(request: FastifyRequest) {
include: { teams: true }
});
}
+ if (onlyVerified) {
+ destinations = destinations.filter(destination => destination.engine || (destination.remoteEngine && destination.remoteVerified))
+ }
return {
destinations
}
@@ -163,7 +167,7 @@ export async function startProxy(request: FastifyRequest<Proxy>) {
await startTraefikProxy(id);
return {}
} catch ({ status, message }) {
- console.log({status, message})
+ console.log({ status, message })
await stopTraefikProxy(id);
return errorHandler({ status, message })
}
diff --git a/apps/api/src/routes/api/v1/destinations/index.ts b/apps/api/src/routes/api/v1/destinations/index.ts
index 3be168f295..007242695b 100644
--- a/apps/api/src/routes/api/v1/destinations/index.ts
+++ b/apps/api/src/routes/api/v1/destinations/index.ts
@@ -2,13 +2,13 @@ import { FastifyPluginAsync } from 'fastify';
import { assignSSHKey, checkDestination, deleteDestination, getDestination, getDestinationStatus, listDestinations, newDestination, restartProxy, saveDestinationSettings, startProxy, stopProxy, verifyRemoteDockerEngine } from './handlers';
import type { OnlyId } from '../../../../types';
-import type { CheckDestination, NewDestination, Proxy, SaveDestinationSettings } from './types';
+import type { CheckDestination, ListDestinations, NewDestination, Proxy, SaveDestinationSettings } from './types';
const root: FastifyPluginAsync = async (fastify): Promise<void> => {
fastify.addHook('onRequest', async (request) => {
return await request.jwtVerify()
})
- fastify.get('/', async (request) => await listDestinations(request));
+ fastify.get<ListDestinations>('/', async (request) => await listDestinations(request));
fastify.post<CheckDestination>('/check', async (request) => await checkDestination(request));
fastify.get<OnlyId>('/:id', async (request) => await getDestination(request));
diff --git a/apps/api/src/routes/api/v1/destinations/types.ts b/apps/api/src/routes/api/v1/destinations/types.ts
index d95c215b5c..fe27422181 100644
--- a/apps/api/src/routes/api/v1/destinations/types.ts
+++ b/apps/api/src/routes/api/v1/destinations/types.ts
@@ -1,5 +1,10 @@
import { OnlyId } from "../../../../types"
+export interface ListDestinations {
+ Querystring: {
+ onlyVerified: string
+ }
+}
export interface CheckDestination {
Body: {
network: string
diff --git a/apps/ui/src/routes/applications/[id]/configuration/destination.svelte b/apps/ui/src/routes/applications/[id]/configuration/destination.svelte
index b7d9eea998..2bfe98a5c5 100644
--- a/apps/ui/src/routes/applications/[id]/configuration/destination.svelte
+++ b/apps/ui/src/routes/applications/[id]/configuration/destination.svelte
@@ -9,7 +9,7 @@
redirect: `/applications/${params.id}`
};
}
- const response = await get(`/destinations`);
+ const response = await get(`/destinations?onlyVerified=true`);
return {
props: {
...response
@@ -65,7 +65,7 @@
<div class="flex flex-col justify-center">
{#if !destinations || ownDestinations.length === 0}
<div class="flex-col">
- <div class="pb-2">{$t('application.configuration.no_configurable_destination')}</div>
+ <div class="pb-2 text-center font-bold">{$t('application.configuration.no_configurable_destination')}</div>
<div class="flex justify-center">
<a href="/new/destination" sveltekit:prefetch class="add-icon bg-sky-600 hover:bg-sky-500">
<svg
diff --git a/apps/ui/src/routes/applications/index.svelte b/apps/ui/src/routes/applications/index.svelte
index e24ecaf729..ba9426892b 100644
--- a/apps/ui/src/routes/applications/index.svelte
+++ b/apps/ui/src/routes/applications/index.svelte
@@ -93,7 +93,7 @@
<div class="flex flex-col">
<div class="flex flex-col flex-wrap justify-center px-2 md:flex-row">
{#each ownApplications as application}
- <a href="/applications/{application.id}" class="w-96 p-2 no-underline">
+ <a href="/applications/{application.id}" class="p-2 no-underline">
<div class="box-selection group relative hover:bg-green-600">
{#if application.buildPack}
{#if application.buildPack.toLowerCase() === 'rust'}
diff --git a/apps/ui/src/routes/databases/[id]/configuration/destination.svelte b/apps/ui/src/routes/databases/[id]/configuration/destination.svelte
index 5f0b78c259..af554639ea 100644
--- a/apps/ui/src/routes/databases/[id]/configuration/destination.svelte
+++ b/apps/ui/src/routes/databases/[id]/configuration/destination.svelte
@@ -9,7 +9,7 @@
redirect: `/database/${params.id}`
};
}
- const response = await get(`/destinations`);
+ const response = await get(`/destinations?onlyVerified=true`);
return {
props: {
...response
@@ -55,7 +55,7 @@
<div class="flex justify-center">
{#if !destinations || destinations.length === 0}
<div class="flex-col">
- <div class="pb-2">{$t('application.configuration.no_configurable_destination')}</div>
+ <div class="pb-2 text-center font-bold">{$t('application.configuration.no_configurable_destination')}</div>
<div class="flex justify-center">
<a href="/new/destination" sveltekit:prefetch class="add-icon bg-sky-600 hover:bg-sky-500">
<svg
diff --git a/apps/ui/src/routes/databases/index.svelte b/apps/ui/src/routes/databases/index.svelte
index e7881343cc..233fde31c1 100644
--- a/apps/ui/src/routes/databases/index.svelte
+++ b/apps/ui/src/routes/databases/index.svelte
@@ -77,7 +77,7 @@
<div class="flex flex-col">
<div class="flex flex-col flex-wrap justify-center px-2 md:flex-row">
{#each ownDatabases as database}
- <a href="/databases/{database.id}" class="w-96 p-2 no-underline">
+ <a href="/databases/{database.id}" class="p-2 no-underline">
<div class="box-selection group relative hover:bg-purple-600">
{#if database.type === 'clickhouse'}
<Clickhouse isAbsolute />
diff --git a/apps/ui/src/routes/destinations/[id]/configuration/sshkey.svelte b/apps/ui/src/routes/destinations/[id]/configuration/sshkey.svelte
index b9f72ad57c..0db8cd0c48 100644
--- a/apps/ui/src/routes/destinations/[id]/configuration/sshkey.svelte
+++ b/apps/ui/src/routes/destinations/[id]/configuration/sshkey.svelte
@@ -39,7 +39,7 @@
</script>
<div class="flex space-x-1 p-6 font-bold">
- <div class="mr-4 text-2xl tracking-tight">SSH Keys</div>
+ <div class="mr-4 text-2xl tracking-tight">Select a SSH Keys</div>
</div>
<div class="flex flex-col justify-center">
<div class="flex flex-col flex-wrap justify-center px-2 md:flex-row ">
diff --git a/apps/ui/src/routes/destinations/index.svelte b/apps/ui/src/routes/destinations/index.svelte
index 1fc4e6dd9b..1b1f89e1dc 100644
--- a/apps/ui/src/routes/destinations/index.svelte
+++ b/apps/ui/src/routes/destinations/index.svelte
@@ -66,7 +66,7 @@
<div class="flex flex-col">
<div class="flex flex-col flex-wrap justify-center px-2 md:flex-row">
{#each ownDestinations as destination}
- <a href="/destinations/{destination.id}" class="w-96 p-2 no-underline">
+ <a href="/destinations/{destination.id}" class="p-2 no-underline">
<div class="box-selection hover:bg-sky-600">
<div class="truncate text-center text-xl font-bold">{destination.name}</div>
{#if $appSession.teamId === '0' && otherDestinations.length > 0}
diff --git a/apps/ui/src/routes/services/[id]/configuration/destination.svelte b/apps/ui/src/routes/services/[id]/configuration/destination.svelte
index cd0d916d75..47fb93db69 100644
--- a/apps/ui/src/routes/services/[id]/configuration/destination.svelte
+++ b/apps/ui/src/routes/services/[id]/configuration/destination.svelte
@@ -9,7 +9,7 @@
redirect: `/services/${params.id}`
};
}
- const response = await get(`/destinations`);
+ const response = await get(`/destinations?onlyVerified=true`);
return {
props: {
...response
@@ -54,7 +54,7 @@
<div class="flex justify-center">
{#if !destinations || destinations.length === 0}
<div class="flex-col">
- <div class="pb-2">{$t('application.configuration.no_configurable_destination')}</div>
+ <div class="pb-2 text-center font-bold">{$t('application.configuration.no_configurable_destination')}</div>
<div class="flex justify-center">
<a href="/new/destination" sveltekit:prefetch class="add-icon bg-sky-600 hover:bg-sky-500">
<svg
diff --git a/apps/ui/src/routes/services/index.svelte b/apps/ui/src/routes/services/index.svelte
index a32e117110..9bc177b98b 100644
--- a/apps/ui/src/routes/services/index.svelte
+++ b/apps/ui/src/routes/services/index.svelte
@@ -73,7 +73,7 @@
<div class="flex flex-col">
<div class="flex flex-col flex-wrap justify-center px-2 md:flex-row">
{#each ownServices as service}
- <a href="/services/{service.id}" class="w-96 p-2 no-underline">
+ <a href="/services/{service.id}" class=" p-2 no-underline">
<div class="box-selection group relative hover:bg-pink-600">
<Services type={service.type} />
<div class="truncate text-center text-xl font-bold">
diff --git a/apps/ui/src/routes/sources/index.svelte b/apps/ui/src/routes/sources/index.svelte
index 23a9a45d60..f56f3d411f 100644
--- a/apps/ui/src/routes/sources/index.svelte
+++ b/apps/ui/src/routes/sources/index.svelte
@@ -66,7 +66,7 @@
<div class="flex flex-col">
<div class="flex flex-col flex-wrap justify-center px-2 md:flex-row">
{#each ownSources as source}
- <a href="/sources/{source.id}" class="w-96 p-2 no-underline">
+ <a href="/sources/{source.id}" class="p-2 no-underline">
<div
class="box-selection group relative hover:bg-orange-600"
class:border-red-500={source.gitlabApp && !source.gitlabAppId}