From d402fd56905dc763fa5b09f11bc30845f4a34eff Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 23 Nov 2022 10:28:36 +0100 Subject: [PATCH] fix: move debug log settings to build logs --- apps/api/src/lib/buildPacks/common.ts | 2 +- .../routes/applications/[id]/features.svelte | 24 ++----- .../applications/[id]/logs/build.svelte | 68 ++++++++++++++----- 3 files changed, 55 insertions(+), 39 deletions(-) diff --git a/apps/api/src/lib/buildPacks/common.ts b/apps/api/src/lib/buildPacks/common.ts index 32e498845..a8e9c737f 100644 --- a/apps/api/src/lib/buildPacks/common.ts +++ b/apps/api/src/lib/buildPacks/common.ts @@ -589,7 +589,7 @@ export async function buildImage({ } if (!debug) { await saveBuildLog({ - line: `Debug turned off. To see more details, allow it in the features tab.`, + line: `Debug logging is disabled. Enable it above if necessary!`, buildId, applicationId }); diff --git a/apps/ui/src/routes/applications/[id]/features.svelte b/apps/ui/src/routes/applications/[id]/features.svelte index ed1d529c4..be168ac45 100644 --- a/apps/ui/src/routes/applications/[id]/features.svelte +++ b/apps/ui/src/routes/applications/[id]/features.svelte @@ -44,7 +44,6 @@ const { id } = $page.params; - let debug = application.settings.debug; let previews = application.settings.previews; let dualCerts = application.settings.dualCerts; let autodeploy = application.settings.autodeploy; @@ -52,9 +51,6 @@ let isDBBranching = application.settings.isDBBranching; async function changeSettings(name: any) { - if (name === 'debug') { - debug = !debug; - } if (name === 'previews') { previews = !previews; } @@ -77,7 +73,6 @@ try { await post(`/applications/${id}/settings`, { previews, - debug, dualCerts, isBot, autodeploy, @@ -90,9 +85,6 @@ type: 'success' }); } catch (error) { - if (name === 'debug') { - debug = !debug; - } if (name === 'previews') { previews = !previews; } @@ -132,8 +124,7 @@ description={$t('application.enable_auto_deploy_webhooks')} /> - {/if} - {#if !application.settings.isBot && !application.settings.isPublicRepository} + {#if !application.settings.isBot}
+ {/if} + {:else} + No features available for this application {/if} -
- changeSettings('debug')} - title={$t('application.debug_logs')} - description={$t('application.enable_debug_log_during_build')} - /> -
diff --git a/apps/ui/src/routes/applications/[id]/logs/build.svelte b/apps/ui/src/routes/applications/[id]/logs/build.svelte index 1475bf48c..7d9d935fb 100644 --- a/apps/ui/src/routes/applications/[id]/logs/build.svelte +++ b/apps/ui/src/routes/applications/[id]/logs/build.svelte @@ -32,7 +32,7 @@ import { day } from '$lib/dayjs'; import { onDestroy, onMount } from 'svelte'; const { id } = $page.params; - + let debug = application.settings.debug; let loadBuildLogsInterval: any = null; let skip = 0; @@ -104,42 +104,74 @@ return 'text-white'; } } + async function changeSettings(name: any) { + if (name === 'debug') { + debug = !debug; + } + try { + await post(`/applications/${id}/settings`, { + debug, + branch: application.branch, + projectId: application.projectId + }); + return addToast({ + message: $t('application.settings_saved'), + type: 'success' + }); + } catch (error) { + if (name === 'debug') { + debug = !debug; + } + + return errorNotification(error); + } + } -
-
+
+
Build Logs
+
+
+ +
-
+
{#if $selectedBuildId} {#key $selectedBuildId} {/key} + {:else if buildCount === 0} + Not build logs found. {:else} - {#if buildCount === 0} - Not build logs found. - {:else} Select a build to see the logs. - - {/if} {/if}
-
- -
+
+ +
{#each builds as build, index (build.id)} +
loadBuild(build.id)} @@ -187,4 +219,4 @@ {/each}
-
\ No newline at end of file +