diff --git a/src/routes/console/project-[project]/functions/function-[function]/[[page]]/+page.svelte b/src/routes/console/project-[project]/functions/function-[function]/[[page]]/+page.svelte index 1ffec2be6..7da2c7ce7 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/[[page]]/+page.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/[[page]]/+page.svelte @@ -35,10 +35,11 @@ import Create from '../create.svelte'; import Activate from '../activate.svelte'; import { browser } from '$app/environment'; - import { sdkForConsole } from '$lib/stores/sdk'; + import { sdkForConsole, sdkForProject } from '$lib/stores/sdk'; import { page } from '$app/stores'; import Output from '$lib/components/output.svelte'; import { calculateTime } from '$lib/helpers/timeConversion'; + import { onDestroy, onMount, tick } from 'svelte'; export let data: PageData; @@ -49,6 +50,32 @@ let selectedDeployment: Models.Deployment = null; + let unsubscribe: { (): void }; + + onMount(() => { + unsubscribe = sdkForConsole.client.subscribe('console', async (response) => { + if (response.events.includes('functions.*.deployments.*')) { + if ($log.data && $log.data.$id === response.payload.deploymentId) { + $log.data = await sdkForProject.functions.getDeployment( + $func.$id, + $log.data.$id + ); + + await tick(); + + document.querySelector('.code-panel-content').scrollTop = + document.querySelector('.code-panel-content').scrollHeight; + } + } + }); + }); + + onDestroy(() => { + if (unsubscribe) { + unsubscribe(); + } + }); + const handleActivate = () => { invalidate(Dependencies.DEPLOYMENTS); }; diff --git a/src/routes/console/project-[project]/functions/function-[function]/settings/+page.svelte b/src/routes/console/project-[project]/functions/function-[function]/settings/+page.svelte index bb7d4529f..8ecdbc843 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/settings/+page.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/settings/+page.svelte @@ -40,6 +40,12 @@ let buildCommand: string = null; let installCommand: string = null; + let vcsInstallationId: string = null; + let vcsRepositoryId: string = null; + let vcsRootDirectory: string = null; + let vcsSilentMode: boolean = null; + let vcsBranch: string = null; + let showGitConnection = false; const eventSet: Writable> = writable(new Set()); @@ -55,6 +61,11 @@ entrypoint ??= $func.entrypoint; buildCommand ??= $func.buildCommand; installCommand ??= $func.installCommand; + vcsInstallationId ??= $func.vcsInstallationId; + vcsRepositoryId ??= $func.vcsRepositoryId; + vcsBranch ??= $func.vcsBranch; + vcsSilentMode ??= $func.vcsSilentMode; + vcsRootDirectory ??= $func.vcsRootDirectory; $eventSet = new Set($func.events); }); @@ -71,7 +82,12 @@ $func.logging, $func.entrypoint, $func.buildCommand, - $func.installCommand + $func.installCommand, + $func.vcsInstallationId, + $func.vcsRepositoryId, + $func.vcsBranch, + $func.vcsSilentMode, + $func.vcsRootDirectory ); invalidate(Dependencies.FUNCTION); addNotification({ @@ -100,7 +116,12 @@ logging, $func.entrypoint, $func.buildCommand, - $func.installCommand + $func.installCommand, + $func.vcsInstallationId, + $func.vcsRepositoryId, + $func.vcsBranch, + $func.vcsSilentMode, + $func.vcsRootDirectory ); invalidate(Dependencies.FUNCTION); addNotification({ @@ -129,7 +150,12 @@ $func.logging, $func.entrypoint, $func.buildCommand, - $func.installCommand + $func.installCommand, + $func.vcsInstallationId, + $func.vcsRepositoryId, + $func.vcsBranch, + $func.vcsSilentMode, + $func.vcsRootDirectory ); invalidate(Dependencies.FUNCTION); addNotification({ @@ -158,7 +184,12 @@ $func.logging, $func.entrypoint, $func.buildCommand, - $func.installCommand + $func.installCommand, + $func.vcsInstallationId, + $func.vcsRepositoryId, + $func.vcsBranch, + $func.vcsSilentMode, + $func.vcsRootDirectory ); invalidate(Dependencies.FUNCTION); addNotification({ @@ -187,7 +218,12 @@ $func.logging, $func.entrypoint, $func.buildCommand, - $func.installCommand + $func.installCommand, + $func.vcsInstallationId, + $func.vcsRepositoryId, + $func.vcsBranch, + $func.vcsSilentMode, + $func.vcsRootDirectory ); invalidate(Dependencies.FUNCTION); @@ -217,7 +253,12 @@ $func.logging, $func.entrypoint, $func.buildCommand, - $func.installCommand + $func.installCommand, + $func.vcsInstallationId, + $func.vcsRepositoryId, + $func.vcsBranch, + $func.vcsSilentMode, + $func.vcsRootDirectory ); invalidate(Dependencies.FUNCTION); @@ -247,7 +288,12 @@ $func.logging, entrypoint, buildCommand, - installCommand + installCommand, + $func.vcsInstallationId, + $func.vcsRepositoryId, + $func.vcsBranch, + $func.vcsSilentMode, + $func.vcsRootDirectory ); invalidate(Dependencies.FUNCTION); @@ -266,6 +312,12 @@ async function disconnectVcs() { try { + vcsInstallationId = ''; + vcsRepositoryId = ''; + vcsBranch = ''; + vcsSilentMode = true; + vcsRootDirectory = ''; + await sdkForProject.functions.update( functionId, $func.name, @@ -280,6 +332,8 @@ $func.installCommand, '', '', + '', + true, '' ); await invalidate(Dependencies.FUNCTION); @@ -379,16 +433,16 @@ - {#if $func.vcsInstallationId} + {#if vcsInstallationId}
Git Integration

SOME TEXT

    -

    Branch: {$func.vcsBranch}

    -

    Silent mode: {$func.vcsSilentMode ? 'yes' : 'no'}

    -

    Root directory: {$func.vcsRootDirectory}

    +

    Branch: {vcsBranch}

    +

    Silent mode: {vcsSilentMode ? 'yes' : 'no'}

    +

    Root directory: {vcsRootDirectory}

    Repository: {data.installation.organization}/{data.repository.name}