diff --git a/src/lib/database/applications.ts b/src/lib/database/applications.ts
index 1c6e172c2..ce53fe709 100644
--- a/src/lib/database/applications.ts
+++ b/src/lib/database/applications.ts
@@ -73,7 +73,11 @@ export async function removeApplication({ id, teamId }) {
await prisma.build.deleteMany({ where: { applicationId: id } });
await prisma.secret.deleteMany({ where: { applicationId: id } });
await prisma.applicationPersistentStorage.deleteMany({ where: { applicationId: id } });
- await prisma.application.deleteMany({ where: { id, teams: { some: { id: teamId } } } });
+ if (teamId === '0') {
+ await prisma.application.deleteMany({ where: { id } });
+ } else {
+ await prisma.application.deleteMany({ where: { id, teams: { some: { id: teamId } } } });
+ }
}
export async function getApplicationWebhook({ projectId, branch }) {
diff --git a/src/lib/database/gitSources.ts b/src/lib/database/gitSources.ts
index 0ed6f29b1..b8279c268 100644
--- a/src/lib/database/gitSources.ts
+++ b/src/lib/database/gitSources.ts
@@ -13,15 +13,11 @@ export async function listSources(teamId) {
});
}
-export async function newSource({ name, teamId, type, htmlUrl, apiUrl, organization }) {
+export async function newSource({ teamId, name }) {
return await prisma.gitSource.create({
data: {
- teams: { connect: { id: teamId } },
name,
- type,
- htmlUrl,
- apiUrl,
- organization
+ teams: { connect: { id: teamId } }
}
});
}
@@ -55,8 +51,29 @@ export async function getSource({ id, teamId }) {
if (body?.gitlabApp?.appSecret) body.gitlabApp.appSecret = decrypt(body.gitlabApp.appSecret);
return body;
}
-export async function addSource({ id, appId, teamId, oauthId, groupName, appSecret }) {
+export async function addGitHubSource({ id, teamId, type, name, htmlUrl, apiUrl }) {
+ await prisma.gitSource.update({ where: { id }, data: { type, name, htmlUrl, apiUrl } });
+ return await prisma.githubApp.create({
+ data: {
+ teams: { connect: { id: teamId } },
+ gitSource: { connect: { id } }
+ }
+ });
+}
+export async function addGitLabSource({
+ id,
+ teamId,
+ type,
+ name,
+ htmlUrl,
+ apiUrl,
+ oauthId,
+ appId,
+ appSecret,
+ groupName
+}) {
const encrptedAppSecret = encrypt(appSecret);
+ await prisma.gitSource.update({ where: { id }, data: { type, apiUrl, htmlUrl, name } });
return await prisma.gitlabApp.create({
data: {
teams: { connect: { id: teamId } },
@@ -75,9 +92,9 @@ export async function configureGitsource({ id, gitSourceId }) {
data: { gitSource: { connect: { id: gitSourceId } } }
});
}
-export async function updateGitsource({ id, name }) {
+export async function updateGitsource({ id, name, htmlUrl, apiUrl }) {
return await prisma.gitSource.update({
where: { id },
- data: { name }
+ data: { name, htmlUrl, apiUrl }
});
}
diff --git a/src/routes/applications/[id]/delete.json.ts b/src/routes/applications/[id]/delete.json.ts
index b451728df..03e48a847 100644
--- a/src/routes/applications/[id]/delete.json.ts
+++ b/src/routes/applications/[id]/delete.json.ts
@@ -14,6 +14,7 @@ export const del: RequestHandler = async (event) => {
status: 200
};
} catch (error) {
+ console.log(error);
return ErrorHandler(error);
}
};
diff --git a/src/routes/applications/_Application.svelte b/src/routes/applications/_Application.svelte
deleted file mode 100644
index 8f183eb13..000000000
--- a/src/routes/applications/_Application.svelte
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
- {#if buildPack === 'rust'}
-
- {:else if buildPack === 'node'}
-
- {:else if buildPack === 'react'}
-
- {:else if buildPack === 'svelte'}
-
- {:else if buildPack === 'vuejs'}
-
- {:else if buildPack === 'php'}
-
- {:else if buildPack === 'python'}
-
- {:else if buildPack === 'static'}
-
- {:else if buildPack === 'nestjs'}
-
- {:else if buildPack === 'nuxtjs'}
-
- {:else if buildPack === 'nextjs'}
-
- {:else if buildPack === 'gatsby'}
-
- {:else if buildPack === 'docker'}
-
- {:else if buildPack === 'astro'}
-
- {:else if buildPack === 'eleventy'}
-
- {/if}
-
-
{application.name}
- {#if $session.teamId === '0'}
-
Team {application.teams[0].name}
- {/if}
- {#if application.fqdn}
-
{application.fqdn}
- {/if}
- {#if !application.gitSourceId || !application.destinationDockerId}
-
- Configuration missing
-
- {/if}
-
-
diff --git a/src/routes/applications/index.svelte b/src/routes/applications/index.svelte
index 547382498..0c69c47fe 100644
--- a/src/routes/applications/index.svelte
+++ b/src/routes/applications/index.svelte
@@ -1,9 +1,26 @@
-
-
diff --git a/src/routes/new/source/_Gitlab.svelte b/src/routes/new/source/_Gitlab.svelte
deleted file mode 100644
index 219bc56b0..000000000
--- a/src/routes/new/source/_Gitlab.svelte
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
-
diff --git a/src/routes/new/source/index.svelte b/src/routes/new/source/index.svelte
deleted file mode 100644
index 73384561a..000000000
--- a/src/routes/new/source/index.svelte
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
-
-
-
-
Official providers
-
-
-
-
-
-
-
- {#if gitSource.type === 'github'}
-
- {:else if gitSource.type === 'gitlab'}
-
- {:else if gitSource.type === 'bitbucket'}
-
Not implemented yet
- {/if}
-
diff --git a/src/routes/services/index.svelte b/src/routes/services/index.svelte
index 06e74873b..389ee8036 100644
--- a/src/routes/services/index.svelte
+++ b/src/routes/services/index.svelte
@@ -13,6 +13,7 @@
import Ghost from '$lib/components/svg/services/Ghost.svelte';
import MeiliSearch from '$lib/components/svg/services/MeiliSearch.svelte';
import { session } from '$app/stores';
+ import { getDomain } from '$lib/components/common';
export let services;
async function newService() {
@@ -87,9 +88,12 @@
{service.name}
- {#if $session.teamId === '0'}
+ {#if $session.teamId === '0' && otherServices.length > 0}
{service.teams[0].name}
{/if}
+ {#if service.fqdn}
+ {getDomain(service.fqdn)}
+ {/if}
{#if !service.type || !service.fqdn}
Configuration missing
@@ -134,6 +138,9 @@
{#if $session.teamId === '0'}
{service.teams[0].name}
{/if}
+ {#if service.fqdn}
+
{getDomain(service.fqdn)}
+ {/if}
{#if !service.type || !service.fqdn}
Configuration missing
diff --git a/src/routes/sources/[id]/_Github.svelte b/src/routes/sources/[id]/_Github.svelte
index 102971353..b2866d195 100644
--- a/src/routes/sources/[id]/_Github.svelte
+++ b/src/routes/sources/[id]/_Github.svelte
@@ -3,13 +3,19 @@
import { page, session } from '$app/stores';
import { post } from '$lib/api';
import { errorNotification } from '$lib/form';
+ import { toast } from '@zerodevx/svelte-toast';
const { id } = $page.params;
let loading = false;
async function handleSubmit() {
loading = true;
try {
- return await post(`/sources/${id}.json`, { name: source.name });
+ await post(`/sources/${id}.json`, {
+ name: source.name,
+ htmlUrl: source.htmlUrl,
+ apiUrl: source.apiUrl
+ });
+ toast.push('Settings saved.');
} catch ({ error }) {
return errorNotification(error);
} finally {
@@ -38,7 +44,18 @@
}, 100);
}
- function newGithubApp() {
+ async function newGithubApp() {
+ loading = true;
+ try {
+ await post(`/sources/${id}/github.json`, {
+ type: 'github',
+ name: source.name,
+ htmlUrl: source.htmlUrl,
+ apiUrl: source.apiUrl
+ });
+ } catch ({ error }) {
+ return errorNotification(error);
+ }
const left = screen.width / 2 - 1020 / 2;
const top = screen.height / 2 - 618 / 2;
const newWindow = open(
@@ -59,31 +76,72 @@
}
-{#if !source.githubAppId}
-
-{:else if source.githubApp?.installationId}
-