Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 7353: Can't close execute function modal #711

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
TableRow,
TableScroll
} from '$lib/elements/table';
import { deploymentList, execute, func, proxyRuleList } from './store';
import { deploymentList, execute, func, proxyRuleList, showFunctionExecute } from './store';
import { Container, ContainerHeader } from '$lib/layout';
import { app } from '$lib/stores/app';
import { calculateSize, humanFileSize } from '$lib/helpers/sizeConvertion';
Expand Down Expand Up @@ -151,7 +151,10 @@

<Button
secondary
on:click={() => ($execute = $func)}
on:click={() => {
$execute = $func;
$showFunctionExecute = true;
}}
disabled={isCloud && $readOnly && !GRACE_PERIOD_OVERRIDE}>
Execute now
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
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;

Expand All @@ -34,13 +35,8 @@
{ label: 'OPTIONS', value: 'OPTIONS' }
];

let show = false;
let submitting = false;

$: if (selectedFunction && !show) {
show = true;
}

const handleSubmit = async () => {
submitting = true;
try {
Expand Down Expand Up @@ -80,7 +76,7 @@

function close() {
selectedFunction = null;
show = false;
$showFunctionExecute = false;
}

afterNavigate(close);
Expand All @@ -89,10 +85,9 @@
<Modal
title="Execute function"
headerDivider={false}
bind:show
bind:show={$showFunctionExecute}
size="big"
onSubmit={handleSubmit}
on:close={close}
bind:error>
<p class="text">
Manually execute your function. <a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import { log } from '$lib/stores/logs';
import { sdk } from '$lib/stores/sdk';
import { onMount } from 'svelte';
import { func } from '../store';
import { func, showFunctionExecute } from '../store';
import type { Models } from '@appwrite.io/console';
import { organization } from '$lib/stores/organization';
import { getServiceLimit, showUsageRatesModal } from '$lib/stores/billing';
Expand Down Expand Up @@ -54,7 +54,10 @@
title="Executions"
buttonText="Execute now"
buttonEvent="execute_function"
buttonMethod={() => (selectedFunction = $func)}>
buttonMethod={() => {
selectedFunction = $func;
$showFunctionExecute = true;
}}>
<svelte:fragment slot="tooltip" let:tier let:limit let:upgradeMethod>
<p class="u-bold">The {tier} plan has limits</p>
<ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { CardGrid, Heading, SvgIcon } from '$lib/components';
import { Button } from '$lib/elements/forms';
import { toLocaleDateTime } from '$lib/helpers/date';
import { execute, func } from '../store';
import { execute, func, showFunctionExecute } from '../store';
</script>

<CardGrid>
Expand All @@ -26,6 +26,11 @@
</svelte:fragment>

<svelte:fragment slot="actions">
<Button secondary on:click={() => ($execute = $func)}>Execute now</Button>
<Button
secondary
on:click={() => {
$execute = $func;
$showFunctionExecute = true;
}}>Execute now</Button>
</svelte:fragment>
</CardGrid>
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export const proxyRuleList = derived(
($page) => $page.data.proxyRuleList as Models.ProxyRuleList
);
export const execute: Writable<Models.Function> = writable();
export const showFunctionExecute: Writable<boolean> = writable(false);

export const repositories: Writable<{
search: string;
installationId: string;
Expand Down