mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
Merge branch '1.6.x' of github.com:appwrite/console into feat-simple-filters
This commit is contained in:
commit
cd29adf3de
12 files changed
+19
-247
No files matched your search
@@ -134,7 +134,7 @@
|
||||
</Pill>
|
||||
{/if}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<TableCell right>
|
||||
<DropList
|
||||
bind:show={showDomainsDropdown[i]}
|
||||
placement="bottom-start"
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<FormList>
|
||||
<InputTextarea
|
||||
label="Commands"
|
||||
placeholder="Enter a build commad (e.g. 'npm install')"
|
||||
placeholder="Enter a build command (e.g. 'npm install')"
|
||||
id="build"
|
||||
tooltip="Enter a single command or chain multiple commands with the && operator"
|
||||
bind:value={$createFunction.commands} />
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="link">
|
||||
Permissions guide
|
||||
</a>.
|
||||
Permissions guide</a
|
||||
>.
|
||||
</svelte:fragment>
|
||||
|
||||
<Roles bind:roles={$createFunction.execute} />
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
<FormList>
|
||||
<InputTextarea
|
||||
label="Commands"
|
||||
placeholder="Enter a build commad (e.g. 'npm install')"
|
||||
placeholder="Enter a build command (e.g. 'npm install')"
|
||||
id="build"
|
||||
tooltip="Enter a single command or chain multiple commands with the && operator"
|
||||
bind:value={$createFunction.commands} />
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
import { func, showCreateDeployment } from './store';
|
||||
import { project } from '../../store';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import Execute from './execute.svelte';
|
||||
import { base } from '$app/paths';
|
||||
|
||||
onMount(() => {
|
||||
@@ -147,5 +146,3 @@
|
||||
</script>
|
||||
|
||||
<slot />
|
||||
|
||||
<Execute />
|
||||
+1
-1
@@ -115,7 +115,7 @@
|
||||
bind:value={entrypoint} />
|
||||
<InputTextarea
|
||||
label="Commands"
|
||||
placeholder="Enter a build commad (e.g. 'npm install')"
|
||||
placeholder="Enter a build command (e.g. 'npm install')"
|
||||
tooltip="Enter a single command or chain multiple commands with the && operator"
|
||||
id="build"
|
||||
bind:value={buildCommand} />
|
||||
|
||||
+2
-2
@@ -15,8 +15,8 @@
|
||||
|
||||
<CardGrid>
|
||||
<div class="u-flex u-cross-start u-gap-16">
|
||||
<div class="avatar is-medium" aria-hidden="true">
|
||||
<SvgIcon name={$func.runtime.split('-')[0]}></SvgIcon>
|
||||
<div class="avatar" style={`--p-image-size: ${32 / 16}rem`} aria-hidden="true">
|
||||
<SvgIcon size={64} iconSize="large" name={$func.runtime.split('-')[0]}></SvgIcon>
|
||||
</div>
|
||||
<div class="u-grid-equal-row-size u-gap-4 u-line-height-1">
|
||||
<p><b>Deployment ID</b></p>
|
||||
|
||||
@@ -1,220 +0,0 @@
|
||||
<script lang="ts">
|
||||
//TODO remove
|
||||
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 { Alert, 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';
|
||||
import InputText from '$lib/elements/forms/inputText.svelte';
|
||||
import InputTextarea from '$lib/elements/forms/inputTextarea.svelte';
|
||||
import Label from '$lib/elements/forms/label.svelte';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { showFunctionExecute, execute } from './store';
|
||||
import { ExecutionMethod } from '@appwrite.io/console';
|
||||
|
||||
let path = '/';
|
||||
let method = ExecutionMethod.GET;
|
||||
let body = '';
|
||||
let headers: [string, string][] = [['', '']];
|
||||
let error: string = null;
|
||||
|
||||
const methodOptions = [
|
||||
{ label: 'GET', value: ExecutionMethod.GET },
|
||||
{ label: 'POST', value: ExecutionMethod.POST },
|
||||
{ label: 'PUT', value: ExecutionMethod.PUT },
|
||||
{ label: 'PATCH', value: ExecutionMethod.PATCH },
|
||||
{ label: 'DELETE', value: ExecutionMethod.DELETE },
|
||||
{ label: 'OPTIONS', value: ExecutionMethod.OPTIONS }
|
||||
];
|
||||
|
||||
let submitting = false;
|
||||
|
||||
const handleSubmit = async () => {
|
||||
submitting = true;
|
||||
try {
|
||||
const headersObject = {};
|
||||
|
||||
for (const [name, value] of headers) {
|
||||
headersObject[name] = value;
|
||||
}
|
||||
|
||||
await sdk.forProject.functions.createExecution(
|
||||
$execute.$id,
|
||||
body,
|
||||
true,
|
||||
path,
|
||||
method,
|
||||
headersObject
|
||||
);
|
||||
if (!$page.url?.toString()?.includes('/executions')) {
|
||||
await goto(
|
||||
`${base}/project-${$page.params.project}/functions/function-${$execute.$id}/executions`
|
||||
);
|
||||
}
|
||||
invalidate(Dependencies.EXECUTIONS);
|
||||
close();
|
||||
addNotification({
|
||||
type: 'success',
|
||||
message: `Function has been executed`
|
||||
});
|
||||
trackEvent(Submit.ExecutionCreate);
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
trackError(e, Submit.ExecutionCreate);
|
||||
} finally {
|
||||
submitting = false;
|
||||
}
|
||||
};
|
||||
|
||||
function close() {
|
||||
$execute = null;
|
||||
$showFunctionExecute = false;
|
||||
}
|
||||
|
||||
afterNavigate(close);
|
||||
</script>
|
||||
|
||||
<Modal
|
||||
title="Execute function"
|
||||
headerDivider={false}
|
||||
bind:show={$showFunctionExecute}
|
||||
size="big"
|
||||
onSubmit={handleSubmit}
|
||||
bind:error>
|
||||
<p class="text">
|
||||
Manually execute your function. <a
|
||||
class="link"
|
||||
href="https://appwrite.io/docs/products/functions/execution"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
Learn more
|
||||
</a>.
|
||||
</p>
|
||||
|
||||
<FormList>
|
||||
{#if $execute?.version === 'v2'}
|
||||
<Alert type="info">
|
||||
<svelte:fragment slot="title">
|
||||
Customizable execution data now available for functions v3.0
|
||||
</svelte:fragment>
|
||||
Update your function version to make use of new features including customizable HTTP
|
||||
data in your executions.
|
||||
<svelte:fragment slot="buttons">
|
||||
<Button
|
||||
href="https://appwrite.io/docs/products/functions/development"
|
||||
external
|
||||
text>
|
||||
Learn more
|
||||
</Button>
|
||||
</svelte:fragment>
|
||||
</Alert>
|
||||
<InputTextarea label="Body" placeholder={`Hello, World!`} id="body" bind:value={body} />
|
||||
{:else}
|
||||
<InputText label="Path" id="path" placeholder="/" bind:value={path} required />
|
||||
|
||||
<InputSelect
|
||||
required
|
||||
id="method"
|
||||
label="Method"
|
||||
options={methodOptions}
|
||||
bind:value={method} />
|
||||
|
||||
<Collapsible>
|
||||
<CollapsibleItem>
|
||||
<svelte:fragment slot="title">Advanced settings</svelte:fragment>
|
||||
<svelte:fragment slot="subtitle">(optional)</svelte:fragment>
|
||||
<FormList>
|
||||
<p class="text">
|
||||
Customize your execution with headers or body. To customize parameters,
|
||||
add them to path.
|
||||
</p>
|
||||
<div>
|
||||
<Label
|
||||
tooltip="Headers should contain alphanumeric characters (a-z, A-Z, and 0-9) and hyphens only (- and _).">
|
||||
Headers
|
||||
</Label>
|
||||
<div class="form u-grid u-gap-8 u-margin-block-start-8">
|
||||
<FormList>
|
||||
{#if headers}
|
||||
{#each headers as [name, value], index}
|
||||
<FormItem isMultiple>
|
||||
<InputText
|
||||
isMultiple
|
||||
fullWidth
|
||||
label="Name"
|
||||
placeholder="Enter Name"
|
||||
id={`key-${index}`}
|
||||
bind:value={name} />
|
||||
<InputText
|
||||
isMultiple
|
||||
fullWidth
|
||||
label="Value"
|
||||
placeholder="Enter value"
|
||||
id={`value-${index}`}
|
||||
bind:value />
|
||||
<FormItemPart alignEnd>
|
||||
<Button
|
||||
text
|
||||
noMargin
|
||||
disabled={(!name || !value) && index === 0}
|
||||
on:click={() => {
|
||||
if (index === 0) {
|
||||
headers = [['', '']];
|
||||
} else {
|
||||
headers.splice(index, 1);
|
||||
headers = headers;
|
||||
}
|
||||
}}>
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
</Button>
|
||||
</FormItemPart>
|
||||
</FormItem>
|
||||
{/each}
|
||||
{/if}
|
||||
</FormList>
|
||||
<Button
|
||||
noMargin
|
||||
text
|
||||
disabled={headers?.length &&
|
||||
headers[headers.length - 1][0] &&
|
||||
headers[headers.length - 1][1]
|
||||
? false
|
||||
: true}
|
||||
on:click={() => {
|
||||
if (
|
||||
headers[headers.length - 1][0] &&
|
||||
headers[headers.length - 1][1]
|
||||
) {
|
||||
headers.push(['', '']);
|
||||
headers = headers;
|
||||
}
|
||||
}}>
|
||||
<span class="icon-plus" aria-hidden="true" />
|
||||
<span class="text">Add Header</span>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<InputTextarea
|
||||
label="Body"
|
||||
placeholder={`Hello, World!`}
|
||||
id="body"
|
||||
bind:value={body} />
|
||||
</FormList>
|
||||
</CollapsibleItem>
|
||||
</Collapsible>
|
||||
{/if}
|
||||
</FormList>
|
||||
|
||||
<svelte:fragment slot="footer">
|
||||
<Button text on:click={close}>Cancel</Button>
|
||||
<Button disabled={submitting} submit>Execute</Button>
|
||||
</svelte:fragment>
|
||||
</Modal>
|
||||
+3
-3
@@ -64,7 +64,7 @@
|
||||
id: 'trigger',
|
||||
title: 'Trigger',
|
||||
type: 'string',
|
||||
show: true,
|
||||
show: false,
|
||||
width: 90,
|
||||
array: true,
|
||||
format: 'enum',
|
||||
@@ -189,7 +189,7 @@
|
||||
href={`${base}/project-${$project.$id}/functions/function-${$func.$id}/executions/execute-function`}
|
||||
disabled={!$func.$id || !$func?.deployment}>
|
||||
<span class="icon-plus" aria-hidden="true" />
|
||||
<span class="text">Execute now</span>
|
||||
<span class="text">Execute</span>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -261,7 +261,7 @@
|
||||
<p class="text u-line-height-1-5">
|
||||
You have no execution logs. Create and activate a deployment to see it here.
|
||||
</p>
|
||||
<p class="text u-line-height-1-5">Need a hand? Learn more in our documentation</p>
|
||||
<p class="text u-line-height-1-5">Need a hand? Learn more in our documentation.</p>
|
||||
</div>
|
||||
<div class="u-flex u-gap-16">
|
||||
<Button text external href="https://appwrite.io/docs/products/functions/execution">
|
||||
|
||||
+5
-8
@@ -241,16 +241,11 @@
|
||||
<Button
|
||||
noMargin
|
||||
text
|
||||
disabled={headers?.length &&
|
||||
headers[headers.length - 1][0] &&
|
||||
headers[headers.length - 1][1]
|
||||
disabled={headers?.length && headers[headers.length - 1][0]
|
||||
? false
|
||||
: true}
|
||||
on:click={() => {
|
||||
if (
|
||||
headers[headers.length - 1][0] &&
|
||||
headers[headers.length - 1][1]
|
||||
) {
|
||||
if (headers[headers.length - 1][0]) {
|
||||
headers.push(['', '']);
|
||||
headers = headers;
|
||||
}
|
||||
@@ -320,7 +315,9 @@
|
||||
{func.deployment}
|
||||
</Id>
|
||||
</div>
|
||||
<ul class="u-flex u-main-space-between">
|
||||
<ul
|
||||
class="u-grid u-width-full-line u-gap-16"
|
||||
style:grid-template-columns="repeat(3, 1fr)">
|
||||
<li class="u-flex-vertical u-gap-8">
|
||||
<p class="u-color-text-offline">Status</p>
|
||||
<p>
|
||||
|
||||
+3
-3
@@ -9,8 +9,8 @@
|
||||
|
||||
<CardGrid>
|
||||
<div class="grid-1-2-col-1 u-flex u-cross-center u-gap-16">
|
||||
<div class="avatar">
|
||||
<SvgIcon name={$func.runtime.split('-')[0]} type="color" size={80} iconSize="large" />
|
||||
<div class="avatar" style={`--p-image-size: ${32 / 16}rem`} aria-hidden="true">
|
||||
<SvgIcon size={64} iconSize="large" name={$func.runtime.split('-')[0]}></SvgIcon>
|
||||
</div>
|
||||
<div class="u-flex-vertical u-gap-4">
|
||||
<Heading tag="h6" size="7">{$func.name}</Heading>
|
||||
@@ -31,7 +31,7 @@
|
||||
<Button
|
||||
secondary
|
||||
href={`${base}/project-${$project.$id}/functions/function-${$func.$id}/executions/execute-function`}>
|
||||
Execute now
|
||||
Execute
|
||||
</Button>
|
||||
</svelte:fragment>
|
||||
</CardGrid>
|
||||
@@ -11,8 +11,6 @@ export const proxyRuleList = derived(
|
||||
page,
|
||||
($page) => $page.data.proxyRuleList as Models.ProxyRuleList
|
||||
);
|
||||
export const execute: Writable<Models.Function> = writable(); //TODO Remove
|
||||
export const showFunctionExecute: Writable<boolean> = writable(false); //TODO Remove
|
||||
|
||||
export const repositories: Writable<{
|
||||
search: string;
|
||||
|
||||
Reference in new issue
Block a user