From f3b069501567a1faee7b660eed55b27ae4e0356a Mon Sep 17 00:00:00 2001 From: Arman Date: Sun, 10 Mar 2024 15:44:38 +0100 Subject: [PATCH] fix: execute modal --- .../functions/function-[function]/+layout.svelte | 4 ++-- .../functions/function-[function]/execute.svelte | 13 +++++-------- .../function-[function]/executions/+page.svelte | 11 ++--------- 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/src/routes/console/project-[project]/functions/function-[function]/+layout.svelte b/src/routes/console/project-[project]/functions/function-[function]/+layout.svelte index d693ef604..8ae5bc6d4 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/+layout.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/+layout.svelte @@ -5,7 +5,7 @@ import { Dependencies } from '$lib/constants'; import { invalidate, goto } from '$app/navigation'; import { registerCommands } from '$lib/commandCenter'; - import { execute, func, showCreateDeployment } from './store'; + import { func, showCreateDeployment } from './store'; import { project } from '../../store'; import type { Models } from '@appwrite.io/console'; import Execute from './execute.svelte'; @@ -147,4 +147,4 @@ - + diff --git a/src/routes/console/project-[project]/functions/function-[function]/execute.svelte b/src/routes/console/project-[project]/functions/function-[function]/execute.svelte index 65fe792c5..070c0af0c 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/execute.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/execute.svelte @@ -15,10 +15,7 @@ import Label from '$lib/elements/forms/label.svelte'; import { addNotification } from '$lib/stores/notifications'; import { sdk } from '$lib/stores/sdk'; - import type { Models } from '@appwrite.io/console'; - import { showFunctionExecute } from './store'; - - export let selectedFunction: Models.Function = null; + import { showFunctionExecute, execute } from './store'; let path = '/'; let method = 'GET'; @@ -47,7 +44,7 @@ } await sdk.forProject.functions.createExecution( - selectedFunction.$id, + $execute.$id, body, true, path, @@ -56,7 +53,7 @@ ); if (!$page.url?.toString()?.includes('/executions')) { await goto( - `${base}/console/project-${$page.params.project}/functions/function-${selectedFunction.$id}/executions` + `${base}/console/project-${$page.params.project}/functions/function-${$execute.$id}/executions` ); } invalidate(Dependencies.EXECUTIONS); @@ -75,7 +72,7 @@ }; function close() { - selectedFunction = null; + $execute = null; $showFunctionExecute = false; } @@ -100,7 +97,7 @@

- {#if selectedFunction?.version !== 'v3'} + {#if $execute?.version !== 'v3'} Customizable execution data now available for functions v3.0 diff --git a/src/routes/console/project-[project]/functions/function-[function]/executions/+page.svelte b/src/routes/console/project-[project]/functions/function-[function]/executions/+page.svelte index 57ee9f4f3..0b14ea74f 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/executions/+page.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/executions/+page.svelte @@ -19,19 +19,16 @@ import { log } from '$lib/stores/logs'; import { sdk } from '$lib/stores/sdk'; import { onMount } from 'svelte'; - import { func, showFunctionExecute } from '../store'; + import { func, execute, showFunctionExecute } from '../store'; import type { Models } from '@appwrite.io/console'; import { organization } from '$lib/stores/organization'; import { getServiceLimit, showUsageRatesModal } from '$lib/stores/billing'; import { project } from '$routes/console/project-[project]/store'; import Create from '../create.svelte'; - import Execute from '../execute.svelte'; import { abbreviateNumber } from '$lib/helpers/numbers'; export let data; - let selectedFunction: Models.Function = null; - onMount(() => { return sdk.forConsole.client.subscribe('console', (response) => { if (response.events.includes('functions.*.executions.*')) { @@ -55,7 +52,7 @@ buttonText="Execute now" buttonEvent="execute_function" buttonMethod={() => { - selectedFunction = $func; + $execute = $func; $showFunctionExecute = true; }}> @@ -172,7 +169,3 @@ {/if} - - - -