mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
feat: executions
This commit is contained in:
1 parent
322c009e73
commit
0411af7d49
11 files changed
+671
-532
No files matched your search
@@ -75,12 +75,14 @@
|
||||
});
|
||||
}
|
||||
|
||||
$: selectedColumnsNumber = $columns.reduce((acc, column) => {
|
||||
if (column.show) {
|
||||
acc++;
|
||||
}
|
||||
return acc;
|
||||
}, 0);
|
||||
$: selectedColumnsNumber = $columns
|
||||
.filter((c) => !c.hide)
|
||||
.reduce((acc, column) => {
|
||||
if (column.show) {
|
||||
acc++;
|
||||
}
|
||||
return acc;
|
||||
}, 0);
|
||||
</script>
|
||||
|
||||
{#if !hideColumns && view === View.Table}
|
||||
@@ -96,7 +98,7 @@
|
||||
<svelte:fragment slot="tooltip">
|
||||
<ActionMenu.Root>
|
||||
<Layout.Stack>
|
||||
{#each $columns as column}
|
||||
{#each $columns.filter((c) => !c.hide) as column}
|
||||
<InputCheckbox
|
||||
id={column.id}
|
||||
label={column.title}
|
||||
|
||||
@@ -39,6 +39,7 @@ export type Column = {
|
||||
array?: boolean;
|
||||
format?: string;
|
||||
elements?: string[] | { value: string | number; label: string }[];
|
||||
hide?: boolean;
|
||||
};
|
||||
|
||||
export function isValueOfStringEnum<T extends Record<string, string>>(
|
||||
|
||||
+17
-153
@@ -1,141 +1,22 @@
|
||||
<script lang="ts">
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import { Alert, Empty, EmptySearch, PaginationWithLimit, ViewSelector } from '$lib/components';
|
||||
import { Alert, Empty, EmptyFilter, PaginationWithLimit, ViewSelector } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { Container } from '$lib/layout';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { onMount } from 'svelte';
|
||||
import { func } from '../store';
|
||||
import { project } from '$routes/(console)/project-[project]/store';
|
||||
import { base } from '$app/paths';
|
||||
import { Filters, queries } from '$lib/components/filters';
|
||||
import { writable } from 'svelte/store';
|
||||
import type { Column } from '$lib/helpers/types';
|
||||
import { View } from '$lib/helpers/load';
|
||||
import Table from './table.svelte';
|
||||
import QuickFilters from './quickFilters.svelte';
|
||||
import { tags } from '$lib/components/filters/store';
|
||||
import { Layout } from '@appwrite.io/pink-svelte';
|
||||
import { Icon, Layout } from '@appwrite.io/pink-svelte';
|
||||
import { IconPlus } from '@appwrite.io/pink-icons-svelte';
|
||||
import Table from './table.svelte';
|
||||
import { columns } from './store';
|
||||
|
||||
export let data;
|
||||
|
||||
const columns = writable<Column[]>([
|
||||
{ id: '$id', title: 'Execution ID', type: 'string', show: true, width: 150 },
|
||||
{
|
||||
id: 'status',
|
||||
title: 'Status',
|
||||
type: 'enum',
|
||||
show: true,
|
||||
width: 130,
|
||||
array: true,
|
||||
format: 'enum',
|
||||
elements: ['completed', 'failed', 'waiting', 'scheduled', 'processing', 'cancelled']
|
||||
},
|
||||
{
|
||||
id: '$createdAt',
|
||||
title: 'Created',
|
||||
type: 'datetime',
|
||||
show: true,
|
||||
width: 120,
|
||||
format: 'datetime',
|
||||
elements: [
|
||||
{
|
||||
value: 5 * 60 * 1000,
|
||||
label: 'last 5 minutes'
|
||||
},
|
||||
{
|
||||
value: 60 * 60 * 1000,
|
||||
label: 'last 1 hour'
|
||||
},
|
||||
{
|
||||
value: 24 * 60 * 60 * 1000,
|
||||
label: 'last 24 hours'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 'trigger',
|
||||
title: 'Trigger',
|
||||
type: 'string',
|
||||
show: false,
|
||||
width: 90,
|
||||
array: true,
|
||||
format: 'enum',
|
||||
elements: [
|
||||
{ value: 'http', label: 'HTTP' },
|
||||
{ value: 'schedule', label: 'Schedule' },
|
||||
{ value: 'event', label: 'Event' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 'requestMethod',
|
||||
title: 'Method',
|
||||
type: 'string',
|
||||
show: true,
|
||||
width: 70,
|
||||
array: true,
|
||||
format: 'enum',
|
||||
elements: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']
|
||||
},
|
||||
{
|
||||
id: 'responseStatusCode',
|
||||
title: 'Status code',
|
||||
type: 'integer',
|
||||
show: true,
|
||||
width: 100,
|
||||
format: 'integer',
|
||||
elements: [
|
||||
{
|
||||
value: 299,
|
||||
label: 'Success (200-299)'
|
||||
},
|
||||
{
|
||||
value: 399,
|
||||
label: 'Redirect (300-399)'
|
||||
},
|
||||
{
|
||||
value: 499,
|
||||
label: 'Client error (400-499)'
|
||||
},
|
||||
{
|
||||
value: 599,
|
||||
label: 'Server error (500-599)'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 'requestPath',
|
||||
title: 'Path',
|
||||
type: 'string',
|
||||
show: true,
|
||||
width: 90,
|
||||
format: 'string'
|
||||
},
|
||||
{
|
||||
id: 'duration',
|
||||
title: 'Duration',
|
||||
type: 'integer',
|
||||
show: true,
|
||||
width: 80,
|
||||
format: 'integer',
|
||||
elements: [
|
||||
{
|
||||
value: 1,
|
||||
label: 'more than 1 second'
|
||||
},
|
||||
{
|
||||
value: 5,
|
||||
label: 'more than 5 seconds'
|
||||
},
|
||||
{
|
||||
value: 30,
|
||||
label: 'more than 30 seconds'
|
||||
}
|
||||
]
|
||||
}
|
||||
]);
|
||||
|
||||
let showMobileFilters = false;
|
||||
onMount(() => {
|
||||
data?.query ? (showMobileFilters = true) : (showMobileFilters = false);
|
||||
@@ -145,11 +26,6 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function clearAll() {
|
||||
queries.clearAll();
|
||||
queries.apply();
|
||||
}
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
@@ -181,23 +57,26 @@
|
||||
</div>
|
||||
</Filters> -->
|
||||
<Layout.Stack gap="s" inline direction="row" alignItems="center">
|
||||
<ViewSelector view={View.Table} {columns} hideView allowNoColumns />
|
||||
{#if data?.executions?.total}
|
||||
<ViewSelector view={View.Table} {columns} hideView allowNoColumns />
|
||||
{/if}
|
||||
<Button
|
||||
event="execute_function"
|
||||
href={`${base}/project-${$project.$id}/functions/function-${$func.$id}/executions/execute-function`}
|
||||
disabled={!$func.$id || !$func?.deployment}>
|
||||
Execute
|
||||
href={`${base}/project-${$project.$id}/functions/function-${data.func.$id}/executions/execute-function`}
|
||||
disabled={!data.func.$id || !data.func?.deployment}>
|
||||
<Icon icon={IconPlus} size="s" slot="start" />
|
||||
Create execution
|
||||
</Button>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
|
||||
{#if !$func.logging}
|
||||
{#if !data.func.logging}
|
||||
<div class="common-section">
|
||||
<Alert type="info" isStandalone>
|
||||
<svelte:fragment slot="title">Your execution logs are disabled</svelte:fragment>
|
||||
To view execution logs and errors, enable them in your
|
||||
<a
|
||||
href={`${base}/project-${$project.$id}/functions/function-${$func.$id}/settings`}
|
||||
href={`${base}/project-${$project.$id}/functions/function-${data.func.$id}/settings`}
|
||||
class="link">
|
||||
Function settings</a
|
||||
>.
|
||||
@@ -205,7 +84,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
{#if data?.executions?.total}
|
||||
<Table columns={$columns} {data} />
|
||||
<Table columns={$columns} logs={data.executions} />
|
||||
|
||||
<PaginationWithLimit
|
||||
name="Executions"
|
||||
@@ -213,22 +92,7 @@
|
||||
offset={data.offset}
|
||||
total={data.executions.total} />
|
||||
{:else if data?.query}
|
||||
<EmptySearch hidePages>
|
||||
<div class="common-section">
|
||||
<div class="u-text-center common-section">
|
||||
<b class="body-text-2 u-bold">Sorry we couldn't find any executions</b>
|
||||
<p>There are no executions that match your filters.</p>
|
||||
</div>
|
||||
<div class="u-flex u-gap-16 common-section u-main-center">
|
||||
<Button
|
||||
secondary
|
||||
on:click={() => {
|
||||
queries.clearAll();
|
||||
queries.apply();
|
||||
}}>Clear filters</Button>
|
||||
</div>
|
||||
</div>
|
||||
</EmptySearch>
|
||||
<EmptyFilter resource="executions"></EmptyFilter>
|
||||
{:else}
|
||||
<Empty
|
||||
single
|
||||
@@ -236,7 +100,7 @@
|
||||
href="https://appwrite.io/docs/products/functions/execution"
|
||||
on:click={() =>
|
||||
goto(
|
||||
`${base}/project-${$project.$id}/functions/function-${$func.$id}/executions/execute-function`
|
||||
`${base}/project-${$project.$id}/functions/function-${data.func.$id}/executions/execute-function`
|
||||
)}>
|
||||
</Empty>
|
||||
{/if}
|
||||
|
||||
+4
-1
@@ -5,7 +5,9 @@ import { Dependencies, PAGE_LIMIT } from '$lib/constants';
|
||||
import type { PageLoad } from './$types';
|
||||
import { queries, queryParamToMap } from '$lib/components/filters';
|
||||
|
||||
export const load: PageLoad = async ({ params, depends, url, route }) => {
|
||||
export const load: PageLoad = async ({ params, depends, url, route, parent }) => {
|
||||
const { function: func } = await parent();
|
||||
|
||||
depends(Dependencies.EXECUTIONS);
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
@@ -19,6 +21,7 @@ export const load: PageLoad = async ({ params, depends, url, route }) => {
|
||||
offset,
|
||||
limit,
|
||||
query,
|
||||
func,
|
||||
executions: await sdk.forProject.functions.listExecutions(params.function, [
|
||||
Query.limit(limit),
|
||||
Query.offset(offset),
|
||||
|
||||
+213
-251
@@ -3,31 +3,21 @@
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { timer } from '$lib/actions/timer';
|
||||
import { Alert, Card, Id } from '$lib/components';
|
||||
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Pill } from '$lib/elements';
|
||||
import {
|
||||
Button,
|
||||
Form,
|
||||
FormList,
|
||||
Helper,
|
||||
InputDate,
|
||||
InputSelect,
|
||||
InputSelectSearch,
|
||||
InputText,
|
||||
InputTextarea,
|
||||
InputTime
|
||||
} from '$lib/elements/forms';
|
||||
import { humanFileSize } from '$lib/helpers/sizeConvertion';
|
||||
import { calculateTime } from '$lib/helpers/timeConversion';
|
||||
import { WizardSecondaryContent, WizardSecondaryFooter } from '$lib/layout';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { ExecutionMethod, type Models } from '@appwrite.io/console';
|
||||
import { writable } from 'svelte/store';
|
||||
import { proxyRuleList } from '../../store';
|
||||
import {
|
||||
isSameDay,
|
||||
toLocaleDateISO,
|
||||
@@ -35,10 +25,19 @@
|
||||
toLocaleTimeISO
|
||||
} from '$lib/helpers/date';
|
||||
import { last } from '$lib/helpers/array';
|
||||
import { Icon, Tooltip } from '@appwrite.io/pink-svelte';
|
||||
import { IconPlus } from '@appwrite.io/pink-icons-svelte';
|
||||
import {
|
||||
Accordion,
|
||||
Alert,
|
||||
Fieldset,
|
||||
Icon,
|
||||
Input,
|
||||
Layout,
|
||||
Tooltip,
|
||||
Typography
|
||||
} from '@appwrite.io/pink-svelte';
|
||||
import { IconInfo, IconPlus, IconX } from '@appwrite.io/pink-icons-svelte';
|
||||
import Wizard from '$lib/layout/wizard.svelte';
|
||||
import { DeploymentCreatedBy, DeploymentDomains, DeploymentSource } from '$lib/components/git';
|
||||
import Aside from './aside.svelte';
|
||||
|
||||
let previousPage: string = `${base}/project-${$page.params.project}/functions/function-${$page.params.function}/executions`;
|
||||
|
||||
@@ -140,258 +139,221 @@
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Execute function - Appwrite</title>
|
||||
<title>Create execution - Appwrite</title>
|
||||
</svelte:head>
|
||||
|
||||
<Wizard title="Execute function" href={previousPage}>
|
||||
<svelte:fragment slot="title">Execute function</svelte:fragment>
|
||||
<WizardSecondaryContent>
|
||||
<Form bind:this={formComponent} onSubmit={handleSubmit} bind:isSubmitting>
|
||||
<FormList>
|
||||
{#if func?.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}
|
||||
<InputSelect
|
||||
required
|
||||
id="method"
|
||||
label="Method"
|
||||
options={methodOptions}
|
||||
bind:value={method} />
|
||||
<InputText
|
||||
label="Path"
|
||||
id="path"
|
||||
fullWidth
|
||||
placeholder="/"
|
||||
bind:value={path}
|
||||
required />
|
||||
<div>
|
||||
<h3>
|
||||
<span class="body-text-2 u-bold">Headers</span>
|
||||
<span class="optional">(optional)</span>
|
||||
<Tooltip placement="top"
|
||||
><span class="icon-info"></span>
|
||||
<div slot="tooltip">
|
||||
Headers should contain alphanumeric characters (a-z, A-Z, and
|
||||
0-9) and hyphens only (- and _).
|
||||
</div>
|
||||
</Tooltip>
|
||||
</h3>
|
||||
<Wizard title="Create execution" href={previousPage}>
|
||||
<svelte:fragment slot="title">Create execution</svelte:fragment>
|
||||
<Form bind:this={formComponent} onSubmit={handleSubmit} bind:isSubmitting>
|
||||
<Layout.Stack gap="xl">
|
||||
{#if func?.version === 'v2'}
|
||||
<Alert.Inline
|
||||
status="info"
|
||||
title="Customizable execution data now available for functions v3.0">
|
||||
<svelte:fragment slot="title"></svelte:fragment>
|
||||
|
||||
<FormList class="u-gap-8 u-margin-block-start-8">
|
||||
{#if headers}
|
||||
{#each headers as [name, value], index}
|
||||
<InputSelectSearch
|
||||
fullWidth
|
||||
label="Key"
|
||||
placeholder="Select key"
|
||||
interactiveOutput
|
||||
hideEmpty
|
||||
options={filteredKeyList}
|
||||
id={`key-${index}`}
|
||||
bind:value={name}
|
||||
bind:search={name}>
|
||||
</InputSelectSearch>
|
||||
<InputText
|
||||
label="Value"
|
||||
placeholder="Enter value"
|
||||
id={`value-${index}`}
|
||||
bind:value />
|
||||
<Button
|
||||
text
|
||||
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>
|
||||
{/each}
|
||||
{/if}
|
||||
</FormList>
|
||||
Update your function version to make use of new features including customizable
|
||||
HTTP data in your executions.
|
||||
<svelte:fragment slot="actions">
|
||||
<Button
|
||||
text
|
||||
disabled={headers?.length && headers[headers.length - 1][0]
|
||||
? false
|
||||
: true}
|
||||
on:click={() => {
|
||||
if (headers[headers.length - 1][0]) {
|
||||
headers.push(['', '']);
|
||||
headers = headers;
|
||||
}
|
||||
}}>
|
||||
<Icon icon={IconPlus} slot="start" size="s" />
|
||||
Add Header
|
||||
href="https://appwrite.io/docs/products/functions/development"
|
||||
external
|
||||
compact>
|
||||
Learn more
|
||||
</Button>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</Alert.Inline>
|
||||
<Fieldset legend="Request">
|
||||
<Accordion title="Body" badge="Optional" hideDivider open>
|
||||
<Layout.Stack gap="xl">
|
||||
<Typography.Text>
|
||||
Provide the request body to include the main data you want to send
|
||||
to the server.
|
||||
</Typography.Text>
|
||||
<InputTextarea
|
||||
placeholder="Enter request body here..."
|
||||
id="body"
|
||||
bind:value={body} />
|
||||
</Layout.Stack>
|
||||
</Accordion>
|
||||
</Fieldset>
|
||||
{:else}
|
||||
<Fieldset legend="Request">
|
||||
<Layout.Stack gap="xl">
|
||||
<Layout.GridFraction start={1} end={3}>
|
||||
<InputSelect
|
||||
required
|
||||
id="method"
|
||||
label="Method"
|
||||
options={methodOptions}
|
||||
bind:value={method} />
|
||||
<InputText
|
||||
label="Path"
|
||||
id="path"
|
||||
placeholder="/"
|
||||
bind:value={path}
|
||||
required />
|
||||
</Layout.GridFraction>
|
||||
|
||||
<InputTextarea
|
||||
label="Body"
|
||||
placeholder={`Hello, World!`}
|
||||
id="body"
|
||||
bind:value={body} />
|
||||
<Layout.Stack gap="s">
|
||||
<Accordion title="Headers" badge="Optional">
|
||||
<Layout.Stack gap="xl">
|
||||
<Typography.Text>
|
||||
Provide essential metadata to define the content type,
|
||||
authentication details, and the expected response format.
|
||||
</Typography.Text>
|
||||
|
||||
<li>
|
||||
<InputSelect
|
||||
bind:value={isScheduled}
|
||||
id="schedule"
|
||||
label="Schedule"
|
||||
options={[
|
||||
{
|
||||
label: 'Now',
|
||||
value: null
|
||||
},
|
||||
{
|
||||
label: 'Schedule',
|
||||
value: true
|
||||
}
|
||||
]} />
|
||||
{#if isScheduled}
|
||||
<InputDate
|
||||
id="date"
|
||||
label="Date"
|
||||
required={true}
|
||||
min={minDate}
|
||||
bind:value={date} />
|
||||
<InputTime
|
||||
id="time"
|
||||
label="Time"
|
||||
required={true}
|
||||
min={minTime}
|
||||
bind:value={time} />
|
||||
{/if}
|
||||
<Helper type="neutral">
|
||||
{isScheduled
|
||||
? `Your function will be executed on ${toLocaleDateTime(dateTime?.toString())}`
|
||||
: 'Your function will be executed immediately'}
|
||||
</Helper>
|
||||
</li>
|
||||
{/if}
|
||||
</FormList>
|
||||
</Form>
|
||||
<svelte:fragment slot="aside">
|
||||
<Card class="u-flex-vertical u-gap-24" style="--p-card-padding: 1.5rem">
|
||||
<div class="u-flex-vertical u-gap-8">
|
||||
<p class="u-color-text-offline">Deployment ID</p>
|
||||
<Layout.Stack gap="xs">
|
||||
{#if headers}
|
||||
{#each headers as [name, value], index}
|
||||
<Layout.Stack direction="row" alignItems="flex-end">
|
||||
<Input.ComboBox
|
||||
fullWidth
|
||||
label={index === 0 ? 'Key' : ''}
|
||||
placeholder="Select key"
|
||||
interactiveOutput
|
||||
hideEmpty
|
||||
options={filteredKeyList}
|
||||
id={`key-${index}`}
|
||||
bind:value={name}
|
||||
bind:search={name}>
|
||||
</Input.ComboBox>
|
||||
<InputText
|
||||
label={index === 0 ? 'Value' : ''}
|
||||
placeholder="Enter value"
|
||||
id={`value-${index}`}
|
||||
bind:value>
|
||||
<span slot="info">
|
||||
<Tooltip>
|
||||
<Layout.Stack alignItems="center">
|
||||
<Icon
|
||||
icon={IconInfo}
|
||||
size="s" />
|
||||
</Layout.Stack>
|
||||
<span slot="tooltip">
|
||||
Values should contain
|
||||
alphanumeric characters (a-z,
|
||||
A-Z, and 0-9) and hyphens only
|
||||
(- and _).
|
||||
</span>
|
||||
</Tooltip>
|
||||
</span>
|
||||
</InputText>
|
||||
<Button
|
||||
text
|
||||
icon
|
||||
disabled={(!name || !value) && index === 0}
|
||||
on:click={() => {
|
||||
if (index === 0) {
|
||||
headers = [['', '']];
|
||||
} else {
|
||||
headers.splice(index, 1);
|
||||
headers = headers;
|
||||
}
|
||||
}}>
|
||||
<Icon icon={IconX} />
|
||||
</Button>
|
||||
</Layout.Stack>
|
||||
{/each}
|
||||
{/if}
|
||||
<div>
|
||||
<Button
|
||||
compact
|
||||
disabled={headers?.length &&
|
||||
headers[headers.length - 1][0]
|
||||
? false
|
||||
: true}
|
||||
on:click={() => {
|
||||
if (headers[headers.length - 1][0]) {
|
||||
headers.push(['', '']);
|
||||
headers = headers;
|
||||
}
|
||||
}}>
|
||||
<Icon icon={IconPlus} slot="start" size="s" />
|
||||
Add header
|
||||
</Button>
|
||||
</div>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</Accordion>
|
||||
|
||||
<Id value={func.deployment}>
|
||||
{func.deployment}
|
||||
</Id>
|
||||
</div>
|
||||
<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>
|
||||
<Pill success>
|
||||
<span class="icon-lightning-bolt"></span><span>active</span>
|
||||
</Pill>
|
||||
<!-- {#if deployment?.$id === func.deployment && deployment?.status === 'active'}
|
||||
{:else}
|
||||
<Pill
|
||||
danger={deployment?.status === 'failed'}
|
||||
warning={deployment?.status === 'building'}
|
||||
info={deployment?.status === 'ready'}>
|
||||
{deployment?.status}
|
||||
</Pill>
|
||||
{/if} -->
|
||||
</p>
|
||||
</li>
|
||||
<li class="u-flex-vertical u-gap-8">
|
||||
<p class="u-color-text-offline">Build duration</p>
|
||||
<p>
|
||||
{#if ['processing', 'building'].includes(deployment.status)}
|
||||
<span use:timer={{ start: deployment.$createdAt }} />
|
||||
{:else}
|
||||
{calculateTime(deployment.buildDuration)}
|
||||
<Accordion title="Body" badge="Optional" hideDivider>
|
||||
<Layout.Stack gap="xl">
|
||||
<Typography.Text>
|
||||
Provide the request body to include the main data you want
|
||||
to send to the server.
|
||||
</Typography.Text>
|
||||
<InputTextarea
|
||||
placeholder="Enter request body here..."
|
||||
id="body"
|
||||
bind:value={body} />
|
||||
</Layout.Stack>
|
||||
</Accordion>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</Fieldset>
|
||||
|
||||
<Fieldset legend="Settings">
|
||||
<Layout.Stack gap="l">
|
||||
<Layout.Stack gap="xs">
|
||||
<InputSelect
|
||||
bind:value={isScheduled}
|
||||
id="schedule"
|
||||
label="Schedule"
|
||||
required
|
||||
options={[
|
||||
{
|
||||
label: 'Now',
|
||||
value: null
|
||||
},
|
||||
{
|
||||
label: 'Custom',
|
||||
value: true
|
||||
}
|
||||
]} />
|
||||
{#if !isScheduled}
|
||||
<Helper type="neutral">
|
||||
Your function will be executed immediately
|
||||
</Helper>
|
||||
{/if}
|
||||
</p>
|
||||
</li>
|
||||
<li class="u-flex-vertical u-gap-8">
|
||||
<p class="u-color-text-offline">Total size</p>
|
||||
<p>
|
||||
{humanFileSize(deployment.sourceSize + deployment.buildSize).value +
|
||||
humanFileSize(deployment.sourceSize + deployment.buildSize).unit}
|
||||
<Tooltip>
|
||||
<button
|
||||
type="button"
|
||||
on:click|preventDefault
|
||||
aria-label="input tooltip">
|
||||
<span
|
||||
class="icon-info"
|
||||
aria-hidden="true"
|
||||
style="font-size: var(--icon-size-small)" />
|
||||
</button>
|
||||
<div slot="tooltip">
|
||||
<p>
|
||||
<b>Deployment size:</b>
|
||||
{humanFileSize(deployment.sourceSize).value +
|
||||
humanFileSize(deployment.sourceSize).unit}
|
||||
</p>
|
||||
<p>
|
||||
<b>Build size:</b>
|
||||
{humanFileSize(deployment.buildSize).value +
|
||||
humanFileSize(deployment.buildSize).unit}
|
||||
</p>
|
||||
</div>
|
||||
</Tooltip>
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="u-flex-vertical u-gap-8">
|
||||
<p class="u-color-text-offline">Source</p>
|
||||
<span>
|
||||
<DeploymentSource {deployment} />
|
||||
</span>
|
||||
</div>
|
||||
{#if $proxyRuleList?.rules?.length}
|
||||
<div class="u-flex-vertical u-gap-8">
|
||||
<p class="u-color-text-offline">Domains</p>
|
||||
<span>
|
||||
<DeploymentDomains domains={$proxyRuleList} />
|
||||
</span>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="u-flex-vertical u-gap-8">
|
||||
<p class="u-color-text-offline">Updated</p>
|
||||
<span>
|
||||
<DeploymentCreatedBy {deployment} />
|
||||
</span>
|
||||
</div>
|
||||
</Card>
|
||||
</svelte:fragment>
|
||||
</WizardSecondaryContent>
|
||||
</Layout.Stack>
|
||||
{#if isScheduled}
|
||||
<Layout.Stack gap="xs">
|
||||
<Layout.GridFraction start={3} end={1}>
|
||||
<InputDate
|
||||
id="date"
|
||||
required={true}
|
||||
min={minDate}
|
||||
bind:value={date} />
|
||||
<InputTime
|
||||
id="time"
|
||||
required={true}
|
||||
min={minTime}
|
||||
bind:value={time} />
|
||||
</Layout.GridFraction>
|
||||
<Helper type="neutral">
|
||||
Your function will be executed on {toLocaleDateTime(
|
||||
dateTime?.toString()
|
||||
)}
|
||||
</Helper>
|
||||
</Layout.Stack>
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
</Fieldset>
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
</Form>
|
||||
<svelte:fragment slot="aside">
|
||||
<Aside {deployment} proxyRuleList={data.proxyRuleList} />
|
||||
</svelte:fragment>
|
||||
|
||||
<WizardSecondaryFooter>
|
||||
<svelte:fragment slot="footer">
|
||||
<Button fullWidthMobile secondary href={previousPage}>Cancel</Button>
|
||||
<Button
|
||||
fullWidthMobile
|
||||
on:click={() => formComponent.triggerSubmit()}
|
||||
disabled={$isSubmitting}>
|
||||
Execute
|
||||
Create
|
||||
</Button>
|
||||
</WizardSecondaryFooter>
|
||||
</svelte:fragment>
|
||||
</Wizard>
|
||||
+3
-1
@@ -1,6 +1,7 @@
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import type { PageLoad } from './$types';
|
||||
import { proxyRuleList } from '../../store';
|
||||
|
||||
export const load: PageLoad = async ({ params, depends, parent }) => {
|
||||
const data = await parent();
|
||||
@@ -13,6 +14,7 @@ export const load: PageLoad = async ({ params, depends, parent }) => {
|
||||
params.function,
|
||||
data.function.deployment
|
||||
)
|
||||
: null
|
||||
: null,
|
||||
proxyRuleList: data.proxyRuleList
|
||||
};
|
||||
};
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
<script lang="ts">
|
||||
import { Card, Id } from '$lib/components';
|
||||
import { Icon, Layout, Tooltip, Typography } from '@appwrite.io/pink-svelte';
|
||||
import { IconInfo } from '@appwrite.io/pink-icons-svelte';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { DeploymentCreatedBy, DeploymentDomains, DeploymentSource } from '$lib/components/git';
|
||||
import { humanFileSize } from '$lib/helpers/sizeConvertion';
|
||||
import { timer } from '$lib/actions/timer';
|
||||
import { formatTimeDetailed } from '$lib/helpers/timeConversion';
|
||||
|
||||
export let deployment: Models.Deployment;
|
||||
export let proxyRuleList: Models.ProxyRuleList;
|
||||
</script>
|
||||
|
||||
<Card padding="s" radius="s">
|
||||
<Layout.Stack gap="xl">
|
||||
<slot />
|
||||
<Layout.Stack gap="l">
|
||||
<Layout.Stack gap="xxxs">
|
||||
<Typography.Caption variant="400">Deployment ID</Typography.Caption>
|
||||
|
||||
<Id value={deployment.$id}>
|
||||
{deployment.$id}
|
||||
</Id>
|
||||
</Layout.Stack>
|
||||
|
||||
<Layout.Stack gap="xxxs">
|
||||
<Typography.Caption variant="400">Build duration</Typography.Caption>
|
||||
<Typography.Text variant="m-500" color="--fgcolor-neutral-primary">
|
||||
{#if ['processing', 'building'].includes(deployment.status)}
|
||||
<span use:timer={{ start: deployment.$createdAt }} />
|
||||
{:else}
|
||||
{formatTimeDetailed(deployment.buildDuration)}
|
||||
{/if}
|
||||
</Typography.Text>
|
||||
</Layout.Stack>
|
||||
<Layout.Stack gap="xxxs">
|
||||
<Typography.Caption variant="400">Size</Typography.Caption>
|
||||
<Typography.Text variant="m-500" color="--fgcolor-neutral-primary">
|
||||
<Layout.Stack gap="xxs" alignItems="center" direction="row">
|
||||
{humanFileSize(deployment.sourceSize + deployment.buildSize).value +
|
||||
humanFileSize(deployment.sourceSize + deployment.buildSize).unit}
|
||||
<Tooltip>
|
||||
<Icon icon={IconInfo} color="--fgcolor-neutral-tertiary" size="s" />
|
||||
<span slot="tooltip">
|
||||
<p>
|
||||
<b>Deployment size:</b>
|
||||
{humanFileSize(deployment.sourceSize).value +
|
||||
humanFileSize(deployment.sourceSize).unit}
|
||||
</p>
|
||||
<p>
|
||||
<b>Build size:</b>
|
||||
{humanFileSize(deployment.buildSize).value +
|
||||
humanFileSize(deployment.buildSize).unit}
|
||||
</p>
|
||||
</span>
|
||||
</Tooltip>
|
||||
</Layout.Stack>
|
||||
</Typography.Text>
|
||||
</Layout.Stack>
|
||||
<Layout.Stack gap="xxxs">
|
||||
<Typography.Caption variant="400">Source</Typography.Caption>
|
||||
<Typography.Text variant="m-500" color="--fgcolor-neutral-primary">
|
||||
<DeploymentSource {deployment} />
|
||||
</Typography.Text>
|
||||
</Layout.Stack>
|
||||
{#if proxyRuleList?.total}
|
||||
<Layout.Stack gap="xxxs">
|
||||
<Typography.Caption variant="400">Domains</Typography.Caption>
|
||||
<Typography.Text variant="m-500" color="--fgcolor-neutral-primary">
|
||||
<DeploymentDomains domains={proxyRuleList} />
|
||||
</Typography.Text>
|
||||
</Layout.Stack>
|
||||
{/if}
|
||||
|
||||
<Layout.Stack gap="xxxs">
|
||||
<Typography.Caption variant="400">Updated</Typography.Caption>
|
||||
<Typography.Text variant="m-500" color="--fgcolor-neutral-primary">
|
||||
<DeploymentCreatedBy {deployment} />
|
||||
</Typography.Text>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</Card>
|
||||
-3
@@ -1,18 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { afterNavigate } from '$app/navigation';
|
||||
import { Submit, trackEvent } from '$lib/actions/analytics';
|
||||
import { DropList, DropListItem } from '$lib/components';
|
||||
import MenuItem from '$lib/components/filters/subMenu.svelte';
|
||||
import {
|
||||
addFilter,
|
||||
queries,
|
||||
queryParamToMap,
|
||||
tagFormat,
|
||||
tags,
|
||||
ValidOperators,
|
||||
type TagValue
|
||||
} from '$lib/components/filters/store';
|
||||
import { Pill, SelectSearchCheckbox } from '$lib/elements';
|
||||
import type { Column } from '$lib/helpers/types';
|
||||
import { Card, Icon } from '@appwrite.io/pink-svelte';
|
||||
import { melt, createMenubar } from '@melt-ui/svelte';
|
||||
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
<script lang="ts">
|
||||
import Button from '$lib/elements/forms/button.svelte';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { IconChevronDown, IconChevronUp } from '@appwrite.io/pink-icons-svelte';
|
||||
import { calculateTime } from '$lib/helpers/timeConversion';
|
||||
import {
|
||||
Accordion,
|
||||
Badge,
|
||||
InteractiveText,
|
||||
Icon,
|
||||
Layout,
|
||||
Sheet,
|
||||
Tag,
|
||||
Typography
|
||||
} from '@appwrite.io/pink-svelte';
|
||||
import { timeFromNow } from '$lib/helpers/date';
|
||||
import { capitalize } from '$lib/helpers/string';
|
||||
import { Copy } from '$lib/components';
|
||||
|
||||
export let open = false;
|
||||
export let selectedLogId: string;
|
||||
export let logs: Models.Execution[];
|
||||
|
||||
function nextLog() {
|
||||
const currentIndex = logs.findIndex((log) => log.$id === selectedLogId);
|
||||
if (currentIndex < logs.length - 1) {
|
||||
selectedLogId = logs[currentIndex + 1].$id;
|
||||
}
|
||||
}
|
||||
function previousLog() {
|
||||
const currentIndex = logs.findIndex((log) => log.$id === selectedLogId);
|
||||
if (currentIndex > 0) {
|
||||
selectedLogId = logs[currentIndex - 1].$id;
|
||||
}
|
||||
}
|
||||
$: if (!open) {
|
||||
selectedLogId = null;
|
||||
}
|
||||
|
||||
$: selectedLog = logs?.find((log) => log.$id === selectedLogId);
|
||||
$: isFirstLog = logs.findIndex((log) => log.$id === selectedLogId) === 0;
|
||||
$: isLastLog = logs.findIndex((log) => log.$id === selectedLogId) === logs.length - 1;
|
||||
$: console.log(selectedLog);
|
||||
</script>
|
||||
|
||||
<Sheet bind:open>
|
||||
<div slot="header" style:width="100%">
|
||||
<Layout.Stack direction="row" justifyContent="space-between" alignItems="center">
|
||||
<Layout.Stack direction="row" gap="m" alignItems="center">
|
||||
<Typography.Text variant="m-400">Log ID</Typography.Text>
|
||||
<Copy value={selectedLog?.$id}>
|
||||
<Tag size="s" variant="code">{selectedLog?.$id}</Tag>
|
||||
</Copy>
|
||||
</Layout.Stack>
|
||||
<Layout.Stack direction="row" gap="xs" alignItems="center" inline>
|
||||
<Button icon text size="xs" on:click={previousLog} disabled={isFirstLog}>
|
||||
<Icon icon={IconChevronUp} />
|
||||
</Button>
|
||||
<Button icon text size="xs" on:click={nextLog} disabled={isLastLog}>
|
||||
<Icon icon={IconChevronDown} />
|
||||
</Button>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</div>
|
||||
{#if selectedLog}
|
||||
<Layout.Stack gap="xl">
|
||||
<Accordion title="Details" open>
|
||||
<Layout.Stack gap="xl">
|
||||
<Layout.Stack direction="row">
|
||||
<Layout.Grid columnsXS={2} columns={4} gap="xxxl" rowGap="xl">
|
||||
<Layout.Stack gap="xs" inline>
|
||||
<Typography.Text variant="m-400" color="--fgcolor-neutral-tertiary">
|
||||
Method
|
||||
</Typography.Text>
|
||||
<Typography.Text variant="m-400">
|
||||
{selectedLog.requestMethod}
|
||||
</Typography.Text>
|
||||
</Layout.Stack>
|
||||
<Layout.Stack gap="xs" inline>
|
||||
<Typography.Text variant="m-400" color="--fgcolor-neutral-tertiary">
|
||||
Status
|
||||
</Typography.Text>
|
||||
<span>
|
||||
<Badge
|
||||
content={selectedLog.responseStatusCode.toString()}
|
||||
variant="secondary"
|
||||
type={selectedLog?.responseStatusCode >= 400
|
||||
? 'error'
|
||||
: 'success'} />
|
||||
</span>
|
||||
</Layout.Stack>
|
||||
<Layout.Stack gap="xs" inline>
|
||||
<Typography.Text variant="m-400" color="--fgcolor-neutral-tertiary">
|
||||
Duration
|
||||
</Typography.Text>
|
||||
<Typography.Text variant="m-400">
|
||||
{calculateTime(selectedLog.duration)}
|
||||
</Typography.Text>
|
||||
</Layout.Stack>
|
||||
<Layout.Stack gap="xs" inline>
|
||||
<Typography.Text variant="m-400" color="--fgcolor-neutral-tertiary">
|
||||
Created
|
||||
</Typography.Text>
|
||||
<Typography.Text variant="m-400">
|
||||
{capitalize(timeFromNow(selectedLog.$createdAt))}
|
||||
</Typography.Text>
|
||||
</Layout.Stack>
|
||||
</Layout.Grid>
|
||||
</Layout.Stack>
|
||||
|
||||
<Layout.Stack gap="xs" inline alignItems="flex-start">
|
||||
<Typography.Text variant="m-400" color="--fgcolor-neutral-tertiary">
|
||||
Path
|
||||
</Typography.Text>
|
||||
<div>
|
||||
<InteractiveText
|
||||
text={selectedLog.requestPath}
|
||||
variant="copy-code"
|
||||
isVisible />
|
||||
</div>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</Accordion>
|
||||
<Accordion title="Request" open>
|
||||
<!-- <LogsRequest {selectedLog} /> -->
|
||||
</Accordion>
|
||||
<Accordion title="Response" open hideDivider>
|
||||
<!-- <LogsResponse {selectedLog} /> -->
|
||||
</Accordion>
|
||||
</Layout.Stack>
|
||||
{/if}
|
||||
</Sheet>
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
import type { Column } from '$lib/helpers/types';
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
export const columns = writable<Column[]>([
|
||||
{ id: '$id', title: 'Execution ID', type: 'string', show: true, width: 150 },
|
||||
|
||||
{
|
||||
id: '$createdAt',
|
||||
title: 'Created',
|
||||
type: 'datetime',
|
||||
show: true,
|
||||
width: 120,
|
||||
format: 'datetime',
|
||||
elements: [
|
||||
{
|
||||
value: 5 * 60 * 1000,
|
||||
label: 'last 5 minutes'
|
||||
},
|
||||
{
|
||||
value: 60 * 60 * 1000,
|
||||
label: 'last 1 hour'
|
||||
},
|
||||
{
|
||||
value: 24 * 60 * 60 * 1000,
|
||||
label: 'last 24 hours'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 'trigger',
|
||||
title: 'Trigger',
|
||||
type: 'string',
|
||||
show: false,
|
||||
width: 90,
|
||||
array: true,
|
||||
format: 'enum',
|
||||
elements: [
|
||||
{ value: 'http', label: 'HTTP' },
|
||||
{ value: 'schedule', label: 'Schedule' },
|
||||
{ value: 'event', label: 'Event' }
|
||||
],
|
||||
hide: true
|
||||
},
|
||||
{
|
||||
id: 'requestMethod',
|
||||
title: 'Method',
|
||||
type: 'string',
|
||||
show: false,
|
||||
width: 70,
|
||||
array: true,
|
||||
format: 'enum',
|
||||
elements: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'],
|
||||
hide: true
|
||||
},
|
||||
{
|
||||
id: 'responseStatusCode',
|
||||
title: 'Status code',
|
||||
type: 'integer',
|
||||
show: false,
|
||||
width: 100,
|
||||
format: 'integer',
|
||||
elements: [
|
||||
{
|
||||
value: 299,
|
||||
label: 'Success (200-299)'
|
||||
},
|
||||
{
|
||||
value: 399,
|
||||
label: 'Redirect (300-399)'
|
||||
},
|
||||
{
|
||||
value: 499,
|
||||
label: 'Client error (400-499)'
|
||||
},
|
||||
{
|
||||
value: 599,
|
||||
label: 'Server error (500-599)'
|
||||
}
|
||||
],
|
||||
hide: true
|
||||
},
|
||||
{
|
||||
id: 'requestPath',
|
||||
title: 'Path',
|
||||
type: 'string',
|
||||
show: true,
|
||||
width: 90,
|
||||
format: 'string'
|
||||
},
|
||||
{
|
||||
id: 'status',
|
||||
title: 'Status',
|
||||
type: 'enum',
|
||||
show: true,
|
||||
width: 130,
|
||||
array: true,
|
||||
format: 'enum',
|
||||
elements: ['completed', 'failed', 'waiting', 'scheduled', 'processing', 'cancelled']
|
||||
},
|
||||
{
|
||||
id: 'duration',
|
||||
title: 'Duration',
|
||||
type: 'integer',
|
||||
show: true,
|
||||
width: 80,
|
||||
format: 'integer',
|
||||
elements: [
|
||||
{
|
||||
value: 1,
|
||||
label: 'more than 1 second'
|
||||
},
|
||||
{
|
||||
value: 5,
|
||||
label: 'more than 5 seconds'
|
||||
},
|
||||
{
|
||||
value: 30,
|
||||
label: 'more than 30 seconds'
|
||||
}
|
||||
]
|
||||
}
|
||||
]);
|
||||
+86
-116
@@ -1,154 +1,124 @@
|
||||
<script lang="ts">
|
||||
import { DropList, DropListItem, Id } from '$lib/components';
|
||||
import {
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableCellHead,
|
||||
TableCellText,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
TableScroll
|
||||
} from '$lib/elements/table';
|
||||
import { Id } from '$lib/components';
|
||||
import { timeFromNow, toLocaleDateTime } from '$lib/helpers/date';
|
||||
import { type Models } from '@appwrite.io/console';
|
||||
import type { Column } from '$lib/helpers/types';
|
||||
import { Pill } from '$lib/elements';
|
||||
import { calculateTime } from '$lib/helpers/timeConversion';
|
||||
import { log } from '$lib/stores/logs';
|
||||
import { func } from '../store';
|
||||
import Delete from './delete.svelte';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { Tooltip, Table } from '@appwrite.io/pink-svelte';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
let showDropdown = [];
|
||||
let showDelete = false;
|
||||
|
||||
let selectedExecution: Models.Execution = null;
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { Badge, Layout, Status, Table, Tooltip, Typography } from '@appwrite.io/pink-svelte';
|
||||
import Sheet from './sheet.svelte';
|
||||
import { capitalize } from '$lib/helpers/string';
|
||||
import { formatTimeDetailed } from '$lib/helpers/timeConversion';
|
||||
|
||||
export let columns: Column[];
|
||||
export let data: PageData;
|
||||
export let logs: Models.ExecutionList;
|
||||
|
||||
let execution: Record<string, Models.Execution> = {};
|
||||
let openSheet = false;
|
||||
let selectedLogId: string = null;
|
||||
|
||||
$: data.executions.executions.forEach((s) => {
|
||||
execution[s.$id] = s;
|
||||
});
|
||||
$: console.log(columns);
|
||||
|
||||
function showLogs(execution: Models.Execution) {
|
||||
$log.show = true;
|
||||
$log.func = $func;
|
||||
$log.data = execution;
|
||||
export function logStatusConverter(status: string) {
|
||||
// ['completed', 'failed', 'waiting', 'scheduled', 'processing', 'cancelled']
|
||||
|
||||
switch (status) {
|
||||
case 'completed':
|
||||
return 'complete';
|
||||
case 'scheduled':
|
||||
return 'ready';
|
||||
case 'processing':
|
||||
return 'processing';
|
||||
case 'waiting':
|
||||
return 'waiting';
|
||||
case 'peding':
|
||||
return 'pending';
|
||||
case 'cancelled':
|
||||
return 'waiting';
|
||||
case 'failed':
|
||||
return 'failed';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<Table.Root>
|
||||
<svelte:fragment slot="header">
|
||||
{#each columns as column}
|
||||
{#if column.show}
|
||||
<Table.Header.Cell width={column.width.toString()}
|
||||
>{column.title}</Table.Header.Cell>
|
||||
{#if column.show && !column.hide}
|
||||
<Table.Header.Cell width={column.width + 'px'}>{column.title}</Table.Header.Cell>
|
||||
{/if}
|
||||
{/each}
|
||||
<Table.Header.Cell width="40" />
|
||||
</svelte:fragment>
|
||||
{#each data.executions.executions as execution, index (execution.$id)}
|
||||
<Table.Row>
|
||||
{#each logs.executions as log}
|
||||
<Table.Button
|
||||
on:click={() => {
|
||||
openSheet = true;
|
||||
selectedLogId = log.$id;
|
||||
}}>
|
||||
{#each columns as column}
|
||||
{#if column.show}
|
||||
{#if column.show && !column.hide}
|
||||
{#if column.id === '$id'}
|
||||
{#key column.id}
|
||||
<Table.Cell>
|
||||
<Id value={execution.$id}>{execution.$id}</Id>
|
||||
<Id value={log.$id}>{log.$id}</Id>
|
||||
</Table.Cell>
|
||||
{/key}
|
||||
{:else if column.id === 'status'}
|
||||
<Table.Cell>
|
||||
{@const status = execution.status}
|
||||
<Tooltip disabled={!execution?.scheduledAt || status !== 'scheduled'}>
|
||||
<div>
|
||||
<Pill
|
||||
warning={status === 'waiting' || status === 'building'}
|
||||
danger={status === 'failed'}
|
||||
info={status === 'completed' || status === 'ready'}>
|
||||
{#if status === 'scheduled'}
|
||||
<span class="icon-clock" aria-hidden="true" />
|
||||
{timeFromNow(execution.scheduledAt)}
|
||||
{:else}
|
||||
{status}
|
||||
{/if}
|
||||
</Pill>
|
||||
</div>
|
||||
<span slot="tooltip"
|
||||
>{`Scheduled to execute on ${toLocaleDateTime(execution.scheduledAt)}`}</span>
|
||||
</Tooltip>
|
||||
</Table.Cell>
|
||||
{:else if column.id === '$createdAt'}
|
||||
<Table.Cell>
|
||||
{timeFromNow(execution.$createdAt)}
|
||||
</Table.Cell>
|
||||
{:else if column.id === 'trigger'}
|
||||
<Table.Cell>
|
||||
<Pill>
|
||||
<span class="text u-trim">{execution.trigger}</span>
|
||||
</Pill>
|
||||
</Table.Cell>
|
||||
{:else if column.id === 'requestMethod'}
|
||||
<Table.Cell>
|
||||
{execution.requestMethod}
|
||||
</Table.Cell>
|
||||
{:else if column.id === 'responseStatusCode'}
|
||||
<Table.Cell>
|
||||
{execution.responseStatusCode}
|
||||
{capitalize(timeFromNow(log.$createdAt))}
|
||||
</Table.Cell>
|
||||
{:else if column.id === 'requestPath'}
|
||||
<Table.Cell>
|
||||
{execution.requestPath}
|
||||
<Layout.Stack direction="row" alignItems="center" gap="s">
|
||||
<Badge
|
||||
variant="secondary"
|
||||
type={log.responseStatusCode >= 400
|
||||
? 'error'
|
||||
: log.responseStatusCode === 0
|
||||
? undefined
|
||||
: 'success'}
|
||||
content={log.responseStatusCode.toString()} />
|
||||
<Typography.Code size="m">
|
||||
{log.requestMethod}
|
||||
</Typography.Code>
|
||||
<Typography.Code size="m">
|
||||
{log.requestPath}
|
||||
</Typography.Code>
|
||||
</Layout.Stack>
|
||||
</Table.Cell>
|
||||
{:else if column.id === 'responseStatusCode'}
|
||||
<Table.Cell>
|
||||
{log.responseStatusCode}
|
||||
</Table.Cell>
|
||||
{:else if column.id === 'status'}
|
||||
<Table.Cell>
|
||||
{@const status = log.status}
|
||||
<Tooltip
|
||||
disabled={!log?.scheduledAt || status !== 'scheduled'}
|
||||
maxWidth="400px">
|
||||
<div>
|
||||
<Status
|
||||
status={logStatusConverter(status)}
|
||||
label={capitalize(status)}>
|
||||
{#if status === 'scheduled'}
|
||||
<span class="icon-clock" aria-hidden="true" />
|
||||
{timeFromNow(log.scheduledAt)}
|
||||
{:else}
|
||||
{status}
|
||||
{/if}
|
||||
</Status>
|
||||
</div>
|
||||
<span slot="tooltip">
|
||||
{`Scheduled to execute on ${toLocaleDateTime(log.scheduledAt)}`}
|
||||
</span>
|
||||
</Tooltip>
|
||||
</Table.Cell>
|
||||
{:else if column.id === 'duration'}
|
||||
<Table.Cell>
|
||||
{calculateTime(execution.duration)}
|
||||
{formatTimeDetailed(log.duration)}
|
||||
</Table.Cell>
|
||||
{/if}
|
||||
{/if}
|
||||
{/each}
|
||||
<Table.Cell>
|
||||
<DropList bind:show={showDropdown[index]} placement="bottom-start" noArrow>
|
||||
<Button
|
||||
icon
|
||||
text
|
||||
ariaLabel="More options"
|
||||
on:click={() => {
|
||||
showDropdown[index] = !showDropdown[index];
|
||||
}}>
|
||||
<span class="icon-dots-horizontal" aria-hidden="true" />
|
||||
</Button>
|
||||
<svelte:fragment slot="list">
|
||||
<DropListItem
|
||||
icon="terminal"
|
||||
on:click={() => {
|
||||
showDropdown = [];
|
||||
showLogs(execution);
|
||||
}}>
|
||||
Logs
|
||||
</DropListItem>
|
||||
<DropListItem
|
||||
icon="trash"
|
||||
event="execution_delete"
|
||||
on:click={() => {
|
||||
selectedExecution = execution;
|
||||
showDropdown = [];
|
||||
showDelete = true;
|
||||
}}>
|
||||
Delete
|
||||
</DropListItem>
|
||||
</svelte:fragment>
|
||||
</DropList>
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
</Table.Button>
|
||||
{/each}
|
||||
</Table.Root>
|
||||
|
||||
{#if selectedExecution}
|
||||
<Delete {selectedExecution} bind:showDelete />
|
||||
{/if}
|
||||
<Sheet bind:open={openSheet} bind:selectedLogId logs={logs.executions} />
|
||||
Reference in new issue
Block a user