feat: add execute now button

This commit is contained in:
Arman
2023-08-20 14:22:02 +02:00
parent d77d8d2bae
commit 5724d4f8cb
2 changed files with 17 additions and 6 deletions
@@ -1,11 +1,12 @@
<script lang="ts">
import { afterNavigate, goto } from '$app/navigation';
import { afterNavigate, goto, invalidate } from '$app/navigation';
import { base } from '$app/paths';
import { page } from '$app/stores';
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
import { Modal } from '$lib/components';
import Collapsible from '$lib/components/collapsible.svelte';
import CollapsibleItem from '$lib/components/collapsibleItem.svelte';
import { Dependencies } from '$lib/constants';
import { Button, FormItem, FormItemPart } from '$lib/elements/forms';
import { FormList } from '$lib/elements/forms';
import InputSelect from '$lib/elements/forms/inputSelect.svelte';
@@ -57,9 +58,12 @@
method,
headersObject
);
goto(
`${base}/console/project-${$page.params.project}/functions/function-${selectedFunction.$id}/executions`
);
if (!$page.url?.toString()?.includes('/executions')) {
await goto(
`${base}/console/project-${$page.params.project}/functions/function-${selectedFunction.$id}/executions`
);
}
invalidate(Dependencies.EXECUTIONS);
close();
addNotification({
type: 'success',
@@ -13,7 +13,7 @@
TableRowButton,
TableScroll
} from '$lib/elements/table';
import { timeFromNow, toLocaleDateTime } from '$lib/helpers/date';
import { timeFromNow } from '$lib/helpers/date';
import { calculateTime } from '$lib/helpers/timeConversion';
import { Container } from '$lib/layout';
import { log } from '$lib/stores/logs';
@@ -24,10 +24,11 @@
import type { PageData } from './$types';
import { project } from '$routes/console/project-[project]/store';
import Create from '../create.svelte';
import Execute from '../execute.svelte';
export let data: PageData;
// let showCreate = false;
let selectedFunction: Models.Function = null;
onMount(() => {
return sdk.forConsole.client.subscribe('console', (response) => {
@@ -47,6 +48,10 @@
<Container>
<div class="u-flex u-gap-12 common-section u-main-space-between">
<Heading tag="h2" size="5">Executions</Heading>
<Button on:click={() => (selectedFunction = $func)} event="execute_function">
<span class="text">Execute now</span>
</Button>
</div>
{#if !$func.logging}
<div class="common-section">
@@ -133,3 +138,5 @@
</EmptySearch>
{/if}
</Container>
<Execute {selectedFunction} />