mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
Merge branch 'feat-g4' of github.com:appwrite/console into copy-wizards and fixes
This commit is contained in:
commit
44e74a3f6c
95 files changed
+2603
-1736
No files matched your search
Generated
+1151
-597
File diff suppressed because it is too large.
Load diff
+3
-3
@@ -19,10 +19,10 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@analytics/google-analytics": "^1.0.5",
|
||||
"@appwrite.io/console": "npm:matej-appwrite-console@7.1.125",
|
||||
"@appwrite.io/pink": "0.0.7-next.1",
|
||||
"@appwrite.io/pink-icons": "0.0.7-next.1",
|
||||
"@analytics/google-tag-manager": "^0.5.3",
|
||||
"@appwrite.io/console": "npm:matej-appwrite-console@7.1.126",
|
||||
"@appwrite.io/pink": "0.1.0-next.3",
|
||||
"@appwrite.io/pink-icons": "^0.1.0-next.3",
|
||||
"@popperjs/core": "^2.11.6",
|
||||
"@sentry/svelte": "^7.44.2",
|
||||
"@sentry/tracing": "^7.44.2",
|
||||
|
||||
@@ -187,6 +187,7 @@ export enum Submit {
|
||||
FunctionUpdateLogging = 'submit_function_update_logging',
|
||||
FunctionUpdateTimeout = 'submit_function_update_timeout',
|
||||
FunctionUpdateEvents = 'submit_function_update_events',
|
||||
FunctionConnectRepo = 'submit_function_disconnect_repo',
|
||||
FunctionDisconnectRepo = 'submit_function_disconnect_repo',
|
||||
FunctionRedeploy = 'submit_function_redeploy',
|
||||
DeploymentCreate = 'submit_deployment_create',
|
||||
|
||||
@@ -5,7 +5,16 @@
|
||||
export let icons: string[] = [];
|
||||
export let total = avatars.length;
|
||||
export let size = 40;
|
||||
export let avatarSize: keyof typeof Sizes = 'medium';
|
||||
export let bordered = false;
|
||||
|
||||
enum Sizes {
|
||||
xsmall = 'is-size-x-small',
|
||||
small = 'is-size-small',
|
||||
medium = '',
|
||||
large = 'is-size-large',
|
||||
xlarge = 'is-size-x-large'
|
||||
}
|
||||
</script>
|
||||
|
||||
<ul class="avatars-group" class:is-with-border={bordered}>
|
||||
@@ -19,13 +28,13 @@
|
||||
|
||||
{#each icons as icon}
|
||||
<li class="avatars-group-item">
|
||||
<span class="avatar"><span class={`icon-${icon}`} /></span>
|
||||
<span class="avatar {Sizes[avatarSize]}"><span class={`icon-${icon}`} /></span>
|
||||
</li>
|
||||
{/each}
|
||||
|
||||
{#if total > 2}
|
||||
<li class="avatars-group-item">
|
||||
<div class="avatar">+{total - 2}</div>
|
||||
<div class="avatar {Sizes[avatarSize]}">+{total - 2}</div>
|
||||
</li>
|
||||
{/if}
|
||||
</ul>
|
||||
@@ -1,9 +1,20 @@
|
||||
<div class="box">
|
||||
<div class="u-flex u-gap-16">
|
||||
<slot name="image" />
|
||||
<div class="u-cross-child-center u-line-height-1-5">
|
||||
<slot name="title" />
|
||||
<slot />
|
||||
</div>
|
||||
</div>
|
||||
<script lang="ts">
|
||||
export let radius: keyof typeof radiuses = 'small';
|
||||
export let padding = 24;
|
||||
let classes = '';
|
||||
export { classes as class };
|
||||
|
||||
enum radiuses {
|
||||
xsmall = '--border-radius-extra-large',
|
||||
small = '--border-radius-small',
|
||||
medium = '--border-radius-medium',
|
||||
large = '--border-radius-large'
|
||||
}
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="box {classes}"
|
||||
style:--box-border-radius={`var(${radiuses[radius]})`}
|
||||
style:--box-padding={`${padding / 16}rem`}>
|
||||
<slot />
|
||||
</div>
|
||||
@@ -0,0 +1,9 @@
|
||||
<div class="box">
|
||||
<div class="u-flex u-gap-16">
|
||||
<slot name="image" />
|
||||
<div class="u-cross-child-center u-line-height-1-5">
|
||||
<slot name="title" />
|
||||
<slot />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -11,7 +11,9 @@
|
||||
<slot name="beforetitle" />
|
||||
<div>
|
||||
<span class="text"><slot name="title" /></span>
|
||||
<span class="collapsible-button-optional"><slot name="subtitle" /></span>
|
||||
{#if $$slots.subtitle}
|
||||
<span class="collapsible-button-optional"><slot name="subtitle" /></span>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="icon">
|
||||
<span class="icon-cheveron-down" aria-hidden="true" />
|
||||
|
||||
@@ -29,6 +29,7 @@ export { default as AvatarInitials } from './avatarInitials.svelte';
|
||||
export { default as AvatarGroup } from './avatarGroup.svelte';
|
||||
export { default as Alert } from './alert.svelte';
|
||||
export { default as Box } from './box.svelte';
|
||||
export { default as BoxAvatar } from './boxAvatar.svelte';
|
||||
export { default as Search } from './search.svelte';
|
||||
export { default as SearchQuery } from './searchQuery.svelte';
|
||||
export { default as GridItem1 } from './gridItem1.svelte';
|
||||
|
||||
@@ -31,10 +31,14 @@
|
||||
bind:group
|
||||
on:click />
|
||||
<div class="u-flex u-flex-vertical u-gap-4">
|
||||
<h4 class="body-text-2 u-bold"><slot name="title" /></h4>
|
||||
<p class="u-color-text-gray u-small">
|
||||
<slot />
|
||||
</p>
|
||||
{#if $$slots.title}
|
||||
<h4 class="body-text-2 u-bold"><slot name="title" /></h4>
|
||||
{/if}
|
||||
{#if $$slots.default}
|
||||
<p class="u-color-text-gray u-small">
|
||||
<slot />
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
{#if icon}
|
||||
<span class={`icon-${icon} u-margin-inline-start-auto`} aria-hidden="true" />
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
<script lang="ts">
|
||||
export let fullWidth = false;
|
||||
</script>
|
||||
|
||||
<li class="numeric-list-item">
|
||||
<p class="text u-margin-block-start-8"><slot /></p>
|
||||
<div class="u-margin-block-start-8" class:u-width-full-line={fullWidth}><slot /></div>
|
||||
</li>
|
||||
@@ -4,8 +4,22 @@
|
||||
export let name: string;
|
||||
export let type: 'color' | 'grayscale' = 'color';
|
||||
export let size = 40;
|
||||
export let iconSize: keyof typeof iconSizes = 'medium';
|
||||
let className = '';
|
||||
export { className as class };
|
||||
|
||||
enum iconSizes {
|
||||
small = '--icon-size-small',
|
||||
medium = '--icon-size-medium',
|
||||
large = '--icon-size-large',
|
||||
xlarge = '--icon-size-extra-large'
|
||||
}
|
||||
</script>
|
||||
|
||||
<img class={className} width={size} height={size} src={$iconPath(name, type)} alt={name} />
|
||||
<img
|
||||
class={className}
|
||||
width={size}
|
||||
height={size}
|
||||
style:inline-size={`var(${iconSizes[iconSize]})`}
|
||||
src={$iconPath(name, type)}
|
||||
alt={name} />
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
await goto(href);
|
||||
await waitUntil(() => {
|
||||
console.log('tickUntil', el);
|
||||
return el.classList.contains('is-selected');
|
||||
}, 1000);
|
||||
el.focus();
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { throttle } from '$lib/helpers/functions';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
export let alternativeTrim = false;
|
||||
let showTooltip = false;
|
||||
let container: HTMLSpanElement | null;
|
||||
|
||||
@@ -15,11 +16,12 @@
|
||||
|
||||
<svelte:window on:resize={throttle(onResize, 250)} />
|
||||
|
||||
<span class="text u-trim" bind:this={container}>
|
||||
<span class={`text ${alternativeTrim ? 'u-trim-1' : 'u-trim'}`} bind:this={container}>
|
||||
{#if showTooltip}
|
||||
<span
|
||||
use:tooltip={{
|
||||
content: container.innerText
|
||||
content: container.innerText,
|
||||
maxWidth: '30rem'
|
||||
}}>
|
||||
<slot />
|
||||
</span>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<script lang="ts">
|
||||
export let fullWidth = false;
|
||||
export let isMultiple = false;
|
||||
</script>
|
||||
|
||||
<li class="form-item" class:u-width-full-line={fullWidth}>
|
||||
<li class="form-item" class:is-multiple={isMultiple} class:u-width-full-line={fullWidth}>
|
||||
<slot />
|
||||
</li>
|
||||
@@ -0,0 +1,8 @@
|
||||
<script lang="ts">
|
||||
export let fullWidth = false;
|
||||
export let alignEnd = false;
|
||||
</script>
|
||||
|
||||
<div class="form-item-part" class:u-cross-child-end={alignEnd} class:u-stretch={fullWidth}>
|
||||
<slot />
|
||||
</div>
|
||||
@@ -1,5 +1,6 @@
|
||||
export { default as Form } from './form.svelte';
|
||||
export { default as FormItem } from './formItem.svelte';
|
||||
export { default as FormItemPart } from './formItemPart.svelte';
|
||||
export { default as FormList } from './formList.svelte';
|
||||
export { default as Button } from './button.svelte';
|
||||
export { default as InputDomain } from './inputDomain.svelte';
|
||||
|
||||
@@ -40,8 +40,10 @@
|
||||
on:invalid={handleInvalid} />
|
||||
|
||||
<div class="choice-item-content">
|
||||
<div class:u-hide={!showLabel} class="choice-item-title u-flex u-cross-center u-gap-4">
|
||||
{label}
|
||||
<div class="u-flex u-cross-center u-gap-4">
|
||||
<h6 class:u-hide={!showLabel} class="choice-item-title">
|
||||
{label}
|
||||
</h6>
|
||||
{#if tooltip}
|
||||
<button class="tooltip" aria-label="variables info">
|
||||
<span
|
||||
|
||||
@@ -22,7 +22,9 @@
|
||||
|
||||
const hasInvalidExt = Array.from(value).some((file) => {
|
||||
const fileExtension = file.name.split('.').pop();
|
||||
return !allowedFileExtensions.includes(fileExtension);
|
||||
return allowedFileExtensions?.length
|
||||
? !allowedFileExtensions.includes(fileExtension)
|
||||
: false;
|
||||
});
|
||||
if (hasInvalidExt) {
|
||||
error = 'Invalid file extension';
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
{label}
|
||||
</Label>
|
||||
|
||||
<div class="input-text-wrapper">
|
||||
<div class="input-text-wrapper" style={showPasswordButton ? '--amount-of-buttons: 1' : ''}>
|
||||
{#if showInPlainText}
|
||||
<input
|
||||
{id}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
export let value: string | number | boolean;
|
||||
export let placeholder = '';
|
||||
export let required = false;
|
||||
export let hideRequired = false;
|
||||
export let disabled = false;
|
||||
export let options: {
|
||||
value: string | boolean | number;
|
||||
@@ -46,7 +47,7 @@
|
||||
|
||||
<FormItem>
|
||||
{#if label}
|
||||
<Label {required} {optionalText} hide={!showLabel} for={id}>
|
||||
<Label {required} {hideRequired} {optionalText} hide={!showLabel} for={id}>
|
||||
{label}
|
||||
</Label>
|
||||
{/if}
|
||||
|
||||
@@ -16,9 +16,11 @@
|
||||
export let label: string;
|
||||
export let name = 'elements';
|
||||
export let optionalText: string | undefined = undefined;
|
||||
export let tooltip: string | undefined = undefined;
|
||||
export let showLabel = true;
|
||||
export let placeholder = '';
|
||||
export let required = false;
|
||||
export let hideRequired = false;
|
||||
export let disabled = false;
|
||||
export let fullWidth = false;
|
||||
export let autofocus = false;
|
||||
@@ -84,11 +86,12 @@
|
||||
value = option.value;
|
||||
search = option.label;
|
||||
// It's not working without this line.
|
||||
if ($$slots.output) {
|
||||
search = '';
|
||||
} else {
|
||||
if (!$$slots.output) {
|
||||
element.value = search;
|
||||
} else {
|
||||
search = '';
|
||||
}
|
||||
|
||||
hasFocus = false;
|
||||
dispatch('select', option);
|
||||
}
|
||||
@@ -117,7 +120,7 @@
|
||||
position="static"
|
||||
fullWidth={true}
|
||||
fixed>
|
||||
<Label {required} {optionalText} hide={!showLabel} for={id}>
|
||||
<Label {required} {hideRequired} {optionalText} hide={!showLabel} for={id} {tooltip}>
|
||||
{label}
|
||||
</Label>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { FormItem, Helper, Label } from '.';
|
||||
import { FormItem, FormItemPart, Helper, Label } from '.';
|
||||
import NullCheckbox from './nullCheckbox.svelte';
|
||||
import TextCounter from './textCounter.svelte';
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
export let value = '';
|
||||
export let placeholder = '';
|
||||
export let required = false;
|
||||
export let hideRequired = false;
|
||||
export let nullable = false;
|
||||
export let disabled = false;
|
||||
export let readonly = false;
|
||||
@@ -20,6 +21,7 @@
|
||||
export let fullWidth = false;
|
||||
export let maxlength: number = null;
|
||||
export let tooltip: string = null;
|
||||
export let isMultiple = false;
|
||||
|
||||
let element: HTMLInputElement;
|
||||
let error: string;
|
||||
@@ -65,11 +67,13 @@
|
||||
type $$Events = {
|
||||
input: Event & { target: HTMLInputElement };
|
||||
};
|
||||
|
||||
$: wrapper = isMultiple ? FormItemPart : FormItem;
|
||||
</script>
|
||||
|
||||
<FormItem {fullWidth}>
|
||||
<svelte:component this={wrapper} {fullWidth}>
|
||||
{#if label}
|
||||
<Label {required} {tooltip} {optionalText} hide={!showLabel} for={id}>
|
||||
<Label {required} {hideRequired} {tooltip} {optionalText} hide={!showLabel} for={id}>
|
||||
{label}
|
||||
</Label>
|
||||
{/if}
|
||||
@@ -110,4 +114,4 @@
|
||||
{#if error}
|
||||
<Helper type="warning">{error}</Helper>
|
||||
{/if}
|
||||
</FormItem>
|
||||
</svelte:component>
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
interface $$Props extends Partial<HTMLLabelElement> {
|
||||
required?: boolean;
|
||||
hideRequired?: boolean;
|
||||
optionalText?: string | undefined;
|
||||
hide?: boolean;
|
||||
tooltip?: string;
|
||||
@@ -8,12 +9,17 @@
|
||||
}
|
||||
|
||||
export let required: $$Props['required'] = false;
|
||||
export let hideRequired: $$Props['hideRequired'] = false;
|
||||
export let optionalText: $$Props['optionalText'] = undefined;
|
||||
export let hide: $$Props['hide'] = false;
|
||||
export let tooltip: $$Props['tooltip'] = null;
|
||||
</script>
|
||||
|
||||
<label class:is-required={required} class:u-hide={hide} class="label" {...$$restProps}>
|
||||
<label
|
||||
class:is-required={required && !hideRequired}
|
||||
class:u-hide={hide}
|
||||
class="label"
|
||||
{...$$restProps}>
|
||||
<slot />
|
||||
</label>
|
||||
|
||||
@@ -22,7 +28,7 @@
|
||||
{/if}
|
||||
|
||||
{#if tooltip}
|
||||
<button class="tooltip" aria-label="variables info">
|
||||
<button class="tooltip" aria-label="input tooltip">
|
||||
<span class="icon-info" aria-hidden="true" style="font-size: var(--icon-size-small)" />
|
||||
<span class="tooltip-popup" role="tooltip">
|
||||
<p class="text">
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
<script lang="ts">
|
||||
export let href: string;
|
||||
export let title: string;
|
||||
|
||||
export let external = false;
|
||||
export let noStyle = false;
|
||||
</script>
|
||||
|
||||
<div class="table-col" data-title={title} role="cell" data-private>
|
||||
<a role="button" tabindex="0" class="link" {href}><slot /></a>
|
||||
<a
|
||||
role="button"
|
||||
tabindex="0"
|
||||
class:link={!noStyle}
|
||||
{href}
|
||||
target={external ? '_blank' : ''}
|
||||
rel={external ? 'noopener noreferrer' : ''}><slot /></a>
|
||||
</div>
|
||||
@@ -1,12 +1,14 @@
|
||||
<script lang="ts">
|
||||
export let noMargin = false;
|
||||
export let noStyles = false;
|
||||
export let style = '';
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="table is-selected-columns-mobile"
|
||||
class:u-margin-block-start-32={!noMargin}
|
||||
class:is-remove-outer-styles={noStyles}
|
||||
{style}
|
||||
role="table"
|
||||
data-private>
|
||||
<slot />
|
||||
|
||||
+179
-134
@@ -1,19 +1,18 @@
|
||||
<script lang="ts">
|
||||
import { toLocaleDateTime } from '$lib/helpers/date';
|
||||
import { log } from '$lib/stores/logs';
|
||||
import { Alert, Code, Heading, Id, Status, Tab, Tabs } from '../components';
|
||||
import { base } from '$app/paths';
|
||||
import { app } from '$lib/stores/app';
|
||||
import { Card, Code, Heading, Id, SvgIcon, Tab, Tabs } from '../components';
|
||||
import { calculateTime } from '$lib/helpers/timeConversion';
|
||||
import {
|
||||
TableBody,
|
||||
TableCellHead,
|
||||
TableCellText,
|
||||
TableHeader,
|
||||
TableRow
|
||||
TableRow,
|
||||
TableScroll
|
||||
} from '$lib/elements/table';
|
||||
import { beforeNavigate } from '$app/navigation';
|
||||
import Table from '$lib/elements/table/table.svelte';
|
||||
import { Pill } from '$lib/elements';
|
||||
|
||||
let selectedRequest = 'parameters';
|
||||
let selectedResponse = 'logs';
|
||||
@@ -25,6 +24,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
function parseUrl(url: string) {
|
||||
if (!url) return;
|
||||
const queryString = url.includes('?') ? url.split('?')[1] : '';
|
||||
const queries: Record<string, string>[] = [];
|
||||
for (const param of queryString.split('&')) {
|
||||
let [key, ...valueArr] = param.split('=');
|
||||
const value = valueArr.join('=');
|
||||
|
||||
if (key) {
|
||||
queries.push({ key, value: value ?? '' });
|
||||
}
|
||||
}
|
||||
return queries;
|
||||
}
|
||||
|
||||
beforeNavigate((n) => {
|
||||
if (!$log.show) return;
|
||||
if (n.type === 'popstate') {
|
||||
@@ -33,9 +47,9 @@
|
||||
$log.show = false;
|
||||
});
|
||||
|
||||
$: parameters = parseUrl(execution?.requestPath);
|
||||
$: execution = $log.data;
|
||||
$: func = $log.func;
|
||||
|
||||
$: if (execution?.errors) {
|
||||
selectedResponse = 'errors';
|
||||
}
|
||||
@@ -62,13 +76,11 @@
|
||||
<div class="cover-frame-content u-flex u-flex-vertical">
|
||||
<div class="u-flex u-gap-16">
|
||||
<div class="avatar is-size-large">
|
||||
<img
|
||||
height="28"
|
||||
width="28"
|
||||
src={`${base}/icons/${$app.themeInUse}/color/${
|
||||
func.runtime.split('-')[0]
|
||||
}.svg`}
|
||||
alt="technology" />
|
||||
<SvgIcon
|
||||
size={56}
|
||||
type="color"
|
||||
name={func.runtime.split('-')[0]}
|
||||
iconSize="large" />
|
||||
</div>
|
||||
<div>
|
||||
<h2 class="body-text-2 u-bold">Execution ID:</h2>
|
||||
@@ -88,9 +100,23 @@
|
||||
{toLocaleDateTime(execution.$createdAt)}
|
||||
</time>
|
||||
</li>
|
||||
{#if execution?.requestHeaders?.host}
|
||||
<li class="text">
|
||||
<b>Host</b>
|
||||
<span>
|
||||
{execution.requestHeaders.host}
|
||||
</span>
|
||||
</li>
|
||||
{/if}
|
||||
</ul>
|
||||
<div class="status u-margin-inline-start-auto">
|
||||
<Status status={execution.status}>{execution.status}</Status>
|
||||
<Pill
|
||||
warning={execution.status === 'waiting'}
|
||||
danger={execution.status === 'failed'}
|
||||
success={execution.status === 'completed' || execution.status === 'ready'}
|
||||
info={execution.status === 'processing' || execution.status === 'building'}>
|
||||
{execution.status}
|
||||
</Pill>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -98,24 +124,25 @@
|
||||
<section class="code-panel">
|
||||
<header class="code-panel-header u-flex u-main-space-between u-width-full-line">
|
||||
<div class="u-flex u-gap-24">
|
||||
<div class="u-flex u-gap-4">
|
||||
<h4 class="u-bold">Method:</h4>
|
||||
<span>{execution.requestMethod}</span>
|
||||
<div class="u-flex u-gap-16">
|
||||
<h4 class="text u-bold">Method:</h4>
|
||||
<span class="u-text-color-gray">{execution.requestMethod}</span>
|
||||
</div>
|
||||
<div class="u-flex u-gap-4">
|
||||
<h4 class="u-bold">Path:</h4>
|
||||
<span>{execution.requestPath}</span>
|
||||
<div class="u-flex u-gap-16">
|
||||
<h4 class="text u-bold">Path:</h4>
|
||||
<span class="u-text-color-gray">{execution.requestPath}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="u-flex u-gap-24">
|
||||
<div class="u-flex u-gap-4">
|
||||
<h4 class="u-bold">Triggered by:</h4>
|
||||
<span>{execution.trigger}</span>
|
||||
<div class="u-flex u-gap-16">
|
||||
<h4 class="text u-bold">Triggered by:</h4>
|
||||
<span class="u-text-color-gray">{execution.trigger}</span>
|
||||
</div>
|
||||
<div class="u-flex u-gap-4">
|
||||
<h4 class="u-bold">Status Code:</h4>
|
||||
<span>{execution.responseStatusCode}</span>
|
||||
<div class="u-flex u-gap-16">
|
||||
<h4 class="text u-bold">Status Code:</h4>
|
||||
<span class="u-text-color-gray"
|
||||
>{execution.responseStatusCode}</span>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
@@ -142,78 +169,93 @@
|
||||
</Tabs>
|
||||
</div>
|
||||
{#if selectedRequest === 'parameters'}
|
||||
<Alert type="info">
|
||||
<svelte:fragment slot="title">
|
||||
Parameters data is not stored in function executions
|
||||
</svelte:fragment>
|
||||
<p class="text">
|
||||
Logging parameters data might compromise privacy and
|
||||
security. To log them intentionally, use <b
|
||||
>context.log(context.req.headers)</b>
|
||||
in your function and make them available in Logs tab.
|
||||
<a
|
||||
href="https://appwrite.io/docs/functions-develop#logging"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="link">Learn more</a
|
||||
>.
|
||||
</p>
|
||||
</Alert>
|
||||
{:else if selectedRequest === 'headers'}
|
||||
<Alert type="info">
|
||||
<svelte:fragment slot="title">
|
||||
Only some request headers are stored
|
||||
</svelte:fragment>
|
||||
<p class="text">
|
||||
Logging some headers might compromise privacy and security.
|
||||
We only log well-known public headers. To log more headers
|
||||
intentionally, use <b>context.log()</b>
|
||||
in your function and make them available in Logs tab.
|
||||
<a
|
||||
href="https://appwrite.io/docs/functions-develop#logging"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="link">Learn more</a
|
||||
>.
|
||||
</p>
|
||||
</Alert>
|
||||
|
||||
{#if execution.requestHeaders.length}
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableCellHead>Name</TableCellHead>
|
||||
<TableCellHead>Value</TableCellHead>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{#each execution.requestHeaders as header}
|
||||
<TableRow>
|
||||
<TableCellText title="Name">
|
||||
{header.name}
|
||||
</TableCellText>
|
||||
<TableCellText title="Value"
|
||||
>{header.value}</TableCellText>
|
||||
</TableRow>
|
||||
{/each}
|
||||
</TableBody>
|
||||
</Table>
|
||||
{#if parameters?.length}
|
||||
<div class="u-margin-block-start-24">
|
||||
<TableScroll noMargin>
|
||||
<TableHeader>
|
||||
<TableCellHead>Name</TableCellHead>
|
||||
<TableCellHead>Value</TableCellHead>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{#each parameters as param}
|
||||
<TableRow>
|
||||
<TableCellText title="Key">
|
||||
{param.key}
|
||||
</TableCellText>
|
||||
<TableCellText title="Value">
|
||||
{param.value}
|
||||
</TableCellText>
|
||||
</TableRow>
|
||||
{/each}
|
||||
</TableBody>
|
||||
</TableScroll>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<p class="text u-text-center u-padding-24">
|
||||
{parameters?.length
|
||||
? 'Not all parameters data is'
|
||||
: 'Parameters data is not'} captured by Appwrite for your user's
|
||||
security and privacy. To display parameters data in the Logs tab,
|
||||
use
|
||||
<b>context.log()</b>.
|
||||
<a
|
||||
href="https://appwrite.io/docs/functions-develop#logging"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="link">Learn more</a
|
||||
>.
|
||||
</p>
|
||||
{:else if selectedRequest === 'headers'}
|
||||
{#if execution.requestHeaders.length}
|
||||
<div class="u-margin-block-start-24">
|
||||
<TableScroll noMargin>
|
||||
<TableHeader>
|
||||
<TableCellHead>Name</TableCellHead>
|
||||
<TableCellHead>Value</TableCellHead>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{#each execution.requestHeaders as header}
|
||||
<TableRow>
|
||||
<TableCellText title="Name">
|
||||
{header.name}
|
||||
</TableCellText>
|
||||
<TableCellText title="Value">
|
||||
{header.value}
|
||||
</TableCellText>
|
||||
</TableRow>
|
||||
{/each}
|
||||
</TableBody>
|
||||
</TableScroll>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<p class="text u-text-center u-padding-24">
|
||||
{execution.requestHeaders?.length
|
||||
? 'Not all header data is'
|
||||
: 'Header data is not'}
|
||||
captured by Appwrite for your user's security and privacy. To display
|
||||
header data in the Logs tab, use
|
||||
<b>context.log()</b>.
|
||||
<a
|
||||
href="https://appwrite.io/docs/functions-develop#logging"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="link">Learn more</a
|
||||
>.
|
||||
</p>
|
||||
{:else if selectedRequest === 'body'}
|
||||
<Alert type="warning">
|
||||
<svelte:fragment slot="title">
|
||||
Request body is not stored
|
||||
</svelte:fragment>
|
||||
<p class="text">
|
||||
Logging body might compromise privacy and security. To log
|
||||
it intentionally, use <b>context.log()</b>
|
||||
in your function and make it available in Logs tab.
|
||||
<a
|
||||
href="https://appwrite.io/docs/functions-develop#logging"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="link">Learn more</a
|
||||
>.
|
||||
</p>
|
||||
</Alert>
|
||||
<p class="text u-text-center u-padding-24">
|
||||
Body data is not captured by Appwrite for your user's security
|
||||
and privacy. To display body data in the Logs tab, use
|
||||
<b>context.log()</b>.
|
||||
<a
|
||||
href="https://appwrite.io/docs/functions-develop#logging"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="link">Learn more</a
|
||||
>.
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="grid-1-2-col-2 u-flex u-flex-vertical u-gap-16">
|
||||
@@ -243,30 +285,24 @@
|
||||
</Tabs>
|
||||
</div>
|
||||
{#if selectedResponse === 'logs'}
|
||||
<Code withCopy noMargin code={execution.logs} language="sh" />
|
||||
{#if execution?.logs}
|
||||
<Code withCopy noMargin code={execution.logs} language="sh" />
|
||||
{:else}
|
||||
<Card isDashed isTile>
|
||||
<p class="text u-text-center">No response was recorded.</p>
|
||||
</Card>
|
||||
{/if}
|
||||
{:else if selectedResponse === 'errors'}
|
||||
<Code withCopy noMargin code={execution.errors} language="sh" />
|
||||
{#if execution?.errors}
|
||||
<Code withCopy noMargin code={execution.errors} language="sh" />
|
||||
{:else}
|
||||
<Card isDashed isTile>
|
||||
<p class="text u-text-center">No response was recorded.</p>
|
||||
</Card>
|
||||
{/if}
|
||||
{:else if selectedResponse === 'headers'}
|
||||
<Alert type="info">
|
||||
<svelte:fragment slot="title">
|
||||
Only some response headers are stored
|
||||
</svelte:fragment>
|
||||
<p class="text">
|
||||
Logging some headers might compromise privacy and security.
|
||||
We only log well-known public headers. To log more headers
|
||||
intentionally, use <b>context.log()</b>
|
||||
in your function and make them available in Logs tab.
|
||||
<a
|
||||
href="https://appwrite.io/docs/functions-develop#logging"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="link">Learn more</a
|
||||
>.
|
||||
</p>
|
||||
</Alert>
|
||||
|
||||
{#if execution.responseHeaders.length}
|
||||
<Table>
|
||||
<TableScroll noMargin>
|
||||
<TableHeader>
|
||||
<TableCellHead>Name</TableCellHead>
|
||||
<TableCellHead>Value</TableCellHead>
|
||||
@@ -282,25 +318,34 @@
|
||||
</TableRow>
|
||||
{/each}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</TableScroll>
|
||||
{/if}
|
||||
<p class="text u-text-center u-padding-24">
|
||||
{execution.responseHeaders?.length
|
||||
? 'Not all header data is'
|
||||
: 'Header data is not'}
|
||||
captured by Appwrite for your user's security and privacy. To display
|
||||
header data in the Logs tab, use
|
||||
<b>context.log()</b>.
|
||||
<a
|
||||
href="https://appwrite.io/docs/functions-develop#logging"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="link">Learn more</a
|
||||
>.
|
||||
</p>
|
||||
{:else if selectedResponse === 'body'}
|
||||
<Alert type="warning">
|
||||
<svelte:fragment slot="title">
|
||||
Response body is not stored
|
||||
</svelte:fragment>
|
||||
<p class="text">
|
||||
Logging body might compromise privacy and security. To log
|
||||
it intentionally, use <b>context.log()</b>
|
||||
in your function and make it available in Logs tab.
|
||||
<a
|
||||
href="https://appwrite.io/docs/functions-develop#logging"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="link">Learn more</a
|
||||
>.
|
||||
</p>
|
||||
</Alert>
|
||||
<p class="text u-text-center u-padding-24">
|
||||
Body data is not captured by Appwrite for your user's security
|
||||
and privacy. To display body data in the Logs tab, use
|
||||
<b>context.log()</b>.
|
||||
<a
|
||||
href="https://appwrite.io/docs/functions-develop#logging"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="link">Learn more</a
|
||||
>.
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -41,7 +41,8 @@
|
||||
<svelte:fragment slot="header">Delete Domain</svelte:fragment>
|
||||
{#if selectedDomain}
|
||||
<p data-private>
|
||||
Are you sure you want to delete <b>{selectedDomain.domain}</b>?
|
||||
Are you sure you want to delete <b>{selectedDomain.domain}</b>? You will no longer be
|
||||
able to execute your function by visiting this domain.
|
||||
</p>
|
||||
{/if}
|
||||
<svelte:fragment slot="footer">
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { DropList, DropListItem, Empty, Heading, Modal } from '$lib/components';
|
||||
import { DropList, DropListItem, Empty, Heading, Modal, Trim } from '$lib/components';
|
||||
import {
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableCellHead,
|
||||
TableCellText,
|
||||
TableCellLink,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
TableScroll
|
||||
@@ -26,6 +26,7 @@
|
||||
import Create from './create.svelte';
|
||||
import Delete from './delete.svelte';
|
||||
import Retry from './wizard/retry.svelte';
|
||||
import { Pill } from '$lib/elements';
|
||||
|
||||
export let rules: Models.ProxyRuleList;
|
||||
export let type: ProxyTypes;
|
||||
@@ -76,69 +77,67 @@
|
||||
<TableBody>
|
||||
{#each rules.rules as domain, i}
|
||||
<TableRow>
|
||||
<TableCellText title="Domain">
|
||||
<a href={`//${domain.domain}`} target="_blank" rel="noopener noreferrer">
|
||||
{domain.domain}
|
||||
<span
|
||||
class="icon-external-link"
|
||||
aria-hidden="true"
|
||||
style="color: hsl(var(--color-neutral-50))" />
|
||||
</a>
|
||||
</TableCellText>
|
||||
<TableCellText title="Status">
|
||||
<TableCellLink title="Domain" href={`http://${domain.domain}`} external noStyle>
|
||||
<span class="u-flex u-gap-4 u-cross-center">
|
||||
<Trim>
|
||||
<span class="link">{domain.domain}</span>
|
||||
</Trim>
|
||||
<span class="icon-external-link" aria-hidden="true" />
|
||||
</span>
|
||||
</TableCellLink>
|
||||
<TableCell title="Status">
|
||||
{#if domain.status === 'created'}
|
||||
<div class="u-flex u-gap-8 u-cross-center">
|
||||
<span
|
||||
class="icon-x-circle"
|
||||
aria-hidden="true"
|
||||
style="color: hsl(var(--color-danger-100))" />
|
||||
<span class="u-text">Failed</span>
|
||||
<Button text on:click={() => openRetry(domain)}>
|
||||
<Pill danger>
|
||||
<span
|
||||
class="icon-exclamation-circle u-color-text-danger"
|
||||
aria-hidden="true" />
|
||||
<span class="u-text">Failed</span>
|
||||
</Pill>
|
||||
<button on:click={() => openRetry(domain)}>
|
||||
<span class="link">Retry</span>
|
||||
</Button>
|
||||
</button>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="u-flex u-gap-8 u-cross-center">
|
||||
<Pill success>
|
||||
<span
|
||||
class="icon-check-circle"
|
||||
aria-hidden="true"
|
||||
style="color: hsl(var(--color-success-100))" />
|
||||
<p class="u-stretch">Verified</p>
|
||||
</div>
|
||||
class="icon-check-circle u-color-text-success"
|
||||
aria-hidden="true" />
|
||||
<p class="text">Verified</p>
|
||||
</Pill>
|
||||
{/if}
|
||||
</TableCellText>
|
||||
<TableCellText title="Name">
|
||||
</TableCell>
|
||||
<TableCell title="Name">
|
||||
{#if domain.status === 'unverified'}
|
||||
<div class="u-flex u-gap-8 u-cross-center">
|
||||
<span
|
||||
class="icon-x-circle"
|
||||
aria-hidden="true"
|
||||
style="color: hsl(var(--color-danger-100))" />
|
||||
<p class="u-stretch">Failed</p>
|
||||
class="icon-x-circle u-color-text-danger"
|
||||
aria-hidden="true" />
|
||||
<p class="text">Failed</p>
|
||||
</div>
|
||||
{:else if domain.status === 'verified'}
|
||||
<div class="u-flex u-gap-8 u-cross-center">
|
||||
<span
|
||||
class="icon-check-circle"
|
||||
aria-hidden="true"
|
||||
style="color: hsl(var(--color-success-100))" />
|
||||
<span>Generated</span>
|
||||
<Pill success>
|
||||
<span
|
||||
class="icon-check-circle u-color-text-success"
|
||||
aria-hidden="true" />
|
||||
<span>Generated</span>
|
||||
</Pill>
|
||||
{#if domain.renewAt}
|
||||
<span style="color: hsl(var(--color-neutral-70));">
|
||||
<span class="u-text-color-gray">
|
||||
Auto-renewal: {toLocaleDate(domain.renewAt)}
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<div class="u-flex u-gap-8 u-cross-center">
|
||||
<span
|
||||
class="icon-clock"
|
||||
aria-hidden="true"
|
||||
style="color: hsl(var(--color-neutral-50))" />
|
||||
<p class="u-stretch">Waiting to run</p>
|
||||
<Pill>
|
||||
<span class="icon-clock u-text-color-gray" aria-hidden="true" />
|
||||
<p class="text">Waiting to run</p>
|
||||
</Pill>
|
||||
</div>
|
||||
{/if}
|
||||
</TableCellText>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<DropList
|
||||
bind:show={showDomainsDropdown[i]}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
$: cnameValue = $domain.domain.replace('.' + registerable, '');
|
||||
</script>
|
||||
|
||||
<Table noMargin>
|
||||
<Table noMargin noStyles style="--p-table-bg-color: var(--transparent);">
|
||||
<TableHeader>
|
||||
<TableCellHead>Type</TableCellHead>
|
||||
<TableCellHead>Name</TableCellHead>
|
||||
|
||||
@@ -4,6 +4,11 @@
|
||||
import { domain } from './store';
|
||||
import CnameTable from './cnameTable.svelte';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { Box } from '$lib/components';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
|
||||
let retrying = false;
|
||||
|
||||
@@ -13,35 +18,39 @@
|
||||
try {
|
||||
retrying = true;
|
||||
$domain = await sdk.forProject.proxy.updateRuleVerification($domain.$id);
|
||||
invalidate(Dependencies.FUNCTION_DOMAINS);
|
||||
addNotification({
|
||||
message: 'Domain has been verified successfully',
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent(Submit.DomainUpdateVerification);
|
||||
} catch (error) {
|
||||
dispatch('error', error.message);
|
||||
trackError(error, Submit.DomainUpdateVerification);
|
||||
} finally {
|
||||
retrying = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="u-flex u-gap-8 u-cross-center">
|
||||
<span
|
||||
class="icon-exclamation-circle"
|
||||
aria-hidden="true"
|
||||
style="color: hsl(var(--color-danger-100))" />
|
||||
<p class="u-stretch">Verification failed</p>
|
||||
<Button secondary on:click={retry} disabled={retrying}>
|
||||
{#if retrying}
|
||||
<div class="loader" style="color: hsl(var(--color-neutral-50))" />
|
||||
{:else}
|
||||
Retry
|
||||
{/if}
|
||||
</Button>
|
||||
</div>
|
||||
<div class="u-margin-block-start-24">
|
||||
<p>
|
||||
<Box radius="small">
|
||||
<div class="u-flex u-gap-8 u-cross-center">
|
||||
<span class="icon-exclamation-circle u-color-text-danger" aria-hidden="true" />
|
||||
<p class="u-stretch">Verification failed</p>
|
||||
<Button secondary on:click={retry} disabled={retrying}>
|
||||
{#if retrying}
|
||||
<div class="loader u-text-color-gray" />
|
||||
{:else}
|
||||
Retry
|
||||
{/if}
|
||||
</Button>
|
||||
</div>
|
||||
<p class="text u-margin-block-start-24">
|
||||
In order to continue, set the following record on your DNS provider. Find a list of domain
|
||||
providers and their DNS settings in our documentation. Changes may take time to be
|
||||
effective.
|
||||
</p>
|
||||
</div>
|
||||
<div class="u-margin-block-start-24">
|
||||
<CnameTable />
|
||||
</div>
|
||||
<div class="u-margin-block-start-24">
|
||||
<CnameTable />
|
||||
</div>
|
||||
</Box>
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Submit, trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { FormList, InputDomain } from '$lib/elements/forms';
|
||||
import { WizardStep } from '$lib/layout';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
@@ -7,23 +7,29 @@
|
||||
import { ProxyTypes } from '../index.svelte';
|
||||
import { domain, typeStore } from './store';
|
||||
|
||||
let error = null;
|
||||
async function createDomain() {
|
||||
if ($domain.$id) {
|
||||
await sdk.forProject.proxy.deleteRule($domain.$id);
|
||||
try {
|
||||
if ($domain.$id) {
|
||||
await sdk.forProject.proxy.deleteRule($domain.$id);
|
||||
}
|
||||
|
||||
$domain = await sdk.forProject.proxy.createRule(
|
||||
$domain.domain,
|
||||
$typeStore,
|
||||
$typeStore === ProxyTypes.FUNCTION ? $func.$id : undefined
|
||||
);
|
||||
|
||||
trackEvent(Submit.DomainCreate);
|
||||
} catch (e) {
|
||||
error = true;
|
||||
trackError(e.message, Submit.DomainCreate);
|
||||
}
|
||||
|
||||
$domain = await sdk.forProject.proxy.createRule(
|
||||
$domain.domain,
|
||||
$typeStore,
|
||||
$typeStore === ProxyTypes.FUNCTION ? $func.$id : undefined
|
||||
);
|
||||
|
||||
trackEvent(Submit.DomainCreate);
|
||||
}
|
||||
</script>
|
||||
|
||||
<WizardStep beforeSubmit={createDomain}>
|
||||
<svelte:fragment slot="title">Add your domain</svelte:fragment>
|
||||
<svelte:fragment slot="title">Add function domain</svelte:fragment>
|
||||
<svelte:fragment slot="subtitle">
|
||||
Use your self-owned domain as the endpoint of your Appwrite API.
|
||||
</svelte:fragment>
|
||||
@@ -37,15 +43,17 @@
|
||||
required
|
||||
bind:value={$domain.domain} />
|
||||
</FormList>
|
||||
<div class="common-section">
|
||||
<p>
|
||||
You can find a list of domain providers and their DNS setting documentation <a
|
||||
class="link"
|
||||
href="https://appwrite.io/docs/custom-domains#addCNAME"
|
||||
target="_blank"
|
||||
rel="noreferrer">here</a
|
||||
>. If your domain provider isn't listed, please contact us, and we'll include their
|
||||
settings as well.
|
||||
</p>
|
||||
</div>
|
||||
{#if error}
|
||||
<div class="common-section">
|
||||
<p>
|
||||
You can find a list of domain providers and their DNS setting documentation <a
|
||||
class="link"
|
||||
href="https://appwrite.io/docs/custom-domains#addCNAME"
|
||||
target="_blank"
|
||||
rel="noreferrer">here</a
|
||||
>. If your domain provider isn't listed, please contact us, and we'll include their
|
||||
settings as well.
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
</WizardStep>
|
||||
@@ -17,19 +17,14 @@
|
||||
<svelte:fragment slot="title">{$domain.domain}</svelte:fragment>
|
||||
|
||||
<div class="boxes-wrapper u-margin-block-start-24">
|
||||
<div class="box">
|
||||
{#if $domain.status === 'created'}
|
||||
<Retry on:error={onRetryError} />
|
||||
{:else}
|
||||
<div class="u-flex u-gap-8 u-cross-center">
|
||||
<span
|
||||
class="icon-check"
|
||||
aria-hidden="true"
|
||||
style="color: hsl(var(--color-success-100))" />
|
||||
<p class="u-stretch">Domain verified</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{#if $domain.status === 'created'}
|
||||
<Retry on:error={onRetryError} />
|
||||
{:else}
|
||||
<div class="u-flex u-gap-8 u-cross-center">
|
||||
<span class="icon-check u-color-text-success" aria-hidden="true" />
|
||||
<p class="u-stretch">Domain verified</p>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="box">
|
||||
<div class="u-flex u-gap-8 u-cross-center">
|
||||
{#if $domain.status === 'verifying'}
|
||||
@@ -38,16 +33,10 @@
|
||||
style="color: hsl(var(--color-neutral-50)); inline-size: 1.25rem; block-size: 1.25rem" />
|
||||
<p class="u-stretch">Generating certificate</p>
|
||||
{:else if $domain.status === 'verified'}
|
||||
<span
|
||||
class="icon-check"
|
||||
aria-hidden="true"
|
||||
style="color: hsl(var(--color-success-100))" />
|
||||
<span class="icon-check u-color-text-success" aria-hidden="true" />
|
||||
<p class="u-stretch">Certificate generated</p>
|
||||
{:else}
|
||||
<span
|
||||
class="icon-clock"
|
||||
aria-hidden="true"
|
||||
style="color: hsl(var(--color-neutral-50))" />
|
||||
<span class="icon-clock u-text-color-gray" aria-hidden="true" />
|
||||
<p class="u-stretch">
|
||||
Certificate generation will begin after domain verification
|
||||
</p>
|
||||
|
||||
@@ -42,7 +42,7 @@ export const marketplace = [
|
||||
providerRootDirectory: 'dart/starter'
|
||||
}
|
||||
],
|
||||
instructions: `For documentation and instructions check out [README.md](https://github.com/appwrite/templates/tree/main/node/starter) file.`,
|
||||
instructions: `For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/starter">file</a>.`,
|
||||
vcsProvider: 'github',
|
||||
providerRepositoryId: 'templates',
|
||||
providerOwner: 'appwrite',
|
||||
@@ -75,7 +75,7 @@ export const marketplace = [
|
||||
providerRootDirectory: 'node/prompt-chatgpt'
|
||||
}
|
||||
],
|
||||
instructions: `For documentation and instructions check out [README.md](https://github.com/appwrite/templates/tree/main/node/prompt-chatgpt) file.`,
|
||||
instructions: `For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/prompt-chatgpt">file</a>.`,
|
||||
vcsProvider: 'github',
|
||||
providerRepositoryId: 'templates',
|
||||
providerOwner: 'appwrite',
|
||||
@@ -115,7 +115,7 @@ export const marketplace = [
|
||||
providerRootDirectory: 'node/analyze-with-perspectiveapi'
|
||||
}
|
||||
],
|
||||
instructions: `For documentation and instructions check out [README.md](https://github.com/appwrite/templates/tree/main/node/analyze-with-perspectiveapi) file.`,
|
||||
instructions: `For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/analyze-with-perspectiveapi">file</a>.`,
|
||||
vcsProvider: 'github',
|
||||
providerRepositoryId: 'templates',
|
||||
providerOwner: 'appwrite',
|
||||
@@ -149,7 +149,7 @@ export const marketplace = [
|
||||
providerRootDirectory: 'node/censor-with-redact'
|
||||
}
|
||||
],
|
||||
instructions: `For documentation and instructions check out [README.md](https://github.com/appwrite/templates/tree/main/node/censor-with-redact) file.`,
|
||||
instructions: `For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/censor-with-redact">file</a>.`,
|
||||
vcsProvider: 'github',
|
||||
providerRepositoryId: 'templates',
|
||||
providerOwner: 'appwrite',
|
||||
@@ -182,7 +182,7 @@ export const marketplace = [
|
||||
providerRootDirectory: 'node/generate-pdf'
|
||||
}
|
||||
],
|
||||
instructions: `For documentation and instructions check out [README.md](https://github.com/appwrite/templates/tree/main/node/generate-pdf) file.`,
|
||||
instructions: `For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/generate-pdf">file</a>.`,
|
||||
vcsProvider: 'github',
|
||||
providerRepositoryId: 'templates',
|
||||
providerOwner: 'appwrite',
|
||||
@@ -207,7 +207,7 @@ export const marketplace = [
|
||||
providerRootDirectory: 'node/discord-command-bot'
|
||||
}
|
||||
],
|
||||
instructions: `For documentation and instructions check out [README.md](https://github.com/appwrite/templates/tree/main/node/discord-command-bot) file.`,
|
||||
instructions: `For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/discord-command-bot">file</a>.`,
|
||||
vcsProvider: 'github',
|
||||
providerRepositoryId: 'templates',
|
||||
providerOwner: 'appwrite',
|
||||
@@ -241,7 +241,7 @@ export const marketplace = [
|
||||
providerRootDirectory: 'node/github-issue-bot'
|
||||
}
|
||||
],
|
||||
instructions: `For documentation and instructions check out [README.md](https://github.com/appwrite/templates/tree/main/node/github-issue-bot) file.`,
|
||||
instructions: `For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/github-issue-bot">file</a>.`,
|
||||
vcsProvider: 'github',
|
||||
providerRepositoryId: 'templates',
|
||||
providerOwner: 'appwrite',
|
||||
@@ -281,7 +281,7 @@ export const marketplace = [
|
||||
providerRootDirectory: 'node/url-shortener'
|
||||
}
|
||||
],
|
||||
instructions: `For documentation and instructions check out [README.md](https://github.com/appwrite/templates/tree/main/node/url-shortener) file.`,
|
||||
instructions: `For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/url-shortener">file</a>.`,
|
||||
vcsProvider: 'github',
|
||||
providerRepositoryId: 'templates',
|
||||
providerOwner: 'appwrite',
|
||||
@@ -335,7 +335,7 @@ export const marketplace = [
|
||||
providerRootDirectory: 'node/sync-with-algolia'
|
||||
}
|
||||
],
|
||||
instructions: `For documentation and instructions check out [README.md](https://github.com/appwrite/templates/tree/main/node/sync-with-algolia) file.`,
|
||||
instructions: `For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/sync-with-algolia">file</a>.`,
|
||||
vcsProvider: 'github',
|
||||
providerRepositoryId: 'templates',
|
||||
providerOwner: 'appwrite',
|
||||
@@ -405,7 +405,7 @@ export const marketplace = [
|
||||
providerRootDirectory: 'node/sync-with-meilisearch'
|
||||
}
|
||||
],
|
||||
instructions: `For documentation and instructions check out [README.md](https://github.com/appwrite/templates/tree/main/node/sync-with-meilisearch) file.`,
|
||||
instructions: `For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/sync-with-meilisearch">file</a>.`,
|
||||
vcsProvider: 'github',
|
||||
providerRepositoryId: 'templates',
|
||||
providerOwner: 'appwrite',
|
||||
@@ -481,7 +481,7 @@ export const marketplace = [
|
||||
providerRootDirectory: 'node/whatsapp-with-vonage'
|
||||
}
|
||||
],
|
||||
instructions: `For documentation and instructions check out [README.md](https://github.com/appwrite/templates/tree/main/node/whatsapp-with-vonage) file.`,
|
||||
instructions: `For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/whatsapp-with-vonage">file</a>.`,
|
||||
vcsProvider: 'github',
|
||||
providerRepositoryId: 'templates',
|
||||
providerOwner: 'appwrite',
|
||||
@@ -532,7 +532,7 @@ export const marketplace = [
|
||||
providerRootDirectory: 'node/push-notification-with-fcm'
|
||||
}
|
||||
],
|
||||
instructions: `For documentation and instructions check out [README.md](https://github.com/appwrite/templates/tree/main/node/push-notification-with-fcm) file.`,
|
||||
instructions: `For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/push-notification-with-fcm">file</a>.`,
|
||||
vcsProvider: 'github',
|
||||
providerRepositoryId: 'templates',
|
||||
providerOwner: 'appwrite',
|
||||
@@ -583,7 +583,7 @@ export const marketplace = [
|
||||
providerRootDirectory: 'node/email-contact-form'
|
||||
}
|
||||
],
|
||||
instructions: `For documentation and instructions check out [README.md](https://github.com/appwrite/templates/tree/main/node/email-contact-form) file.`,
|
||||
instructions: `For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/email-contact-form">file</a>.`,
|
||||
vcsProvider: 'github',
|
||||
providerRepositoryId: 'templates',
|
||||
providerOwner: 'appwrite',
|
||||
@@ -631,14 +631,14 @@ export const marketplace = [
|
||||
}
|
||||
];
|
||||
|
||||
type Runtime = {
|
||||
export type Runtime = {
|
||||
name: string;
|
||||
commands: string;
|
||||
entrypoint: string;
|
||||
providerRootDirectory: string;
|
||||
};
|
||||
|
||||
type Variable = {
|
||||
export type Variable = {
|
||||
name: string;
|
||||
description: string;
|
||||
value?: string;
|
||||
|
||||
@@ -122,21 +122,6 @@ function createServices() {
|
||||
label: 'Users',
|
||||
method: 'users',
|
||||
value: project.serviceStatusForUsers
|
||||
},
|
||||
{
|
||||
label: 'GraphQL',
|
||||
method: 'graphql',
|
||||
value: project.serviceStatusForGraphql
|
||||
},
|
||||
{
|
||||
label: 'VCS',
|
||||
method: 'vcs',
|
||||
value: project.serviceStatusForVcs
|
||||
},
|
||||
{
|
||||
label: 'Proxy',
|
||||
method: 'proxy',
|
||||
value: project.serviceStatusForProxy
|
||||
}
|
||||
];
|
||||
set({ list });
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<script lang="ts">
|
||||
import { Box } from '$lib/components';
|
||||
import { FormList, Helper, InputChoice, InputText } from '$lib/elements/forms';
|
||||
import type { Variable } from '$lib/stores/marketplace';
|
||||
import { templateConfig } from '../store';
|
||||
|
||||
export let appwriteVariable: Variable;
|
||||
</script>
|
||||
|
||||
<Box radius="small" padding={16}>
|
||||
<FormList>
|
||||
<div>
|
||||
<InputText
|
||||
id={appwriteVariable.name}
|
||||
label={appwriteVariable.name}
|
||||
placeholder={appwriteVariable.placeholder ?? 'Enter value'}
|
||||
required={appwriteVariable.required}
|
||||
bind:value={$templateConfig.appwriteApiKey}
|
||||
disabled={!!$templateConfig.generateKey} />
|
||||
<Helper type="neutral">
|
||||
This API key will allow you to interact with the Appwrite server APIs. <a
|
||||
href="http://#"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="link">Learn more</a
|
||||
>.
|
||||
</Helper>
|
||||
</div>
|
||||
<InputChoice
|
||||
bind:value={$templateConfig.generateKey}
|
||||
id="generate"
|
||||
label="Generate API key on completion"
|
||||
disabled={!!$templateConfig.appwriteApiKey}>
|
||||
The <code class="inline-code">APPWRITE_API_KEY</code> will be automatically generated for
|
||||
your project and applied to this function once it's created.
|
||||
</InputChoice>
|
||||
</FormList>
|
||||
</Box>
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { EmptySearch } from '$lib/components';
|
||||
import { EmptySearch, PaginationInline } from '$lib/components';
|
||||
import { Button, InputSearch, InputSelect } from '$lib/elements/forms';
|
||||
import { timeFromNow } from '$lib/helpers/date';
|
||||
import { app } from '$lib/stores/app';
|
||||
@@ -15,6 +15,8 @@
|
||||
export let selectedRepository: string = null;
|
||||
export let hasInstallations = false;
|
||||
export let action: 'button' | 'select' = 'select';
|
||||
let offset = 0;
|
||||
const limit = 5;
|
||||
|
||||
$: {
|
||||
hasInstallations = $installations?.total > 0;
|
||||
@@ -114,59 +116,67 @@
|
||||
{:then response}
|
||||
{#if response?.length}
|
||||
<ul class="table is-remove-outer-styles common-section">
|
||||
{#each response as repo}
|
||||
<li class="table-row">
|
||||
<div class="table-col">
|
||||
<div
|
||||
class="u-flex u-cross-center u-gap-8"
|
||||
style="margin-block: .75rem;">
|
||||
{#if action === 'select'}
|
||||
<input
|
||||
class="is-small u-margin-inline-end-8"
|
||||
type="radio"
|
||||
name="repositories"
|
||||
bind:group={selectedRepository}
|
||||
on:change={() => repository.set(repo)}
|
||||
value={repo.id} />
|
||||
{/if}
|
||||
{#each response as repo, i}
|
||||
{#if i < offset + limit && i > offset - limit}
|
||||
<li class="table-row">
|
||||
<div class="table-col">
|
||||
<div
|
||||
class="avatar is-size-x-small"
|
||||
style:--p-text-size="1.25rem"
|
||||
class:is-color-empty={!repo.runtime}>
|
||||
{#if repo.runtime}
|
||||
<img
|
||||
src={`${base}/icons/${$app.themeInUse}/color/${
|
||||
repo.runtime.split('-')[0]
|
||||
}.svg`}
|
||||
alt={repo.name} />
|
||||
class="u-flex u-cross-center u-gap-8"
|
||||
style="margin-block: .75rem;">
|
||||
{#if action === 'select'}
|
||||
<input
|
||||
class="is-small u-margin-inline-end-8"
|
||||
type="radio"
|
||||
name="repositories"
|
||||
bind:group={selectedRepository}
|
||||
on:change={() => repository.set(repo)}
|
||||
value={repo.id} />
|
||||
{/if}
|
||||
</div>
|
||||
<div class="u-flex u-gap-8">
|
||||
<span class="text">{repo.name}</span>
|
||||
{#if repo.private}
|
||||
<span
|
||||
class="icon-lock-closed"
|
||||
style="font-size: var(--icon-size-small)"
|
||||
aria-hidden="true" />
|
||||
{/if}
|
||||
<time class="u-color-text-gray" datetime={repo.pushedAt}>
|
||||
{timeFromNow(repo.pushedAt)}
|
||||
</time>
|
||||
</div>
|
||||
{#if action === 'button'}
|
||||
<div class="u-margin-inline-start-auto">
|
||||
<Button
|
||||
secondary
|
||||
on:click={() => dispatch('connect', repo)}>
|
||||
Connect
|
||||
</Button>
|
||||
<div
|
||||
class="avatar is-size-x-small"
|
||||
style:--p-text-size="1.25rem"
|
||||
class:is-color-empty={!repo.runtime}>
|
||||
{#if repo.runtime}
|
||||
<img
|
||||
src={`${base}/icons/${$app.themeInUse}/color/${
|
||||
repo.runtime.split('-')[0]
|
||||
}.svg`}
|
||||
alt={repo.name} />
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
<div class="u-flex u-gap-8">
|
||||
<span class="text u-trim-1">{repo.name}</span>
|
||||
{#if repo.private}
|
||||
<span
|
||||
class="icon-lock-closed"
|
||||
style="font-size: var(--icon-size-small)"
|
||||
aria-hidden="true" />
|
||||
{/if}
|
||||
<time
|
||||
class="u-color-text-gray u-trim-1"
|
||||
datetime={repo.pushedAt}>
|
||||
{timeFromNow(repo.pushedAt)}
|
||||
</time>
|
||||
</div>
|
||||
{#if action === 'button'}
|
||||
<div class="u-margin-inline-start-auto">
|
||||
<Button
|
||||
secondary
|
||||
on:click={() => dispatch('connect', repo)}>
|
||||
Connect
|
||||
</Button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</li>
|
||||
{/if}
|
||||
{/each}
|
||||
</ul>
|
||||
<div class="u-flex u-margin-block-start-32 u-main-space-between">
|
||||
<p class="text">Total results: {response?.length}</p>
|
||||
<PaginationInline {limit} bind:offset sum={response?.length} />
|
||||
</div>
|
||||
{:else if search}
|
||||
<EmptySearch hidePages>
|
||||
<div class="common-section">
|
||||
|
||||
@@ -9,29 +9,42 @@
|
||||
import { wizard } from '$lib/stores/wizard';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
|
||||
async function createGitHubInstallation() {
|
||||
await sdk.forProject.functions.update(
|
||||
$func.$id,
|
||||
$func.name,
|
||||
$func.runtime,
|
||||
$func.entrypoint || undefined,
|
||||
$func.execute || undefined,
|
||||
$func.events || undefined,
|
||||
$func.schedule || undefined,
|
||||
$func.timeout || undefined,
|
||||
$func.enabled || undefined,
|
||||
$func.logging || undefined,
|
||||
$func.commands || undefined,
|
||||
$installation.$id,
|
||||
$repository.id,
|
||||
$choices.branch,
|
||||
$choices.silentMode,
|
||||
$choices.rootDir
|
||||
);
|
||||
await invalidate(Dependencies.FUNCTION);
|
||||
resetState();
|
||||
wizard.hide();
|
||||
try {
|
||||
await sdk.forProject.functions.update(
|
||||
$func.$id,
|
||||
$func.name,
|
||||
$func.runtime,
|
||||
$func.entrypoint || undefined,
|
||||
$func.execute || undefined,
|
||||
$func.events || undefined,
|
||||
$func.schedule || undefined,
|
||||
$func.timeout || undefined,
|
||||
$func.enabled || undefined,
|
||||
$func.logging || undefined,
|
||||
$func.commands || undefined,
|
||||
$installation.$id,
|
||||
$repository.id,
|
||||
$choices.branch,
|
||||
$choices.silentMode || undefined,
|
||||
$choices.rootDir
|
||||
);
|
||||
trackEvent(Submit.FunctionConnectRepo, {
|
||||
customId: !!$func.$id
|
||||
});
|
||||
await invalidate(Dependencies.FUNCTION);
|
||||
resetState();
|
||||
wizard.hide();
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.FunctionConnectRepo);
|
||||
}
|
||||
}
|
||||
|
||||
function resetState() {
|
||||
|
||||
@@ -28,8 +28,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { Heading } from '$lib/components';
|
||||
import { clickOnEnter } from '$lib/helpers/a11y';
|
||||
import { AvatarGroup, Heading } from '$lib/components';
|
||||
import WizardCover from '$lib/layout/wizardCover.svelte';
|
||||
import { app } from '$lib/stores/app';
|
||||
import { wizard } from '$lib/stores/wizard';
|
||||
@@ -40,6 +39,8 @@
|
||||
import Repositories from './components/repositories.svelte';
|
||||
import CreateManual from './createManual.svelte';
|
||||
import CreateGit from './createGit.svelte';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { page } from '$app/stores';
|
||||
|
||||
let hasInstallations: boolean;
|
||||
let selectedRepository: string;
|
||||
@@ -77,10 +78,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<p class="u-margin-block-start-16">
|
||||
You can also create a function <span
|
||||
You can also create a function <button
|
||||
class="link"
|
||||
on:keyup={clickOnEnter}
|
||||
on:click={() => wizard.start(CreateManual)}>manually</span>
|
||||
on:click={() => wizard.start(CreateManual)}>manually</button>
|
||||
or using the CLI.
|
||||
<a href="https://appwrite.io/docs/functions-deploy" target="_blank" rel="noopener noreferrer" class="link"
|
||||
>Learn more</a
|
||||
@@ -101,8 +101,9 @@
|
||||
{:then runtimes}
|
||||
<ul
|
||||
class="grid-box u-margin-block-start-16"
|
||||
style:--grid-gap="1rem"
|
||||
style:--p-grid-item-size="8rem">
|
||||
style:--grid-item-size="8rem"
|
||||
style:--grid-item-size-small-screens="9rem"
|
||||
style:--grid-gap="1rem">
|
||||
{#each quickStart.runtimes.filter((_template, index) => index < 6) as runtime}
|
||||
{@const runtimeDetail = runtimes.find(
|
||||
(r) => r.$id === runtime.name
|
||||
@@ -132,19 +133,18 @@
|
||||
class="box u-width-full-line u-flex u-cross-center u-gap-8"
|
||||
style:--box-padding="1rem"
|
||||
style:--box-border-radius="var(--border-radius-small)">
|
||||
<div class="avatar is-size-small">
|
||||
<img
|
||||
style:--p-text-size="1.25rem"
|
||||
src={`${base}/icons/${$app.themeInUse}/grayscale/dotnet.svg`}
|
||||
alt="dotnet-7.0" />
|
||||
</div>
|
||||
<div class="body-text-2 u-trim">Coming soon</div>
|
||||
<AvatarGroup
|
||||
icons={['dotnet', 'deno']}
|
||||
total={4}
|
||||
avatarSize="small"
|
||||
bordered />
|
||||
</div>
|
||||
</li>
|
||||
{/if}
|
||||
</ul>
|
||||
{/await}
|
||||
</section>
|
||||
<div class="u-sep-block-start common-section" />
|
||||
<section class="common-section">
|
||||
<h2 class="heading-level-6">Templates</h2>
|
||||
<p class="text u-margin-block-start-8">
|
||||
@@ -155,6 +155,7 @@
|
||||
{#each templates as template}
|
||||
<li class="clickable-list-item">
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => connectTemplate(template)}
|
||||
class="clickable-list-button u-width-full-line u-flex u-gap-12">
|
||||
<div class="avatar is-size-small" style:--p-text-size="1.25rem">
|
||||
@@ -171,6 +172,13 @@
|
||||
{/each}
|
||||
</ul>
|
||||
</section>
|
||||
<Button
|
||||
text
|
||||
class="u-margin-inline-start-auto u-margin-block-start-16"
|
||||
href={`${base}/console/project-${$page.params.project}/functions/templates`}>
|
||||
<span> All templates </span>
|
||||
<span class="icon-cheveron-right" aria-hidden="true" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { choices, createFunction, installation, repository } from './store';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { Submit, trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import ExecuteAccess from './steps/executeAccess.svelte';
|
||||
@@ -15,34 +15,44 @@
|
||||
import FunctionConfiguration from './steps/functionConfiguration.svelte';
|
||||
|
||||
async function create() {
|
||||
const response = await sdk.forProject.functions.create(
|
||||
$createFunction.$id || ID.unique(),
|
||||
$createFunction.name,
|
||||
$createFunction.runtime,
|
||||
$createFunction.entrypoint,
|
||||
$createFunction.execute || undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
$createFunction.commands || undefined,
|
||||
$installation.$id,
|
||||
$repository.id,
|
||||
$choices.branch,
|
||||
$choices.silentMode || undefined,
|
||||
$choices.rootDir || undefined
|
||||
);
|
||||
goto(`${base}/console/project-${$page.params.project}/functions/function-${response.$id}`);
|
||||
addNotification({
|
||||
message: `${$createFunction.name} has been created`,
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent(Submit.FunctionCreate, {
|
||||
customId: !!$createFunction.$id
|
||||
});
|
||||
resetState();
|
||||
wizard.hide();
|
||||
try {
|
||||
const response = await sdk.forProject.functions.create(
|
||||
$createFunction.$id || ID.unique(),
|
||||
$createFunction.name,
|
||||
$createFunction.runtime,
|
||||
$createFunction.entrypoint,
|
||||
$createFunction.execute || undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
$createFunction.commands || undefined,
|
||||
$installation.$id,
|
||||
$repository.id,
|
||||
$choices.branch,
|
||||
$choices.silentMode || undefined,
|
||||
$choices.rootDir || undefined
|
||||
);
|
||||
goto(
|
||||
`${base}/console/project-${$page.params.project}/functions/function-${response.$id}`
|
||||
);
|
||||
addNotification({
|
||||
message: `${$createFunction.name} has been created`,
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent(Submit.FunctionCreate, {
|
||||
customId: !!$createFunction.$id
|
||||
});
|
||||
resetState();
|
||||
wizard.hide();
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.FunctionCreate);
|
||||
}
|
||||
}
|
||||
|
||||
function resetState() {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
repository
|
||||
} from './store';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { Submit, trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import Details from './steps/details.svelte';
|
||||
@@ -57,6 +57,7 @@
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.FunctionCreate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { choices, installation, repository, template, templateConfig } from './store';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { Submit, trackEvent } from '$lib/actions/analytics';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import GitConfiguration from './steps/gitConfiguration.svelte';
|
||||
@@ -15,44 +15,64 @@
|
||||
import RepositoryBehaviour from './steps/repositoryBehaviour.svelte';
|
||||
import CreateRepository from './steps/createRepository.svelte';
|
||||
import TemplateVariables from './steps/templateVariables.svelte';
|
||||
import { scopes } from '$lib/constants';
|
||||
|
||||
async function create() {
|
||||
const runtimeDetail = $template.runtimes.find((r) => r.name === $templateConfig.runtime);
|
||||
|
||||
const response = await sdk.forProject.functions.create(
|
||||
$templateConfig.$id || ID.unique(),
|
||||
$templateConfig.name,
|
||||
$templateConfig.runtime,
|
||||
runtimeDetail.entrypoint,
|
||||
$template.permissions || undefined,
|
||||
$template.events || undefined,
|
||||
$template.cron || undefined,
|
||||
$template.timeout || undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
runtimeDetail.commands || undefined,
|
||||
$installation.$id,
|
||||
$repository.id,
|
||||
$choices.branch,
|
||||
$choices.silentMode || undefined,
|
||||
$choices.rootDir || undefined,
|
||||
$template.providerRepositoryId,
|
||||
$template.providerOwner,
|
||||
runtimeDetail.providerRootDirectory,
|
||||
$template.providerBranch
|
||||
);
|
||||
goto(`${base}/console/project-${$page.params.project}/functions/function-${response.$id}`);
|
||||
addNotification({
|
||||
message: `${response.name} has been created`,
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent(Submit.FunctionCreate, {
|
||||
customId: !!response.$id
|
||||
});
|
||||
resetState();
|
||||
wizard.hide();
|
||||
try {
|
||||
const runtimeDetail = $template.runtimes.find(
|
||||
(r) => r.name === $templateConfig.runtime
|
||||
);
|
||||
if ($templateConfig.appwriteApiKey) {
|
||||
$templateConfig.variables['APPWRITE_API_KEY'] = $templateConfig.appwriteApiKey;
|
||||
} else if ($templateConfig?.generateKey) {
|
||||
const key = await sdk.forConsole.projects.createKey(
|
||||
$page.params.project,
|
||||
'Generated for Template',
|
||||
scopes.map((scope) => scope.scope)
|
||||
);
|
||||
$templateConfig.variables['APPWRITE_API_KEY'] = key.secret;
|
||||
}
|
||||
const response = await sdk.forProject.functions.create(
|
||||
$templateConfig.$id || ID.unique(),
|
||||
$templateConfig.name,
|
||||
$templateConfig.runtime,
|
||||
runtimeDetail.entrypoint,
|
||||
$template.permissions || undefined,
|
||||
$template.events || undefined,
|
||||
$template.cron || undefined,
|
||||
$template.timeout || undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
runtimeDetail.commands || undefined,
|
||||
$installation.$id,
|
||||
$repository.id,
|
||||
$choices.branch,
|
||||
$choices.silentMode || undefined,
|
||||
$choices.rootDir || undefined,
|
||||
$template.providerRepositoryId,
|
||||
$template.providerOwner,
|
||||
runtimeDetail.providerRootDirectory,
|
||||
$template.providerBranch
|
||||
);
|
||||
goto(
|
||||
`${base}/console/project-${$page.params.project}/functions/function-${response.$id}`
|
||||
);
|
||||
addNotification({
|
||||
message: `${response.name} has been created`,
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent(Submit.FunctionCreate, {
|
||||
customId: !!response.$id
|
||||
});
|
||||
resetState();
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.FunctionCreate);
|
||||
}
|
||||
}
|
||||
|
||||
function resetState() {
|
||||
wizard.hide();
|
||||
templateConfig.set(null);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import InputSelectSearch from '$lib/elements/forms/inputSelectSearch.svelte';
|
||||
import { WizardStep } from '$lib/layout';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { sortBranches } from '$routes/console/project-[project]/functions/function-[function]/settings/updateConfiguration.svelte';
|
||||
import { choices, installation, repository } from '../store';
|
||||
|
||||
$choices.rootDir ??= '';
|
||||
@@ -20,13 +21,7 @@
|
||||
$installation.$id,
|
||||
$repository.id
|
||||
);
|
||||
const sorted = branches.sort((a, b) => {
|
||||
if (a.name === 'main' || a.name === 'master') {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return a.name > b.name ? -1 : 1;
|
||||
});
|
||||
const sorted = sortBranches(branches);
|
||||
$choices.branch = sorted[0]?.name ?? null;
|
||||
|
||||
if (!$choices.branch) {
|
||||
@@ -57,25 +52,34 @@
|
||||
<div class="loader u-margin-32" />
|
||||
</div>
|
||||
{:then branches}
|
||||
{@const options =
|
||||
branches
|
||||
?.map((branch) => {
|
||||
return {
|
||||
value: branch.name,
|
||||
label: branch.name
|
||||
};
|
||||
})
|
||||
?.sort((a, b) => {
|
||||
return a.label > b.label ? 1 : -1;
|
||||
}) ?? []}
|
||||
<div class="u-margin-block-start-24">
|
||||
<FormList>
|
||||
<InputSelectSearch
|
||||
required={true}
|
||||
id="branch"
|
||||
label="Select branch"
|
||||
placeholder="main"
|
||||
label="Production branch"
|
||||
placeholder="Select branch"
|
||||
tooltip="Every commit pushed to this branch will activate the deployment after a successful build"
|
||||
hideRequired
|
||||
bind:value={$choices.branch}
|
||||
bind:search={$choices.branch}
|
||||
on:select={(event) => {
|
||||
$choices.branch = event.detail.value;
|
||||
}}
|
||||
interactiveOutput
|
||||
name="branch"
|
||||
options={branches?.map((branch) => {
|
||||
return {
|
||||
value: branch.name,
|
||||
label: branch.name
|
||||
};
|
||||
}) ?? []} />
|
||||
{options} />
|
||||
<InputText
|
||||
id="root"
|
||||
label="Root directory"
|
||||
@@ -84,7 +88,7 @@
|
||||
<InputChoice
|
||||
id="silent"
|
||||
label="Silent mode"
|
||||
tooltip="Don't create comments when pushing to this repository"
|
||||
tooltip="When enabled, comments will not be made on pull requests in this repository"
|
||||
bind:value={$choices.silentMode} />
|
||||
</FormList>
|
||||
</div>
|
||||
@@ -95,7 +99,7 @@
|
||||
href={$repository.html_url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="link">{$repository.provider}</a
|
||||
class="link">GitHub</a
|
||||
>.
|
||||
</p>
|
||||
</WizardStep>
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { LabelCard } from '$lib/components';
|
||||
import { WizardStep } from '$lib/layout';
|
||||
import { templateConfig } from '../store';
|
||||
|
||||
@@ -17,47 +18,13 @@
|
||||
</svelte:fragment>
|
||||
|
||||
<ul class="u-flex u-flex-vertical u-gap-24">
|
||||
<li>
|
||||
<label
|
||||
class="card is-allow-focus u-cursor-pointer"
|
||||
style="--card-padding:1rem; --card-border-radius:var(--border-radius-small);">
|
||||
<div class="u-flex u-gap-16">
|
||||
<input
|
||||
bind:group={$templateConfig.repositoryBehaviour}
|
||||
class="is-small u-margin-block-start-2"
|
||||
value="new"
|
||||
type="radio"
|
||||
name="repositoryBehaviour" />
|
||||
<div class="u-flex u-flex-vertical u-gap-4">
|
||||
<h4 class="body-text-2 u-bold">Create new repository</h4>
|
||||
<p class="u-color-text-gray">
|
||||
Clone the template and create a new repository in your selected
|
||||
organization.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label
|
||||
class="card is-allow-focus u-cursor-pointer"
|
||||
style="--card-padding:1rem; --card-border-radius:var(--border-radius-small);">
|
||||
<div class="u-flex u-gap-16">
|
||||
<input
|
||||
bind:group={$templateConfig.repositoryBehaviour}
|
||||
class="is-small u-margin-block-start-2"
|
||||
value="existing"
|
||||
type="radio"
|
||||
name="repositoryBehaviour" />
|
||||
<div class="u-flex u-flex-vertical u-gap-4">
|
||||
<h4 class="body-text-2 u-bold">Add to existing repository</h4>
|
||||
<p class="u-color-text-gray">
|
||||
Clone the template to an existing repository in your selected
|
||||
organization.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</label>
|
||||
</li>
|
||||
<LabelCard name="test" value="new" bind:group={$templateConfig.repositoryBehaviour}>
|
||||
<svelte:fragment slot="title">Create a new repository</svelte:fragment>
|
||||
Clone the template and create a new repository in your selected organization.
|
||||
</LabelCard>
|
||||
<LabelCard name="test" value="new" bind:group={$templateConfig.repositoryBehaviour}>
|
||||
<svelte:fragment slot="title">Add to existing repository</svelte:fragment>
|
||||
Clone the template to an existing repository in your selected organization.
|
||||
</LabelCard>
|
||||
</ul>
|
||||
</WizardStep>
|
||||
@@ -12,12 +12,6 @@
|
||||
if (!$templateConfig.runtime) {
|
||||
throw new Error('Please select a runtime.');
|
||||
}
|
||||
|
||||
for (const variable of $template.variables) {
|
||||
if (!variable.required) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function loadRuntimes() {
|
||||
|
||||
@@ -1,52 +1,12 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import Alert from '$lib/components/alert.svelte';
|
||||
import Button from '$lib/elements/forms/button.svelte';
|
||||
import InputText from '$lib/elements/forms/inputText.svelte';
|
||||
import { WizardStep } from '$lib/layout';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { template, templateConfig } from '../store';
|
||||
import { scopes } from '$lib/constants';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
|
||||
let generatingApiKey = false;
|
||||
let showApiKeyCheck = false;
|
||||
|
||||
async function generateApiKey() {
|
||||
if (generatingApiKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
generatingApiKey = true;
|
||||
|
||||
try {
|
||||
const key = await await sdk.forConsole.projects.createKey(
|
||||
$page.params.project,
|
||||
'Generated for Template',
|
||||
scopes.map((scope) => scope.scope)
|
||||
);
|
||||
$templateConfig.variables['APPWRITE_API_KEY'] = key.secret;
|
||||
showApiKeyCheck = true;
|
||||
|
||||
addNotification({
|
||||
type: 'success',
|
||||
message: 'Key generated successfully.'
|
||||
});
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
} finally {
|
||||
generatingApiKey = false;
|
||||
}
|
||||
}
|
||||
import { FormList, Helper } from '$lib/elements/forms';
|
||||
import { Card, Collapsible, CollapsibleItem } from '$lib/components';
|
||||
import AppwriteVariable from '../components/appwriteVariable.svelte';
|
||||
|
||||
async function beforeSubmit() {
|
||||
if (!$templateConfig.runtime) {
|
||||
throw new Error('Please select a runtime.');
|
||||
}
|
||||
|
||||
for (const variable of $template.variables) {
|
||||
if (!variable.required) {
|
||||
continue;
|
||||
@@ -57,6 +17,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$: requiredVariables = $template?.variables?.filter((v) => v.required);
|
||||
$: optionalVariables = $template?.variables?.filter((v) => !v.required);
|
||||
</script>
|
||||
|
||||
<WizardStep {beforeSubmit}>
|
||||
@@ -65,67 +28,75 @@
|
||||
Edit the values of the environment variables that will be passed to your function at
|
||||
runtime.
|
||||
</svelte:fragment>
|
||||
<div class="u-flex u-flex-vertical u-gap-24">
|
||||
{#if $template.variables.length > 0}
|
||||
<div class="u-flex u-flex-vertical u-gap-16">
|
||||
<p class="text u-bold">Environment variables</p>
|
||||
{#if $template?.variables?.length}
|
||||
{#if requiredVariables?.length}
|
||||
<Collapsible>
|
||||
<CollapsibleItem open={true}>
|
||||
<svelte:fragment slot="title">Required variables</svelte:fragment>
|
||||
<svelte:fragment slot="subtitle">
|
||||
<span class="inline-tag">{requiredVariables.length}</span>
|
||||
</svelte:fragment>
|
||||
|
||||
<div class="u-flex u-flex-vertical u-gap-16">
|
||||
{#each $template.variables as variable}
|
||||
<div>
|
||||
<FormList>
|
||||
{#each requiredVariables as variable}
|
||||
{#if variable.name === 'APPWRITE_API_KEY'}
|
||||
<Alert type="info">
|
||||
<svelte:fragment slot="title">API key creation</svelte:fragment>
|
||||
<p class="text">
|
||||
By clicking generate button, an API key will be
|
||||
automatically generated in the background, and filled into
|
||||
input field. This API key will be granted all scopes and
|
||||
will never expire.
|
||||
</p>
|
||||
</Alert>
|
||||
{/if}
|
||||
<div class="u-margin-block-start-12 u-flex u-gap-8 u-cross-end">
|
||||
<div class="u-width-full-line">
|
||||
<AppwriteVariable appwriteVariable={variable} />
|
||||
{:else}
|
||||
<div>
|
||||
<InputText
|
||||
id={variable.name}
|
||||
label={variable.name}
|
||||
placeholder={variable.placeholder ?? ''}
|
||||
placeholder={variable.placeholder ?? 'Enter value'}
|
||||
required={variable.required}
|
||||
autocomplete={false}
|
||||
bind:value={$templateConfig.variables[variable.name]} />
|
||||
|
||||
<Helper type="neutral">
|
||||
{@html variable.description}
|
||||
</Helper>
|
||||
</div>
|
||||
|
||||
{#if variable.name === 'APPWRITE_API_KEY'}
|
||||
<Button
|
||||
disabled={$templateConfig.variables[variable.name]
|
||||
? true
|
||||
: false}
|
||||
secondary
|
||||
on:click={generateApiKey}>
|
||||
{#if showApiKeyCheck && ($templateConfig.variables[variable.name] ? true : false)}
|
||||
<span class="icon-check" aria-hidden="true" />
|
||||
{/if}
|
||||
|
||||
{#if generatingApiKey}
|
||||
<span class="loader is-small" />
|
||||
{:else if showApiKeyCheck && ($templateConfig.variables[variable.name] ? true : false)}
|
||||
<span class="text">Generated</span>
|
||||
{:else}
|
||||
<span class="text">Generate</span>
|
||||
{/if}
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="u-margin-block-start-4">
|
||||
<p class="helper">
|
||||
<span class="icon-info" aria-hidden="true" />
|
||||
<span class="text">{@html variable.description}</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
</FormList>
|
||||
</CollapsibleItem>
|
||||
</Collapsible>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if optionalVariables?.length}
|
||||
<Collapsible>
|
||||
<CollapsibleItem open={!requiredVariables?.length}>
|
||||
<svelte:fragment slot="title">Optional variables</svelte:fragment>
|
||||
<svelte:fragment slot="subtitle">
|
||||
<span class="inline-tag">{optionalVariables.length}</span>
|
||||
</svelte:fragment>
|
||||
|
||||
<FormList>
|
||||
{#each optionalVariables as variable}
|
||||
{#if variable.name === 'APPWRITE_API_KEY'}
|
||||
<AppwriteVariable appwriteVariable={variable} />
|
||||
{:else}
|
||||
<div>
|
||||
<InputText
|
||||
id={variable.name}
|
||||
label={variable.name}
|
||||
placeholder={variable.placeholder ?? 'Enter value'}
|
||||
required={variable.required}
|
||||
autocomplete={false}
|
||||
bind:value={$templateConfig.variables[variable.name]} />
|
||||
|
||||
<Helper type="neutral">
|
||||
{@html variable.description}
|
||||
</Helper>
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
</FormList>
|
||||
</CollapsibleItem>
|
||||
</Collapsible>
|
||||
{/if}
|
||||
{:else}
|
||||
<Card isDashed>
|
||||
<p class="text u-text-center">There are no environment variables to configure.</p>
|
||||
</Card>
|
||||
{/if}
|
||||
</WizardStep>
|
||||
@@ -13,6 +13,8 @@ export const templateConfig = writable<{
|
||||
repositoryName: string;
|
||||
repositoryPrivate: boolean;
|
||||
repositoryId: string;
|
||||
appwriteApiKey?: string;
|
||||
generateKey?: boolean;
|
||||
}>();
|
||||
export const repository = writable<Models.ProviderRepository>();
|
||||
export const installation = writable<Models.Installation>();
|
||||
|
||||
@@ -15,13 +15,18 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { onCLS, onFCP, onFID, onINP, onLCP, onTTFB } from 'web-vitals';
|
||||
import Loading from './loading.svelte';
|
||||
import { loading } from './store';
|
||||
import { loading, requestedMigration } from './store';
|
||||
import { parseIfString } from '$lib/helpers/object';
|
||||
|
||||
if (browser) {
|
||||
window.VERCEL_ANALYTICS_ID = import.meta.env.VERCEL_ANALYTICS_ID?.toString() ?? false;
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
if ($page.url.searchParams.has('migrate')) {
|
||||
const migrateData = $page.url.searchParams.get('migrate');
|
||||
requestedMigration.set(parseIfString(migrateData));
|
||||
}
|
||||
/**
|
||||
* Reporting Web Vitals.
|
||||
*/
|
||||
@@ -180,8 +185,4 @@
|
||||
background: var(--separator-color);
|
||||
}
|
||||
}
|
||||
|
||||
[type='checkbox']:where(:checked)::before {
|
||||
content: '\ea38';
|
||||
}
|
||||
</style>
|
||||
@@ -6,19 +6,12 @@ import { sdk } from '$lib/stores/sdk';
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import type { LayoutLoad } from './$types';
|
||||
import { requestedMigration } from './store';
|
||||
import { parseIfString } from '$lib/helpers/object';
|
||||
|
||||
export const ssr = false;
|
||||
|
||||
export const load: LayoutLoad = async ({ depends, url }) => {
|
||||
depends(Dependencies.ACCOUNT);
|
||||
|
||||
if (url.searchParams.has('migrate')) {
|
||||
const migrateData = url.searchParams.get('migrate');
|
||||
requestedMigration.set(parseIfString(migrateData));
|
||||
}
|
||||
|
||||
try {
|
||||
const account = await sdk.forConsole.account.get();
|
||||
|
||||
|
||||
@@ -46,4 +46,4 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<Wizard title="Create Project" {steps} on:exit={onExit} on:finish={onFinish} />
|
||||
<Wizard title="Create Migration" {steps} on:exit={onExit} on:finish={onFinish} />
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { Button, Form, FormList, InputText, InputPassword } from '$lib/elements/forms';
|
||||
import { CardGrid, Box, Heading, AvatarInitials } from '$lib/components';
|
||||
import { CardGrid, BoxAvatar, Heading, AvatarInitials } from '$lib/components';
|
||||
import { Container } from '$lib/layout';
|
||||
import { onMount } from 'svelte';
|
||||
import { user } from '$lib/stores/user';
|
||||
@@ -162,14 +162,14 @@
|
||||
and data. This action is irreversible.
|
||||
</p>
|
||||
<svelte:fragment slot="aside">
|
||||
<Box>
|
||||
<BoxAvatar>
|
||||
<svelte:fragment slot="image">
|
||||
<AvatarInitials size={48} name={$user.name} />
|
||||
</svelte:fragment>
|
||||
<svelte:fragment slot="title">
|
||||
<h6 class="u-bold u-trim-1">{$user.name}</h6>
|
||||
</svelte:fragment>
|
||||
</Box>
|
||||
</BoxAvatar>
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { CardGrid, Box, AvatarGroup, Heading } from '$lib/components';
|
||||
import { CardGrid, BoxAvatar, AvatarGroup, Heading } from '$lib/components';
|
||||
import { InputText, Form, Button } from '$lib/elements/forms';
|
||||
import { Container } from '$lib/layout';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
@@ -71,7 +71,7 @@
|
||||
associated with this organization. This action is irreversible.
|
||||
</p>
|
||||
<svelte:fragment slot="aside">
|
||||
<Box>
|
||||
<BoxAvatar>
|
||||
<svelte:fragment slot="image">
|
||||
<AvatarGroup {avatars} total={$members.total} />
|
||||
</svelte:fragment>
|
||||
@@ -79,7 +79,7 @@
|
||||
<h6 class="u-bold u-trim-1">{$organization.name}</h6>
|
||||
</svelte:fragment>
|
||||
<p>{$organization.total} members</p>
|
||||
</Box>
|
||||
</BoxAvatar>
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { AvatarInitials, Box, CardGrid, Heading } from '$lib/components';
|
||||
import { AvatarInitials, BoxAvatar, CardGrid, Heading } from '$lib/components';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import DeleteTeam from './deleteTeam.svelte';
|
||||
import { team } from './store';
|
||||
@@ -17,7 +17,7 @@
|
||||
action is irreversible.
|
||||
</p>
|
||||
<svelte:fragment slot="aside">
|
||||
<Box>
|
||||
<BoxAvatar>
|
||||
<svelte:fragment slot="image">
|
||||
<AvatarInitials size={48} name={$team.name} />
|
||||
</svelte:fragment>
|
||||
@@ -25,7 +25,7 @@
|
||||
<h6 class="u-bold u-trim-1">{$team.name}</h6>
|
||||
<span>{$team.total} Members</span>
|
||||
</svelte:fragment>
|
||||
</Box>
|
||||
</BoxAvatar>
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { CardGrid, Heading } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button, Form } from '$lib/elements/forms';
|
||||
import { Button, Form, FormItem, FormItemPart, InputText } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { onMount } from 'svelte';
|
||||
@@ -21,11 +21,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
let prefs: [string, unknown][] = null;
|
||||
let prefs: [string, string][] = null;
|
||||
let arePrefsDisabled = true;
|
||||
|
||||
onMount(async () => {
|
||||
prefs = Object.entries($team.prefs);
|
||||
prefs = Object.entries($team.prefs as Record<string, string>);
|
||||
if (!prefs?.length) {
|
||||
prefs.push(['', '']);
|
||||
}
|
||||
@@ -66,30 +66,25 @@
|
||||
<ul class="form-list">
|
||||
{#if prefs}
|
||||
{#each prefs as [key, value], index}
|
||||
<li class="form-item is-multiple">
|
||||
<div class="form-item-part u-stretch">
|
||||
<label class="label" for={`key-${index}`}>Key</label>
|
||||
<div class="input-text-wrapper">
|
||||
<input
|
||||
id={`key-${key}`}
|
||||
placeholder="Enter key"
|
||||
type="text"
|
||||
class="input-text"
|
||||
bind:value={key} />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-item-part u-stretch">
|
||||
<label class="label" for={`value-${index}`}> Value </label>
|
||||
<div class="input-text-wrapper">
|
||||
<input
|
||||
id={`value-${value}`}
|
||||
placeholder="Enter value"
|
||||
type="text"
|
||||
class="input-text"
|
||||
bind:value />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-item-part u-cross-child-end">
|
||||
<FormItem isMultiple>
|
||||
<InputText
|
||||
id={`key-${index}`}
|
||||
isMultiple
|
||||
fullWidth
|
||||
bind:value={key}
|
||||
placeholder="Enter key"
|
||||
label="Key"
|
||||
required />
|
||||
|
||||
<InputText
|
||||
id={`value-${index}`}
|
||||
isMultiple
|
||||
fullWidth
|
||||
bind:value
|
||||
placeholder="Enter value"
|
||||
label="Value"
|
||||
required />
|
||||
<FormItemPart alignEnd>
|
||||
<Button
|
||||
text
|
||||
disabled={(!key || !value) && index === 0}
|
||||
@@ -103,8 +98,8 @@
|
||||
}}>
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
</Button>
|
||||
</div>
|
||||
</li>
|
||||
</FormItemPart>
|
||||
</FormItem>
|
||||
{/each}
|
||||
{/if}
|
||||
</ul>
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
<div class="u-margin-block-start-24">
|
||||
<Alert
|
||||
isStandalone
|
||||
dismissible={false}
|
||||
type="info"
|
||||
buttons={[
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { CardGrid, Box, Heading, AvatarInitials } from '$lib/components';
|
||||
import { CardGrid, BoxAvatar, Heading, AvatarInitials } from '$lib/components';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { writable } from 'svelte/store';
|
||||
import DeleteUser from './deleteUser.svelte';
|
||||
@@ -30,7 +30,7 @@
|
||||
action is irreversible.
|
||||
</p>
|
||||
<svelte:fragment slot="aside">
|
||||
<Box>
|
||||
<BoxAvatar>
|
||||
<svelte:fragment slot="image">
|
||||
{#if $user.email || $user.phone}
|
||||
{#if $user.name}
|
||||
@@ -57,7 +57,7 @@
|
||||
: $user.email || $user.phone}
|
||||
</p>
|
||||
<p>Last activity: {accessedAt ? toLocaleDate(accessedAt) : 'never'}</p>
|
||||
</Box>
|
||||
</BoxAvatar>
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
<InputTags
|
||||
id="user-labels"
|
||||
label="Labels"
|
||||
placeholder="Select or tyype user labels"
|
||||
placeholder="Select or type user labels"
|
||||
bind:tags={labels} />
|
||||
<li>
|
||||
<Helper type={error ? 'warning' : 'neutral'}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { CardGrid, Heading } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button, Form } from '$lib/elements/forms';
|
||||
import { Button, Form, FormItem, FormItemPart, InputText } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { onMount } from 'svelte';
|
||||
@@ -21,7 +21,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
let prefs: [string, unknown][] = null;
|
||||
let prefs: [string, string][] = null;
|
||||
let arePrefsDisabled = true;
|
||||
|
||||
onMount(async () => {
|
||||
@@ -63,30 +63,25 @@
|
||||
<ul class="form-list">
|
||||
{#if prefs}
|
||||
{#each prefs as [key, value], index}
|
||||
<li class="form-item is-multiple">
|
||||
<div class="form-item-part u-stretch">
|
||||
<label class="label" for={`key-${index}`}>Key</label>
|
||||
<div class="input-text-wrapper">
|
||||
<input
|
||||
id={`key-${key}`}
|
||||
placeholder="Enter key"
|
||||
type="text"
|
||||
class="input-text"
|
||||
bind:value={key} />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-item-part u-stretch">
|
||||
<label class="label" for={`value-${index}`}> Value </label>
|
||||
<div class="input-text-wrapper">
|
||||
<input
|
||||
id={`value-${value}`}
|
||||
placeholder="Enter value"
|
||||
type="text"
|
||||
class="input-text"
|
||||
bind:value />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-item-part u-cross-child-end">
|
||||
<FormItem isMultiple>
|
||||
<InputText
|
||||
id={`key-${index}`}
|
||||
isMultiple
|
||||
fullWidth
|
||||
bind:value={key}
|
||||
placeholder="Enter key"
|
||||
label="Key"
|
||||
required />
|
||||
|
||||
<InputText
|
||||
id={`value-${index}`}
|
||||
isMultiple
|
||||
fullWidth
|
||||
bind:value
|
||||
placeholder="Enter value"
|
||||
label="Value"
|
||||
required />
|
||||
<FormItemPart alignEnd>
|
||||
<Button
|
||||
text
|
||||
disabled={(!key || !value) && index === 0}
|
||||
@@ -100,8 +95,8 @@
|
||||
}}>
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
</Button>
|
||||
</div>
|
||||
</li>
|
||||
</FormItemPart>
|
||||
</FormItem>
|
||||
{/each}
|
||||
{/if}
|
||||
</ul>
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { CardGrid, Box, Heading, Alert } from '$lib/components';
|
||||
import { CardGrid, BoxAvatar, Heading, Alert } from '$lib/components';
|
||||
import { Container } from '$lib/layout';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
@@ -116,14 +116,14 @@
|
||||
is irreversible.
|
||||
</p>
|
||||
<svelte:fragment slot="aside">
|
||||
<Box>
|
||||
<BoxAvatar>
|
||||
<svelte:fragment slot="title">
|
||||
<h6 class="u-bold u-trim-1">{$doc.$id}</h6>
|
||||
</svelte:fragment>
|
||||
<p>
|
||||
Last Updated: {toLocaleDateTime($doc.$updatedAt)}
|
||||
</p>
|
||||
</Box>
|
||||
</BoxAvatar>
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Box, CardGrid, Heading } from '$lib/components';
|
||||
import { BoxAvatar, CardGrid, Heading } from '$lib/components';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { toLocaleDateTime } from '$lib/helpers/date';
|
||||
import { collection } from '../store';
|
||||
@@ -15,12 +15,12 @@
|
||||
action is irreversible.
|
||||
</p>
|
||||
<svelte:fragment slot="aside">
|
||||
<Box>
|
||||
<BoxAvatar>
|
||||
<svelte:fragment slot="title">
|
||||
<h6 class="u-bold u-trim-1">{$collection.name}</h6>
|
||||
</svelte:fragment>
|
||||
<p>Last Updated: {toLocaleDateTime($collection.$updatedAt)}</p>
|
||||
</Box>
|
||||
</BoxAvatar>
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { Box, Card, CardGrid, Heading } from '$lib/components';
|
||||
import { BoxAvatar, Card, CardGrid, Heading } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button, Form, Helper, InputText } from '$lib/elements/forms';
|
||||
import { toLocaleDateTime } from '$lib/helpers/date';
|
||||
@@ -97,12 +97,12 @@
|
||||
team. This action is irreversible.
|
||||
</p>
|
||||
<svelte:fragment slot="aside">
|
||||
<Box>
|
||||
<BoxAvatar>
|
||||
<svelte:fragment slot="title">
|
||||
<h6 class="u-bold u-trim-1">{$database.name}</h6>
|
||||
<span>Last Updated: {toLocaleDateTime($database.$updatedAt)}</span>
|
||||
</svelte:fragment>
|
||||
</Box>
|
||||
</BoxAvatar>
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
|
||||
@@ -8,13 +8,14 @@ import { Query } from '@appwrite.io/console';
|
||||
|
||||
export const load: LayoutLoad = async ({ params, depends }) => {
|
||||
depends(Dependencies.FUNCTION);
|
||||
depends(Dependencies.DEPLOYMENTS);
|
||||
|
||||
try {
|
||||
return {
|
||||
header: Header,
|
||||
breadcrumbs: Breadcrumbs,
|
||||
function: sdk.forProject.functions.get(params.function),
|
||||
domain: sdk.forProject.proxy.listRules([
|
||||
proxyRuleList: sdk.forProject.proxy.listRules([
|
||||
Query.equal('resourceType', 'function'),
|
||||
Query.equal('resourceId', params.function),
|
||||
Query.limit(1)
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
TableRow,
|
||||
TableScroll
|
||||
} from '$lib/elements/table';
|
||||
import { execute, func } from './store';
|
||||
import { execute, func, proxyRuleList } from './store';
|
||||
import { Container } from '$lib/layout';
|
||||
import { app } from '$lib/stores/app';
|
||||
import { calculateSize, humanFileSize } from '$lib/helpers/sizeConvertion';
|
||||
@@ -38,10 +38,10 @@
|
||||
import Activate from './activate.svelte';
|
||||
import { calculateTime } from '$lib/helpers/timeConversion';
|
||||
import { Pill } from '$lib/elements';
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
import RedeployModal from './redeployModal.svelte';
|
||||
import DeploymentSource from './deploymentSource.svelte';
|
||||
import DeploymentCreatedBy from './deploymentCreatedBy.svelte';
|
||||
import DeploymentDomains from './deploymentDomains.svelte';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
</div>
|
||||
{#if activeDeployment && !$func.live}
|
||||
<div class="u-margin-block-start-8">
|
||||
<Alert type="warning">
|
||||
<Alert type="warning" isStandalone>
|
||||
Some configuration options are not live yet. Redeploy your function to apply
|
||||
latest changes.
|
||||
</Alert>
|
||||
@@ -108,19 +108,6 @@
|
||||
{$func.deployment}
|
||||
</Id>
|
||||
</div>
|
||||
|
||||
<div class="u-flex u-gap-12 u-cross-center u-margin-block-start-12">
|
||||
<p><b>Domain</b></p>
|
||||
</div>
|
||||
|
||||
<div class="u-flex u-gap-12 u-cross-center">
|
||||
<a
|
||||
class="u-underline u-cursor-pointer"
|
||||
href={`https//${data.domain.rules[0].domain}`}
|
||||
target="_blank">
|
||||
{data.domain.rules[0].domain}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<svelte:fragment slot="aside">
|
||||
@@ -130,14 +117,20 @@
|
||||
<div>
|
||||
<p><b>Build time:</b> {calculateTime(activeDeployment.buildTime)}</p>
|
||||
<p>
|
||||
<b>Created:</b>
|
||||
<b>Updated:</b>
|
||||
<DeploymentCreatedBy deployment={activeDeployment} />
|
||||
</p>
|
||||
<p><b>Size:</b> {fileSize.value + fileSize.unit}</p>
|
||||
<p>
|
||||
<p class="u-flex u-gap-4 u-cross-center">
|
||||
<b>Source:</b>
|
||||
<DeploymentSource deployment={activeDeployment} />
|
||||
</p>
|
||||
{#if $proxyRuleList?.rules?.length}
|
||||
<p class="u-flex u-gap-4 u-cross-center">
|
||||
<b>Domains:</b>
|
||||
<DeploymentDomains domain={$proxyRuleList} />
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="u-flex u-flex-vertical u-cross-end">
|
||||
<Pill
|
||||
@@ -168,128 +161,131 @@
|
||||
</svelte:fragment>
|
||||
</CardGrid>
|
||||
{:else}
|
||||
<Empty
|
||||
single
|
||||
href="https://appwrite.io/docs/functions#createFunction"
|
||||
target="deployment"
|
||||
on:click />
|
||||
<Empty single target="deployment">
|
||||
<div class="u-text-center">
|
||||
<Heading size="7" tag="h2"
|
||||
>Create your first deployment to get started.</Heading>
|
||||
<p class="body-text-2 u-bold u-margin-block-start-4">
|
||||
Learn more about deployments in our Documentation.
|
||||
</p>
|
||||
</div>
|
||||
<div class="u-flex u-gap-16 u-main-center">
|
||||
<Button
|
||||
external
|
||||
href="https://appwrite.io/docs/functions#createFunction"
|
||||
text
|
||||
event="empty_documentation"
|
||||
ariaLabel={`create {target}`}>Documentation</Button>
|
||||
<Create secondary />
|
||||
</div>
|
||||
</Empty>
|
||||
{/if}
|
||||
|
||||
<div class="common-section">
|
||||
<Heading tag="h3" size="7">All</Heading>
|
||||
</div>
|
||||
{#if data.deployments.total > 0}
|
||||
<TableScroll>
|
||||
<TableHeader>
|
||||
<TableCellHead width={150}>Deployment ID</TableCellHead>
|
||||
<TableCellHead width={100}>Status</TableCellHead>
|
||||
<TableCellHead width={70}>Source</TableCellHead>
|
||||
<TableCellHead width={180}>Created</TableCellHead>
|
||||
<TableCellHead width={100}>Build Time</TableCellHead>
|
||||
<TableCellHead width={70}>Size</TableCellHead>
|
||||
<TableCellHead width={25} />
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{#each data.deployments.deployments as deployment, index}
|
||||
{@const status = deployment.status}
|
||||
<TableRow>
|
||||
<TableCell width={150} title="Deployment ID">
|
||||
<Id value={deployment.$id}>{deployment.$id}</Id>
|
||||
</TableCell>
|
||||
<TableCell width={100} title="Status">
|
||||
<Pill
|
||||
danger={status === 'failed'}
|
||||
warning={status === 'pending'}
|
||||
success={status === 'completed' || status === 'ready'}
|
||||
info={status === 'processing' || status === 'building'}>
|
||||
{#if deployment.$id === $func.deployment}
|
||||
<span
|
||||
class="text u-trim"
|
||||
use:tooltip={{
|
||||
content: 'Active Deployment',
|
||||
placement: 'top'
|
||||
}}>
|
||||
<span class="icon-check-circle" aria-hidden="true" />
|
||||
<span>{status}</span>
|
||||
</span>
|
||||
<div class="u-margin-block-start-24">
|
||||
<TableScroll noMargin>
|
||||
<TableHeader>
|
||||
<TableCellHead width={150}>Deployment ID</TableCellHead>
|
||||
<TableCellHead width={100}>Status</TableCellHead>
|
||||
<TableCellHead width={70}>Source</TableCellHead>
|
||||
<TableCellHead width={180}>Updated</TableCellHead>
|
||||
<TableCellHead width={100}>Build Time</TableCellHead>
|
||||
<TableCellHead width={70}>Size</TableCellHead>
|
||||
<TableCellHead width={25} />
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{#each data.deployments.deployments as deployment, index}
|
||||
{@const status = deployment.status}
|
||||
<TableRow>
|
||||
<TableCell width={150} title="Deployment ID">
|
||||
<Id value={deployment.$id}>{deployment.$id}</Id>
|
||||
</TableCell>
|
||||
<TableCell width={100} title="Status">
|
||||
<Pill
|
||||
danger={status === 'failed'}
|
||||
warning={status === 'pending'}
|
||||
success={status === 'completed' || status === 'ready'}
|
||||
info={status === 'processing' || status === 'building'}>
|
||||
{status}
|
||||
</Pill>
|
||||
</TableCell>
|
||||
<TableCellText width={70} title="Source">
|
||||
<DeploymentSource {deployment} /></TableCellText>
|
||||
<TableCellText width={140} title="Created">
|
||||
<DeploymentCreatedBy {deployment} />
|
||||
</TableCellText>
|
||||
|
||||
<TableCellText width={100} title="Build Time">
|
||||
{#if ['processing', 'building'].includes(deployment.status)}
|
||||
<span use:timer={{ start: deployment.$createdAt }} />
|
||||
{:else}
|
||||
<span>{status}</span>
|
||||
{calculateTime(deployment.buildTime)}
|
||||
{/if}
|
||||
</Pill>
|
||||
</TableCell>
|
||||
<TableCellText width={70} title="Source">
|
||||
<DeploymentSource {deployment} /></TableCellText>
|
||||
<TableCellText width={140} title="Created">
|
||||
<DeploymentCreatedBy {deployment} />
|
||||
</TableCellText>
|
||||
</TableCellText>
|
||||
|
||||
<TableCellText width={100} title="Build Time">
|
||||
{#if ['processing', 'building'].includes(deployment.status)}
|
||||
<span use:timer={{ start: deployment.$createdAt }} />
|
||||
{:else}
|
||||
{calculateTime(deployment.buildTime)}
|
||||
{/if}
|
||||
</TableCellText>
|
||||
<TableCellText width={70} title="Size">
|
||||
{calculateSize(deployment.size)}
|
||||
</TableCellText>
|
||||
|
||||
<TableCellText width={70} title="Size">
|
||||
{calculateSize(deployment.size)}
|
||||
</TableCellText>
|
||||
|
||||
<TableCell width={25} showOverflow>
|
||||
<DropList
|
||||
bind:show={showDropdown[index]}
|
||||
placement="bottom-start"
|
||||
noArrow>
|
||||
<button
|
||||
class="button is-only-icon is-text"
|
||||
aria-label="More options"
|
||||
on:click|preventDefault={() => {
|
||||
showDropdown[index] = !showDropdown[index];
|
||||
}}>
|
||||
<span class="icon-dots-horizontal" aria-hidden="true" />
|
||||
</button>
|
||||
<svelte:fragment slot="list">
|
||||
<DropListItem
|
||||
icon="refresh"
|
||||
on:click={() => {
|
||||
selectedDeployment = deployment;
|
||||
showRedeploy = true;
|
||||
showDropdown = [];
|
||||
<TableCell width={25} showOverflow>
|
||||
<DropList
|
||||
bind:show={showDropdown[index]}
|
||||
placement="bottom-start"
|
||||
noArrow>
|
||||
<button
|
||||
class="button is-only-icon is-text"
|
||||
aria-label="More options"
|
||||
on:click|preventDefault={() => {
|
||||
showDropdown[index] = !showDropdown[index];
|
||||
}}>
|
||||
Redeploy
|
||||
</DropListItem>
|
||||
{#if deployment.status === 'ready' && deployment.$id !== $func.deployment}
|
||||
<span class="icon-dots-horizontal" aria-hidden="true" />
|
||||
</button>
|
||||
<svelte:fragment slot="list">
|
||||
<DropListItem
|
||||
icon="lightning-bolt"
|
||||
icon="refresh"
|
||||
on:click={() => {
|
||||
selectedDeployment = deployment;
|
||||
showActivate = true;
|
||||
showRedeploy = true;
|
||||
showDropdown = [];
|
||||
}}>
|
||||
Activate
|
||||
Redeploy
|
||||
</DropListItem>
|
||||
{/if}
|
||||
<DropListLink
|
||||
icon="terminal"
|
||||
href={`/console/project-${$page.params.project}/functions/function-${$page.params.function}/deployment-${deployment.$id}`}>
|
||||
Output
|
||||
</DropListLink>
|
||||
<DropListItem
|
||||
icon="trash"
|
||||
on:click={() => {
|
||||
selectedDeployment = deployment;
|
||||
showDropdown = [];
|
||||
showDelete = true;
|
||||
}}>
|
||||
Delete
|
||||
</DropListItem>
|
||||
</svelte:fragment>
|
||||
</DropList>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
{/each}
|
||||
</TableBody>
|
||||
</TableScroll>
|
||||
{#if deployment.status === 'ready' && deployment.$id !== $func.deployment}
|
||||
<DropListItem
|
||||
icon="lightning-bolt"
|
||||
on:click={() => {
|
||||
selectedDeployment = deployment;
|
||||
showActivate = true;
|
||||
showDropdown = [];
|
||||
}}>
|
||||
Activate
|
||||
</DropListItem>
|
||||
{/if}
|
||||
<DropListLink
|
||||
icon="terminal"
|
||||
href={`/console/project-${$page.params.project}/functions/function-${$page.params.function}/deployment-${deployment.$id}`}>
|
||||
Output
|
||||
</DropListLink>
|
||||
<DropListItem
|
||||
icon="trash"
|
||||
on:click={() => {
|
||||
selectedDeployment = deployment;
|
||||
showDropdown = [];
|
||||
showDelete = true;
|
||||
}}>
|
||||
Delete
|
||||
</DropListItem>
|
||||
</svelte:fragment>
|
||||
</DropList>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
{/each}
|
||||
</TableBody>
|
||||
</TableScroll>
|
||||
</div>
|
||||
{:else}
|
||||
<Empty single target="deployment" on:click>
|
||||
<div class="u-text-center">
|
||||
@@ -306,13 +302,12 @@
|
||||
text
|
||||
event="empty_documentation"
|
||||
ariaLabel={`create {target}`}>Documentation</Button>
|
||||
<Button secondary on:click>Create deployment</Button>
|
||||
<Create />
|
||||
</div>
|
||||
</Empty>
|
||||
{/if}
|
||||
{:else}
|
||||
<Empty single target="deployment" on:click>
|
||||
<Empty single target="deployment">
|
||||
<div class="u-text-center">
|
||||
<Heading size="7" tag="h2">Create your first deployment to get started.</Heading>
|
||||
<p class="body-text-2 u-bold u-margin-block-start-4">
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { beforeNavigate } from '$app/navigation';
|
||||
import { DropList, DropListItem } from '$lib/components';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import CreateCli from './createCli.svelte';
|
||||
@@ -14,6 +15,8 @@
|
||||
let showCreateGit = false;
|
||||
let showCreateManual = false;
|
||||
|
||||
beforeNavigate(() => ($showCreateDeployment = false));
|
||||
|
||||
$: if ($showCreateDeployment && main) {
|
||||
show = true;
|
||||
}
|
||||
|
||||
+38
-9
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { Modal, NumericList, NumericListItem } from '$lib/components';
|
||||
import { Box, Code, Modal, NumericList, NumericListItem } from '$lib/components';
|
||||
import { func } from './store';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
@@ -20,16 +20,45 @@
|
||||
class="link">documentation</a
|
||||
>.
|
||||
</p>
|
||||
<div class="box">
|
||||
<Box>
|
||||
<NumericList>
|
||||
<NumericListItem>Checkout your production branch.</NumericListItem>
|
||||
<NumericListItem>Create a new commit</NumericListItem>
|
||||
<NumericListItem>Push your new commit</NumericListItem>
|
||||
<NumericListItem>A new deployment will be triggered automatically.</NumericListItem>
|
||||
<NumericListItem fullWidth>
|
||||
<span class="text">Checkout your production branch.</span>
|
||||
<div class="u-margin-block-start-16">
|
||||
<Code
|
||||
language="sh"
|
||||
withCopy
|
||||
noMargin
|
||||
code={`git checkout ${$func.providerBranch}`} />
|
||||
</div>
|
||||
</NumericListItem>
|
||||
<NumericListItem fullWidth>
|
||||
<span class="text"> Create a new commit </span>
|
||||
<div class="u-margin-block-start-16">
|
||||
<Code
|
||||
language="sh"
|
||||
withCopy
|
||||
noMargin
|
||||
code={`git commit -m "deploying with Appwrite"`} />
|
||||
</div>
|
||||
</NumericListItem>
|
||||
<NumericListItem fullWidth>
|
||||
<span class="text"> Push your new commit </span>
|
||||
<div class="u-margin-block-start-16">
|
||||
<Code
|
||||
language="sh"
|
||||
withCopy
|
||||
noMargin
|
||||
code={`git push ${$func.providerBranch}`} />
|
||||
</div>
|
||||
</NumericListItem>
|
||||
<NumericListItem>
|
||||
<span class="text"> A new deployment will be triggered automatically. </span>
|
||||
</NumericListItem>
|
||||
</NumericList>
|
||||
</div>
|
||||
</Box>
|
||||
{:else}
|
||||
<div class="box">
|
||||
<Box>
|
||||
<div class="u-flex u-gap-16">
|
||||
<span class=" icon-lightning-bolt" aria-hidden="true" />
|
||||
<div class="alert-content" data-private>
|
||||
@@ -48,7 +77,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Box>
|
||||
{/if}
|
||||
<svelte:fragment slot="footer">
|
||||
<Button secondary on:click={() => (show = false)}>Close</Button>
|
||||
|
||||
+15
-3
@@ -49,7 +49,17 @@
|
||||
</script>
|
||||
|
||||
<Modal {error} size="big" bind:show onSubmit={create}>
|
||||
<svelte:fragment slot="header">Create deployment</svelte:fragment>
|
||||
<svelte:fragment slot="header">Create manual deployment</svelte:fragment>
|
||||
<p class="text">
|
||||
Manually deploy a function by uploading a zip file containing the source code and a relative
|
||||
path to the entry point.
|
||||
<a
|
||||
href="https://appwrite.io/docs/functions#deployFunction"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="link">Learn more about function deployments</a
|
||||
>.
|
||||
</p>
|
||||
<FormList>
|
||||
<InputFile
|
||||
label="Gzipped code (tar.gz)"
|
||||
@@ -64,19 +74,21 @@
|
||||
required />
|
||||
<Collapsible>
|
||||
<CollapsibleItem>
|
||||
<svelte:fragment slot="title">Build commands</svelte:fragment>
|
||||
<svelte:fragment slot="title">Build settings</svelte:fragment>
|
||||
<svelte:fragment slot="subtitle">(optional)</svelte:fragment>
|
||||
<FormList>
|
||||
<InputTextarea
|
||||
label="Commands"
|
||||
placeholder="Enter a build commad (e.g. 'npm install')"
|
||||
tooltip="Enter a single command or chain multiple commands with the && operator"
|
||||
id="build"
|
||||
bind:value={buildCommand} />
|
||||
</FormList>
|
||||
</CollapsibleItem>
|
||||
</Collapsible>
|
||||
<InputChoice label="Activate deployment after build" id="activate" bind:value={active}>
|
||||
This deployment will be activated after the build is completed.</InputChoice>
|
||||
This deployment will be activated after the build is completed.
|
||||
</InputChoice>
|
||||
</FormList>
|
||||
<svelte:fragment slot="footer">
|
||||
<Button secondary on:click={() => (show = false)}>Close</Button>
|
||||
|
||||
+26
-4
@@ -7,7 +7,7 @@
|
||||
import { calculateTime } from '$lib/helpers/timeConversion';
|
||||
import { Container } from '$lib/layout';
|
||||
import { app } from '$lib/stores/app';
|
||||
import { func } from '../store';
|
||||
import { func, proxyRuleList } from '../store';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { onMount } from 'svelte';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
@@ -17,6 +17,9 @@
|
||||
import { timer } from '$lib/actions/timer';
|
||||
import DeploymentSource from '../deploymentSource.svelte';
|
||||
import { deployment } from './store';
|
||||
import DeploymentCreatedBy from '../deploymentCreatedBy.svelte';
|
||||
import DeploymentDomains from '../deploymentDomains.svelte';
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
|
||||
let logs = '';
|
||||
|
||||
@@ -75,12 +78,29 @@
|
||||
{calculateTime($deployment.buildTime)}
|
||||
{/if}
|
||||
</p>
|
||||
<p><b>Created:</b> <deploymentCreatedBy deployment={$deployment} /></p>
|
||||
<p><b>Size:</b> {fileSize.value + fileSize.unit}</p>
|
||||
<p><b>Updated:</b> <DeploymentCreatedBy deployment={$deployment} /></p>
|
||||
<p>
|
||||
<b>Size:</b>
|
||||
{fileSize.value + fileSize.unit}
|
||||
<span
|
||||
class="icon-info"
|
||||
aria-hidden="true"
|
||||
style="font-size: var(--icon-size-small)"
|
||||
use:tooltip={{
|
||||
content:
|
||||
'Build size is the size of your code that will run. If your code has been transpiled, it will include your library source code. If it has been compiled, it will include your build output file.'
|
||||
}} />
|
||||
</p>
|
||||
<p class="u-flex u-gap-4 u-cross-center">
|
||||
<b>Source:</b>
|
||||
<DeploymentSource deployment={$deployment} />
|
||||
</p>
|
||||
{#if $proxyRuleList?.rules?.length}
|
||||
<p class="u-flex u-gap-4 u-cross-center">
|
||||
<b>Domains:</b>
|
||||
<DeploymentDomains domain={$proxyRuleList} />
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="u-flex u-flex-vertical u-cross-end">
|
||||
<Pill
|
||||
@@ -100,9 +120,11 @@
|
||||
<section class="code-panel">
|
||||
<header class="code-panel-header u-flex u-main-space-between u-width-full-line">
|
||||
<div class="u-flex u-flex-vertical">
|
||||
<h4 class="u-bold">Build [{$func.name}]</h4>
|
||||
<h4 class="u-bold">Build {$func.name}</h4>
|
||||
{#if $deployment.status === 'building'}
|
||||
<span>Building...</span>
|
||||
{:else}
|
||||
{$deployment.status}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
},
|
||||
{
|
||||
href: `/console/project-${$project?.$id}/functions/function-${$func?.$id}/deployment-${$deployment?.$id}`,
|
||||
title: 'Build details'
|
||||
title: 'Deployment details'
|
||||
}
|
||||
];
|
||||
</script>
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
export let deployment: Models.Deployment;
|
||||
</script>
|
||||
|
||||
{timeFromNow(deployment.$createdAt)}
|
||||
{timeFromNow(deployment.$updatedAt)}
|
||||
{#if deployment.providerCommitAuthor}
|
||||
by <a
|
||||
class="u-underline u-cursor-pointer"
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
<script lang="ts">
|
||||
import { DropList, DropListLink, Trim } from '$lib/components';
|
||||
import { Pill } from '$lib/elements';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
|
||||
export let domain: Models.ProxyRuleList;
|
||||
let showDropdown = false;
|
||||
</script>
|
||||
|
||||
<div class="u-flex u-gap-4 u-cross-center">
|
||||
<Trim alternativeTrim>
|
||||
<a href={`http://${domain.rules[0].domain}`} target="_blank">
|
||||
<span class="link">
|
||||
{domain.rules[0].domain}
|
||||
</span> <span class="icon-external-link" aria-hidden="true" />
|
||||
</a>
|
||||
</Trim>
|
||||
{#if domain.rules.length > 1}
|
||||
<DropList bind:show={showDropdown} scrollable>
|
||||
<Pill button on:click={() => (showDropdown = !showDropdown)}>
|
||||
+{domain.rules.length - 1}
|
||||
</Pill>
|
||||
<svelte:fragment slot="list">
|
||||
{#each domain.rules as rule, i}
|
||||
{#if i !== 0}
|
||||
<DropListLink href={`http://${rule.domain}`} external icon="external-link">
|
||||
{rule.domain}
|
||||
</DropListLink>
|
||||
{/if}
|
||||
{/each}
|
||||
</svelte:fragment>
|
||||
</DropList>
|
||||
{/if}
|
||||
</div>
|
||||
+24
-44
@@ -1,54 +1,34 @@
|
||||
<script lang="ts">
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
import { DropList, DropListLink } from '$lib/components';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { tick } from 'svelte';
|
||||
|
||||
export let deployment: Models.Deployment;
|
||||
let tooltipContent: HTMLDivElement;
|
||||
let showDropdown = false;
|
||||
</script>
|
||||
|
||||
{#if deployment.type === 'vcs'}
|
||||
<span
|
||||
class="u-underline u-cursor-pointer"
|
||||
use:tooltip={{
|
||||
interactive: true,
|
||||
allowHTML: true,
|
||||
disabled: false,
|
||||
onShow(instance) {
|
||||
tick().then(() => {
|
||||
instance.setContent(tooltipContent);
|
||||
});
|
||||
}
|
||||
}}><span class="icon-github" aria-hidden="true" /> Git</span>
|
||||
<DropList bind:show={showDropdown}>
|
||||
<button
|
||||
on:click={() => (showDropdown = !showDropdown)}
|
||||
type="button"
|
||||
class="u-flex u-gap-4 u-cross-center">
|
||||
<span class="icon-github" aria-hidden="true" /> <span class="link">GitHub</span>
|
||||
</button>
|
||||
<svelte:fragment slot="list">
|
||||
<DropListLink href={deployment.providerRepositoryUrl} external icon="github">
|
||||
{deployment.providerRepositoryOwner}/{deployment.providerRepositoryName}
|
||||
</DropListLink>
|
||||
<DropListLink href={deployment.providerBranchUrl} external icon="git-branch">
|
||||
{deployment.providerBranch}
|
||||
</DropListLink>
|
||||
{#if deployment?.providerCommitMessage && deployment?.providerCommitHash && deployment?.providerCommitUrl}
|
||||
<DropListLink href={deployment.providerCommitUrl} external icon="git-commit">
|
||||
{deployment?.providerCommitHash?.substring(0, 7)}
|
||||
{deployment.providerCommitMessage}
|
||||
</DropListLink>
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
</DropList>
|
||||
{:else if deployment.type === 'manual'}
|
||||
<span class="icon-code" aria-hidden="true" /> <span>Manual</span>
|
||||
{/if}
|
||||
|
||||
<div class="u-hide">
|
||||
<div bind:this={tooltipContent} class="u-flex u-flex-vertical u-gap-2">
|
||||
<span
|
||||
><span class="icon-github" aria-hidden="true" />
|
||||
<a
|
||||
class="u-underline u-cursor-pointer"
|
||||
target="_blank"
|
||||
href={deployment.providerRepositoryUrl}
|
||||
>{deployment.providerRepositoryOwner}/{deployment.providerRepositoryName}</a
|
||||
></span>
|
||||
<span
|
||||
><span class="icon-git-branch" aria-hidden="true" />
|
||||
<a
|
||||
class="u-underline u-cursor-pointer"
|
||||
target="_blank"
|
||||
href={deployment.providerBranchUrl}>{deployment.providerBranch}</a
|
||||
></span>
|
||||
<span
|
||||
><span class="icon-git-commit" aria-hidden="true" />
|
||||
<a
|
||||
class="u-underline u-cursor-pointer"
|
||||
target="_blank"
|
||||
href={deployment.providerCommitUrl}
|
||||
>{deployment?.providerCommitHash?.substring(0, 7)}
|
||||
{deployment.providerCommitMessage}</a
|
||||
></span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,12 +1,13 @@
|
||||
<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 { Button } from '$lib/elements/forms';
|
||||
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';
|
||||
@@ -22,6 +23,7 @@
|
||||
let method = 'GET';
|
||||
let body = '';
|
||||
let headers: [string, string][] = [['', '']];
|
||||
let error: string = null;
|
||||
|
||||
const methodOptions = [
|
||||
{ label: 'GET', value: 'GET' },
|
||||
@@ -56,21 +58,21 @@
|
||||
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',
|
||||
message: `Function has been executed`
|
||||
});
|
||||
trackEvent(Submit.ExecutionCreate);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.ExecutionCreate);
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
trackError(e, Submit.ExecutionCreate);
|
||||
} finally {
|
||||
submitting = false;
|
||||
}
|
||||
@@ -84,15 +86,21 @@
|
||||
afterNavigate(close);
|
||||
</script>
|
||||
|
||||
<Modal headerDivider={false} bind:show size="big" onSubmit={handleSubmit} on:close={close}>
|
||||
<Modal
|
||||
headerDivider={false}
|
||||
bind:show
|
||||
size="big"
|
||||
onSubmit={handleSubmit}
|
||||
on:close={close}
|
||||
bind:error>
|
||||
<svelte:fragment slot="header">Execute function</svelte:fragment>
|
||||
<p class="text">
|
||||
Manually execute your function. Learn more about <a
|
||||
Manually execute your function. <a
|
||||
class="link"
|
||||
href="https://appwrite.io/docs/functions#execute"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
function executions
|
||||
Learn more
|
||||
</a>.
|
||||
</p>
|
||||
|
||||
@@ -108,44 +116,39 @@
|
||||
|
||||
<Collapsible>
|
||||
<CollapsibleItem>
|
||||
<svelte:fragment slot="title">Advanced settings (optional)</svelte:fragment>
|
||||
<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>
|
||||
|
||||
<Label>Headers</Label>
|
||||
<div>
|
||||
<Label
|
||||
tooltip="Headers should contain alphanumeric characters (a-z, A-Z, and 0-9) and hyphens only (- and _).">
|
||||
Headers
|
||||
</Label>
|
||||
</div>
|
||||
<div class="form u-grid u-gap-16">
|
||||
<ul class="form-list">
|
||||
<FormList>
|
||||
{#if headers}
|
||||
{#each headers as [name, value], index}
|
||||
<li class="form-item is-multiple">
|
||||
<div class="form-item-part u-stretch">
|
||||
<label class="label" for={`key-${index}`}>Name</label>
|
||||
<div class="input-text-wrapper">
|
||||
<input
|
||||
id={`key-${name}`}
|
||||
placeholder="Enter Name"
|
||||
type="text"
|
||||
class="input-text"
|
||||
bind:value={name} />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-item-part u-stretch">
|
||||
<label class="label" for={`value-${index}`}>
|
||||
Value
|
||||
</label>
|
||||
<div class="input-text-wrapper">
|
||||
<input
|
||||
id={`value-${value}`}
|
||||
placeholder="Enter value"
|
||||
type="text"
|
||||
class="input-text"
|
||||
bind:value />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-item-part u-cross-child-end">
|
||||
<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
|
||||
disabled={(!name || !value) && index === 0}
|
||||
@@ -159,11 +162,11 @@
|
||||
}}>
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
</Button>
|
||||
</div>
|
||||
</li>
|
||||
</FormItemPart>
|
||||
</FormItem>
|
||||
{/each}
|
||||
{/if}
|
||||
</ul>
|
||||
</FormList>
|
||||
<Button
|
||||
noMargin
|
||||
text
|
||||
|
||||
+23
-8
@@ -13,7 +13,7 @@
|
||||
TableRowButton,
|
||||
TableScroll
|
||||
} from '$lib/elements/table';
|
||||
import { 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) => {
|
||||
@@ -37,7 +38,7 @@
|
||||
});
|
||||
});
|
||||
|
||||
function showLogs(execution: Models.Execution<Record<string, string>>) {
|
||||
function showLogs(execution: Models.Execution) {
|
||||
$log.show = true;
|
||||
$log.func = $func;
|
||||
$log.data = execution;
|
||||
@@ -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">
|
||||
@@ -69,6 +74,8 @@
|
||||
<TableCellHead width={110}>Status</TableCellHead>
|
||||
<TableCellHead width={140}>Created</TableCellHead>
|
||||
<TableCellHead width={90}>Trigger</TableCellHead>
|
||||
<TableCellHead width={70}>Method</TableCellHead>
|
||||
<TableCellHead width={90}>Path</TableCellHead>
|
||||
<TableCellHead width={80}>Duration</TableCellHead>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
@@ -77,7 +84,7 @@
|
||||
<TableCell width={150} title="Execution ID">
|
||||
<Id value={execution.$id}>{execution.$id}</Id>
|
||||
</TableCell>
|
||||
<TableCellText width={110} title="Status">
|
||||
<TableCell width={110} title="Status">
|
||||
{@const status = execution.status}
|
||||
<Pill
|
||||
danger={status === 'failed'}
|
||||
@@ -86,14 +93,20 @@
|
||||
info={status === 'processing' || status === 'building'}>
|
||||
<span class="text u-trim">{execution.status}</span>
|
||||
</Pill>
|
||||
</TableCellText>
|
||||
</TableCell>
|
||||
<TableCellText width={140} title="Created">
|
||||
{toLocaleDateTime(execution.$createdAt)}
|
||||
{timeFromNow(execution.$createdAt)}
|
||||
</TableCellText>
|
||||
<TableCellText width={90} title="Trigger">
|
||||
<TableCell width={90} title="Trigger">
|
||||
<Pill>
|
||||
<span class="text u-trim">{execution.trigger}</span>
|
||||
</Pill>
|
||||
</TableCell>
|
||||
<TableCellText width={70} title="Method">
|
||||
{execution.requestMethod}
|
||||
</TableCellText>
|
||||
<TableCellText width={90} title="Path">
|
||||
{execution.requestPath}
|
||||
</TableCellText>
|
||||
<TableCellText width={80} title="Duration">
|
||||
{calculateTime(execution.duration)}
|
||||
@@ -120,8 +133,10 @@
|
||||
<Button text external href="https://appwrite.io/docs/functions#execute">
|
||||
Documentation
|
||||
</Button>
|
||||
<Create bind:showCreateManual={showCreate} />
|
||||
<Create secondary />
|
||||
</div>
|
||||
</EmptySearch>
|
||||
{/if}
|
||||
</Container>
|
||||
|
||||
<Execute {selectedFunction} />
|
||||
@@ -15,12 +15,6 @@
|
||||
event: 'deployments',
|
||||
hasChildren: true
|
||||
},
|
||||
{
|
||||
href: `${path}/usage`,
|
||||
title: 'Usage',
|
||||
event: 'sage',
|
||||
hasChildren: true
|
||||
},
|
||||
{
|
||||
href: `${path}/executions`,
|
||||
title: 'Executions',
|
||||
@@ -32,6 +26,12 @@
|
||||
title: 'Domains',
|
||||
event: 'domains'
|
||||
},
|
||||
{
|
||||
href: `${path}/usage`,
|
||||
title: 'Usage',
|
||||
event: 'sage',
|
||||
hasChildren: true
|
||||
},
|
||||
{
|
||||
href: `${path}/settings`,
|
||||
event: 'settings',
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@
|
||||
<ExecuteFunction />
|
||||
<UpdateName />
|
||||
<UpdateRuntime />
|
||||
<UpdateConfiguration installations={data.installations} />
|
||||
<UpdateConfiguration />
|
||||
<UpdateLogging />
|
||||
<UpdatePermissions />
|
||||
<UpdateEvents />
|
||||
|
||||
+3
-1
@@ -4,6 +4,7 @@ import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ params, depends }) => {
|
||||
depends(Dependencies.VARIABLES);
|
||||
depends(Dependencies.FUNCTIONS);
|
||||
|
||||
const [globalVariables, variables] = await Promise.all([
|
||||
sdk.forProject.projectApi.listVariables(),
|
||||
@@ -30,6 +31,7 @@ export const load: PageLoad = async ({ params, depends }) => {
|
||||
|
||||
return {
|
||||
variables,
|
||||
globalVariables
|
||||
globalVariables,
|
||||
installations: sdk.forProject.vcs.listInstallations()
|
||||
};
|
||||
};
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Box, CardGrid } from '$lib/components';
|
||||
import { BoxAvatar, CardGrid } from '$lib/components';
|
||||
import Heading from '$lib/components/heading.svelte';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { toLocaleDateTime } from '$lib/helpers/date';
|
||||
@@ -17,12 +17,12 @@
|
||||
action is irreversible.
|
||||
</p>
|
||||
<svelte:fragment slot="aside">
|
||||
<Box>
|
||||
<BoxAvatar>
|
||||
<svelte:fragment slot="title">
|
||||
<h6 class="u-bold u-trim-1">{$func.name}</h6>
|
||||
</svelte:fragment>
|
||||
<p>Last Updated: {toLocaleDateTime($func.$updatedAt)}</p>
|
||||
</Box>
|
||||
</BoxAvatar>
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
|
||||
+19
-7
@@ -7,10 +7,14 @@
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { func } from '../store';
|
||||
|
||||
export let show = false;
|
||||
const functionId = $page.params.function;
|
||||
let error = '';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
const handleSubmit = async () => {
|
||||
try {
|
||||
@@ -33,23 +37,31 @@
|
||||
''
|
||||
);
|
||||
await invalidate(Dependencies.FUNCTION);
|
||||
dispatch('success');
|
||||
addNotification({
|
||||
type: 'success',
|
||||
message: `Repository has been disconnected from your function`
|
||||
});
|
||||
trackEvent(Submit.FunctionDisconnectRepo);
|
||||
show = false;
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.FunctionDisconnectRepo);
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
trackError(e, Submit.FunctionDisconnectRepo);
|
||||
}
|
||||
};
|
||||
|
||||
$: if (!show) {
|
||||
error = '';
|
||||
}
|
||||
</script>
|
||||
|
||||
<Modal bind:show onSubmit={handleSubmit} icon="exclamation" state="warning" headerDivider={false}>
|
||||
<Modal
|
||||
bind:show
|
||||
bind:error
|
||||
onSubmit={handleSubmit}
|
||||
icon="exclamation"
|
||||
state="warning"
|
||||
headerDivider={false}>
|
||||
<svelte:fragment slot="header">Disconnect Git repository</svelte:fragment>
|
||||
<p data-private>
|
||||
Are you sure you want to disconnect {$func.name}? This will affect future deployments to
|
||||
|
||||
+5
-10
@@ -1,20 +1,16 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { CardGrid, Heading } from '$lib/components';
|
||||
import { CardGrid, Heading, SvgIcon } from '$lib/components';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { toLocaleDateTime } from '$lib/helpers/date';
|
||||
import { app } from '$lib/stores/app';
|
||||
import { execute, func } from '../store';
|
||||
</script>
|
||||
|
||||
<CardGrid>
|
||||
<div class="grid-1-2-col-1 u-flex u-cross-center u-gap-16">
|
||||
<div class="avatar is-medium">
|
||||
<img
|
||||
src={`${base}/icons/${$app.themeInUse}/color/${$func.runtime.split('-')[0]}.svg`}
|
||||
alt="technology" />
|
||||
<div class="avatar">
|
||||
<SvgIcon name={$func.runtime.split('-')[0]} type="color" size={80} iconSize="large" />
|
||||
</div>
|
||||
<div>
|
||||
<div class="u-flex-vertical u-gap-4">
|
||||
<Heading tag="h6" size="7">{$func.name}</Heading>
|
||||
|
||||
<p class="text u-capitalize">{$func.runtime}</p>
|
||||
@@ -23,9 +19,8 @@
|
||||
<svelte:fragment slot="aside">
|
||||
<div class="u-flex u-main-space-between">
|
||||
<div>
|
||||
<p>Function ID: {$func.$id}</p>
|
||||
<p>Created at: {toLocaleDateTime($func.$createdAt)}</p>
|
||||
<p>Updated at: {toLocaleDateTime($func.$updatedAt)}</p>
|
||||
<p>Last updated at: {toLocaleDateTime($func.$updatedAt)}</p>
|
||||
</div>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
|
||||
+13
-20
@@ -2,7 +2,7 @@
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { Box, EmptySearch, Modal, PaginationInline } from '$lib/components';
|
||||
import { BoxAvatar, EmptySearch, Modal, PaginationInline } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { InputChoice, InputSearch, InputSelect, InputText, Button } from '$lib/elements/forms';
|
||||
import { timeFromNow, toLocaleDateTime } from '$lib/helpers/date';
|
||||
@@ -12,9 +12,10 @@
|
||||
import { func, repositories } from '../store';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import InputSelectSearch from '$lib/elements/forms/inputSelectSearch.svelte';
|
||||
import { sortBranches } from './updateConfiguration.svelte';
|
||||
import { installations } from '$lib/wizards/functions/store';
|
||||
|
||||
export let show: boolean;
|
||||
export let installationsList: Models.InstallationList;
|
||||
|
||||
const functionId = $page.params.function;
|
||||
|
||||
@@ -28,8 +29,9 @@
|
||||
let selectedBranch: string;
|
||||
let selectedDir: string;
|
||||
let silentMode = false;
|
||||
let error = '';
|
||||
|
||||
let installationsOptions = installationsList.installations.map((installation) => {
|
||||
let installationsOptions = $installations.installations.map((installation) => {
|
||||
return {
|
||||
value: installation.$id,
|
||||
label: installation.organization
|
||||
@@ -71,12 +73,9 @@
|
||||
});
|
||||
trackEvent(Submit.FunctionUpdateConfiguration);
|
||||
show = false;
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.FunctionUpdateConfiguration);
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
trackError(e, Submit.FunctionUpdateConfiguration);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,13 +107,7 @@
|
||||
selectedRepoId
|
||||
);
|
||||
|
||||
branchesList.branches = branchesList.branches.sort((a, b) => {
|
||||
if (a.name === 'main' || a.name === 'master') {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return a.name > b.name ? -1 : 1;
|
||||
});
|
||||
branchesList.branches = sortBranches(branchesList.branches);
|
||||
|
||||
selectedBranch = branchesList?.branches[0].name;
|
||||
}
|
||||
@@ -126,12 +119,12 @@
|
||||
|
||||
$: selectedRepo = (repositoriesList ?? []).find((repo) => repo.id === selectedRepoId) ?? null;
|
||||
$: selectedInstallation =
|
||||
(installationsList?.installations ?? []).find(
|
||||
($installations?.installations ?? []).find(
|
||||
(installation) => installation.$id === selectedInstallationId
|
||||
) ?? null;
|
||||
</script>
|
||||
|
||||
<Modal headerDivider={false} bind:show size="big" onSubmit={handleSubmit}>
|
||||
<Modal headerDivider={false} bind:show size="big" bind:error onSubmit={handleSubmit}>
|
||||
<svelte:fragment slot="header">Git configuration</svelte:fragment>
|
||||
<p class="text">
|
||||
Configure a Git repository that will trigger your function deployments when updated.
|
||||
@@ -238,7 +231,7 @@
|
||||
{#await getBranches()}
|
||||
Fetching branches..
|
||||
{:then}
|
||||
<Box>
|
||||
<BoxAvatar>
|
||||
<svelte:fragment slot="image">
|
||||
<div class="avatar">
|
||||
<span class={getProviderIcon(selectedInstallation.provider)} />
|
||||
@@ -248,7 +241,7 @@
|
||||
<h6 class="u-bold u-trim-1">{selectedRepo.name}</h6>
|
||||
</svelte:fragment>
|
||||
<p>Last updated: {toLocaleDateTime(selectedRepo.pushedAt)}</p>
|
||||
</Box>
|
||||
</BoxAvatar>
|
||||
|
||||
<InputSelectSearch
|
||||
required={true}
|
||||
|
||||
+58
-21
@@ -1,8 +1,29 @@
|
||||
<script context="module" lang="ts">
|
||||
export function sortBranches(branches: Models.Branch[]) {
|
||||
return branches.sort((a, b) => {
|
||||
if (a.name === 'main' || a.name === 'master') {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return a.name > b.name ? 1 : -1;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { AvatarGroup, CardGrid, Collapsible, CollapsibleItem, Heading } from '$lib/components';
|
||||
import {
|
||||
AvatarGroup,
|
||||
Box,
|
||||
CardGrid,
|
||||
Collapsible,
|
||||
CollapsibleItem,
|
||||
EyebrowHeading,
|
||||
Heading,
|
||||
SvgIcon
|
||||
} from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import {
|
||||
Button,
|
||||
@@ -25,8 +46,8 @@
|
||||
import { wizard } from '$lib/stores/wizard';
|
||||
import ConnectExisting from '$lib/wizards/functions/connectExisting.svelte';
|
||||
import InputSelectSearch from '$lib/elements/forms/inputSelectSearch.svelte';
|
||||
import { installations } from '$lib/wizards/functions/store';
|
||||
|
||||
export let installations: Models.InstallationList;
|
||||
const functionId = $page.params.function;
|
||||
|
||||
let entrypoint: string;
|
||||
@@ -133,13 +154,7 @@
|
||||
|
||||
async function getBranches(installation: string, repo: string) {
|
||||
branchesList = await sdk.forProject.vcs.listRepositoryBranches(installation, repo);
|
||||
branchesList.branches = branchesList.branches.sort((a, b) => {
|
||||
if (a.name === 'main' || a.name === 'master') {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return a.name > b.name ? -1 : 1;
|
||||
});
|
||||
branchesList.branches = sortBranches(branchesList.branches);
|
||||
|
||||
selectedBranch = $func?.providerBranch ?? branchesList.branches[0].name;
|
||||
}
|
||||
@@ -167,6 +182,7 @@
|
||||
<FormList>
|
||||
<InputText
|
||||
required
|
||||
hideRequired
|
||||
label="Entrypoint"
|
||||
id="Entrypoint"
|
||||
placeholder="Enter an entrypoint (e.g. 'index.js')"
|
||||
@@ -190,17 +206,29 @@
|
||||
<svelte:fragment slot="title">
|
||||
<span class="u-margin-inline-end-16">Git settings</span>
|
||||
{#if !repository}
|
||||
<Pill>NOT CONNECTED</Pill>
|
||||
<Pill>
|
||||
<EyebrowHeading tag="h6" size="3" style="line-height: unset">
|
||||
NOT CONNECTED
|
||||
</EyebrowHeading>
|
||||
</Pill>
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
{#if repository}
|
||||
<div class="box" style:--box-border-radius="var(--border-radius-small)">
|
||||
<Box radius="small">
|
||||
<div class="u-flex u-gap-16">
|
||||
<div class="avatar is-size-x-small">
|
||||
<span class={getProviderIcon(repository.provider)} />
|
||||
</div>
|
||||
<div class="u-cross-child-center u-line-height-1-5">
|
||||
<h6 class="u-bold u-trim-1">{repository.name}</h6>
|
||||
<h6 class="u-bold u-trim-1">
|
||||
{repository.name}
|
||||
{#if repository.private}
|
||||
<span
|
||||
class="icon-lock-closed"
|
||||
style="font-size: var(--icon-size-small)"
|
||||
aria-hidden="true" />
|
||||
{/if}
|
||||
</h6>
|
||||
<p>Last updated: {toLocaleDateTime(repository.pushedAt)}</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -211,6 +239,7 @@
|
||||
id="branch"
|
||||
label="Branch"
|
||||
placeholder="main"
|
||||
interactiveOutput
|
||||
bind:value={selectedBranch}
|
||||
bind:search={selectedBranch}
|
||||
on:select={(event) => {
|
||||
@@ -235,26 +264,33 @@
|
||||
bind:value={silentMode} />
|
||||
</FormList>
|
||||
</div>
|
||||
<div class="u-margin-block-start-24 u-flex u-gap-16 u-main-end">
|
||||
<Button text on:click={() => (showDisconnect = true)}
|
||||
>Disconnect repository</Button>
|
||||
<div
|
||||
class="u-margin-block-start-24 u-flex u-gap-16 u-main-end u-flex-wrap">
|
||||
<Button text on:click={() => (showDisconnect = true)}>
|
||||
Disconnect repository
|
||||
</Button>
|
||||
<Button secondary href={getRepositoryLink(repository)} external>
|
||||
View on {ProviderNames[repository.provider] ??
|
||||
'unknown provider'}
|
||||
<span class="icon-external-link" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Box>
|
||||
{:else}
|
||||
<article class="card-git card is-border-dashed is-no-shadow">
|
||||
<div class="u-flex u-cross-center u-flex-vertical u-gap-32">
|
||||
<div class="u-flex u-cross-center u-gap-8">
|
||||
<AvatarGroup
|
||||
bordered
|
||||
icons={['github', 'gitlab', 'bitBucket', 'azure']} />
|
||||
|
||||
<span class="icon-arrow-narrow-right" />
|
||||
|
||||
<div class="avatar"><span class="icon-appwrite" /></div>
|
||||
<div class="avatar">
|
||||
<SvgIcon
|
||||
name={$func.runtime.split('-')[0]}
|
||||
type="grayscale"
|
||||
size={80} />
|
||||
</div>
|
||||
</div>
|
||||
<Button
|
||||
secondary
|
||||
@@ -273,6 +309,7 @@
|
||||
label="Commands"
|
||||
placeholder="Enter an install commad (e.g. 'npm install')"
|
||||
id="install"
|
||||
tooltip="Enter a single command or chain multiple commands with the && operator"
|
||||
bind:value={commands} />
|
||||
</FormList>
|
||||
</CollapsibleItem>
|
||||
@@ -285,10 +322,10 @@
|
||||
</CardGrid>
|
||||
</Form>
|
||||
|
||||
{#if !installations?.total && showGit}
|
||||
{#if !$installations?.total && showGit}
|
||||
<GitInstallationModal bind:showGitInstall={showGit} />
|
||||
{:else}
|
||||
<GitConfigurationModal bind:show={showGit} installationsList={installations} />
|
||||
<GitConfigurationModal bind:show={showGit} />
|
||||
{/if}
|
||||
|
||||
<DisconnectRepo bind:show={showDisconnect} />
|
||||
<DisconnectRepo bind:show={showDisconnect} on:success={loadRepository} />
|
||||
+5
-4
@@ -4,7 +4,7 @@
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { CardGrid, Heading } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button, Form } from '$lib/elements/forms';
|
||||
import { Button, Form, FormList } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { onMount } from 'svelte';
|
||||
@@ -67,15 +67,16 @@
|
||||
<Heading tag="h6" size="7">Runtime</Heading>
|
||||
|
||||
<svelte:fragment slot="aside">
|
||||
<ul>
|
||||
<FormList>
|
||||
<InputSelect
|
||||
label="Runtime"
|
||||
id="runtime"
|
||||
placeholder="Select runtime"
|
||||
bind:value={runtime}
|
||||
{options}
|
||||
required />
|
||||
</ul>
|
||||
required
|
||||
hideRequired />
|
||||
</FormList>
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
|
||||
@@ -3,6 +3,10 @@ import { derived, writable, type Writable } from 'svelte/store';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
|
||||
export const func = derived(page, ($page) => $page.data.function as Models.Function);
|
||||
export const proxyRuleList = derived(
|
||||
page,
|
||||
($page) => $page.data.proxyRuleList as Models.ProxyRuleList
|
||||
);
|
||||
export const execute: Writable<Models.Function> = writable();
|
||||
export const repositories: Writable<{
|
||||
search: string;
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
{
|
||||
href: `${path}/templates`,
|
||||
title: 'Templates',
|
||||
event: 'templates'
|
||||
event: 'templates',
|
||||
experimental: true
|
||||
}
|
||||
];
|
||||
</script>
|
||||
@@ -34,6 +35,13 @@
|
||||
event={tab.event}>
|
||||
{tab.title}
|
||||
</Tab>
|
||||
{#if tab.experimental}
|
||||
<div class="u-flex u-cross-center">
|
||||
<div class="tag eyebrow-heading-3">
|
||||
<span class="text u-x-small">Experimental</span>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
</Tabs>
|
||||
</Cover>
|
||||
@@ -3,6 +3,7 @@
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Collapsible, CollapsibleItem, Pagination } from '$lib/components';
|
||||
import { debounce } from '$lib/helpers/debounce';
|
||||
import { Container } from '$lib/layout';
|
||||
import { app } from '$lib/stores/app';
|
||||
import { connectTemplate } from '$lib/wizards/functions/cover.svelte';
|
||||
@@ -25,19 +26,6 @@
|
||||
goto(target.toString());
|
||||
}
|
||||
|
||||
function applySearch(event: Event) {
|
||||
const value = (event.target as EventTarget & HTMLInputElement).value;
|
||||
const target = new URL($page.url);
|
||||
|
||||
if (value.length > 0) {
|
||||
target.searchParams.set('search', value);
|
||||
} else {
|
||||
target.searchParams.delete('search');
|
||||
}
|
||||
target.searchParams.delete('page');
|
||||
goto(target.toString(), { keepFocus: true });
|
||||
}
|
||||
|
||||
function clearSearch() {
|
||||
const target = new URL($page.url);
|
||||
target.searchParams.delete('page');
|
||||
@@ -62,6 +50,19 @@
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
const applySearch = debounce((event: Event) => {
|
||||
const value = (event.target as EventTarget & HTMLInputElement).value;
|
||||
const target = new URL($page.url);
|
||||
|
||||
if (value.length > 0) {
|
||||
target.searchParams.set('search', value);
|
||||
} else {
|
||||
target.searchParams.delete('search');
|
||||
}
|
||||
target.searchParams.delete('page');
|
||||
goto(target.toString(), { keepFocus: true });
|
||||
}, 250);
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
@@ -85,50 +86,63 @@
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
<Collapsible>
|
||||
<CollapsibleItem>
|
||||
<svelte:fragment slot="title">Use case</svelte:fragment>
|
||||
{#each [...data.useCases] as useCase}
|
||||
<div class="input-text-wrapper">
|
||||
<input
|
||||
id={`useCase-${useCase}`}
|
||||
type="checkbox"
|
||||
value={$page.url.searchParams.getAll('useCase').includes(useCase)}
|
||||
on:change={(e) => applyFilter('useCase', useCase, e)} />
|
||||
<label for={`useCase-${useCase}`}>{useCase}</label>
|
||||
</div>
|
||||
{/each}
|
||||
</CollapsibleItem>
|
||||
<CollapsibleItem>
|
||||
<svelte:fragment slot="title">Runtime</svelte:fragment>
|
||||
{#each [...data.runtimes] as runtime}
|
||||
{@const icon = getIconFromRuntime(runtime)}
|
||||
<div class="u-flex">
|
||||
<input
|
||||
id={`runtime-${runtime}`}
|
||||
type="checkbox"
|
||||
checked={$page.url.searchParams.getAll('runtime').includes(runtime)}
|
||||
on:change={(e) => applyFilter('runtime', runtime, e)} />
|
||||
<div class="avatar is-size-x-small">
|
||||
<img
|
||||
style:--p-text-size="16px"
|
||||
src={`${base}/icons/${$app.themeInUse}/color/${icon}.svg`}
|
||||
alt={icon}
|
||||
aria-hidden="true"
|
||||
aria-label={icon} />
|
||||
</div>
|
||||
<label for={`runtime-${runtime}`}>{runtime}</label>
|
||||
</div>
|
||||
{/each}
|
||||
</CollapsibleItem>
|
||||
</Collapsible>
|
||||
<div class="u-margin-block-start-24">
|
||||
<Collapsible>
|
||||
<CollapsibleItem>
|
||||
<svelte:fragment slot="title">Use case</svelte:fragment>
|
||||
<ul class="form-list u-row-gap-16">
|
||||
{#each [...data.useCases] as useCase}
|
||||
<li class="form-item">
|
||||
<label class="u-flex u-cross-center u-gap-16">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="is-small"
|
||||
value={$page.url.searchParams
|
||||
.getAll('useCase')
|
||||
.includes(useCase)}
|
||||
on:change={(e) => applyFilter('useCase', useCase, e)} />
|
||||
<div class="u-trim-1">{useCase}</div>
|
||||
</label>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
</CollapsibleItem>
|
||||
<CollapsibleItem>
|
||||
<svelte:fragment slot="title">Runtime</svelte:fragment>
|
||||
<ul class="form-list u-row-gap-16">
|
||||
{#each [...data.runtimes] as runtime}
|
||||
{@const icon = getIconFromRuntime(runtime)}
|
||||
<li class="form-item">
|
||||
<label class="u-flex u-cross-center u-gap-16">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="is-small"
|
||||
checked={$page.url.searchParams
|
||||
.getAll('runtime')
|
||||
.includes(runtime)}
|
||||
on:change={(e) => applyFilter('runtime', runtime, e)} />
|
||||
<div class="u-flex u-cross-center u-gap-8">
|
||||
<div class="avatar is-size-x-small">
|
||||
<img
|
||||
src={`${base}/icons/${$app.themeInUse}/color/${icon}.svg`}
|
||||
alt={icon} />
|
||||
</div>
|
||||
<div class="u-trim-1">{runtime}</div>
|
||||
</div>
|
||||
</label>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
</CollapsibleItem>
|
||||
</Collapsible>
|
||||
</div>
|
||||
|
||||
<section class="card u-margin-block-start-24">
|
||||
<h4 class="body-text-1 u-bold">Contribute</h4>
|
||||
<p class="u-margin-block-start-16">
|
||||
Have an idea for a function template? View our <a
|
||||
class="link"
|
||||
href=""
|
||||
href="https://github.com/appwrite/templates/blob/main/CONTRIBUTING.md"
|
||||
target="_blank">contribution guidelines</a
|
||||
>.
|
||||
</p>
|
||||
@@ -141,7 +155,7 @@
|
||||
{#each data.templates as template}
|
||||
<li>
|
||||
<article class="card">
|
||||
<div class="u-flex u-gap-16">
|
||||
<div class="u-flex u-gap-16 u-cross-center">
|
||||
<h2 class="body-text-1 u-bold u-trim">
|
||||
{template.name}
|
||||
</h2>
|
||||
|
||||
+29
-18
@@ -10,23 +10,34 @@
|
||||
<Container>
|
||||
<div class="grid-300px-1fr">
|
||||
<section>
|
||||
<h3 class="body-text-1 u-bold">Use cases</h3>
|
||||
<div class="u-margin-block-start-8 u-flex u-flex-wrap u-gap-8">
|
||||
{#each $template.usecases as useCase}
|
||||
<Pill>{useCase}</Pill>
|
||||
{/each}
|
||||
</div>
|
||||
<h3 class="body-text-1 u-bold u-margin-block-start-8">Runtimes</h3>
|
||||
<div class="u-margin-block-start-8 u-flex u-flex-wrap u-gap-8">
|
||||
{#each $template.runtimes as runtime}
|
||||
<Pill>{runtime.name}</Pill>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<section class="card u-margin-block-start-24">
|
||||
<h4 class="body-text-1 u-bold">Published by</h4>
|
||||
{$template.providerOwner}
|
||||
</section>
|
||||
<ul class="collapsible">
|
||||
<li class="collapsible-item">
|
||||
<h3 class="body-text-2 u-bold u-padding-block-12">
|
||||
Use cases <span class="inline-tag">{$template.usecases.length}</span>
|
||||
</h3>
|
||||
<div class="collapsible-content u-flex u-flex-wrap u-gap-8">
|
||||
{#each $template.usecases as useCase}
|
||||
<Pill>{useCase}</Pill>
|
||||
{/each}
|
||||
</div>
|
||||
</li>
|
||||
<li class="collapsible-item">
|
||||
<h3 class="body-text-2 u-bold u-padding-block-12">
|
||||
Runtimes <span class="inline-tag">{$template.runtimes.length}</span>
|
||||
</h3>
|
||||
<div class="collapsible-content u-flex u-flex-wrap u-gap-8">
|
||||
{#each $template.runtimes as runtime}
|
||||
<Pill>{runtime.name}</Pill>
|
||||
{/each}
|
||||
</div>
|
||||
</li>
|
||||
<li class="collapsible-item">
|
||||
<section class="card u-margin-block-start-24">
|
||||
<h4 class="body-text-1 u-bold">Published by</h4>
|
||||
{$template.providerOwner}
|
||||
</section>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section>
|
||||
<Card>
|
||||
@@ -55,7 +66,7 @@
|
||||
</Button>
|
||||
</div>
|
||||
</Card>
|
||||
<Card>{$template.instructions}</Card>
|
||||
<Card>{@html $template.instructions}</Card>
|
||||
</section>
|
||||
</div>
|
||||
</Container>
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Alert, Code } from '$lib/components';
|
||||
import { WizardStep } from '$lib/layout';
|
||||
import { Mode, MODE } from '$lib/system';
|
||||
import { isSelfHosted } from '$lib/system';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import Id from '$lib/components/id.svelte';
|
||||
|
||||
@@ -30,7 +30,7 @@ let client = Client()
|
||||
Before sending any API calls to your new Appwrite project, make sure your device or emulator
|
||||
has network access to your Appwrite project's hostname or IP address.
|
||||
</p>
|
||||
{#if showAlert && MODE === Mode.SELF_HOSTED}
|
||||
{#if showAlert && isSelfHosted}
|
||||
<div class="common-section">
|
||||
<Alert type="info" dismissible on:dismiss={() => (showAlert = false)}>
|
||||
<svelte:fragment slot="title">For self-hosted solutions</svelte:fragment>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Alert, Code } from '$lib/components';
|
||||
import { WizardStep } from '$lib/layout';
|
||||
import { Mode, MODE } from '$lib/system';
|
||||
import { isSelfHosted } from '$lib/system';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import Id from '$lib/components/id.svelte';
|
||||
|
||||
@@ -30,12 +30,9 @@ client
|
||||
Before sending any API calls to your new Appwrite project, make sure your device or emulator
|
||||
has network access to your Appwrite project's hostname or IP address.
|
||||
</p>
|
||||
{#if showAlert}
|
||||
{#if showAlert && isSelfHosted}
|
||||
<div class="common-section">
|
||||
<Alert
|
||||
type="info"
|
||||
dismissible={MODE === Mode.CLOUD}
|
||||
on:dismiss={() => (showAlert = false)}>
|
||||
<Alert type="info" on:dismiss={() => (showAlert = false)}>
|
||||
<svelte:fragment slot="title">For self-hosted solutions</svelte:fragment>
|
||||
When connecting to a locally hosted Appwrite project from an emulator or a mobile device,
|
||||
you should use the private IP of the device running your Appwrite project as the hostname
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Box, CardGrid, Heading, Modal } from '$lib/components';
|
||||
import { BoxAvatar, CardGrid, Heading, Modal } from '$lib/components';
|
||||
import { Button, FormList, InputText } from '$lib/elements/forms';
|
||||
import { toLocaleDateTime } from '$lib/helpers/date';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
@@ -41,12 +41,12 @@
|
||||
within it. This action is irreversible.
|
||||
</p>
|
||||
<svelte:fragment slot="aside">
|
||||
<Box>
|
||||
<BoxAvatar>
|
||||
<svelte:fragment slot="title">
|
||||
<h6 class="u-bold u-trim-1">{$project.name}</h6>
|
||||
</svelte:fragment>
|
||||
<p>Last update: {toLocaleDateTime($project.$updatedAt)}</p>
|
||||
</Box>
|
||||
</BoxAvatar>
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
|
||||
@@ -148,17 +148,11 @@
|
||||
required
|
||||
placeholder="Enter host"
|
||||
bind:value={$provider.host} />
|
||||
<InputNumber
|
||||
id="port"
|
||||
label="Port"
|
||||
required
|
||||
placeholder="Enter port"
|
||||
bind:value={$provider.port} />
|
||||
<InputNumber id="port" label="Port" placeholder="5432" bind:value={$provider.port} />
|
||||
<InputText
|
||||
id="username"
|
||||
label="Username"
|
||||
required
|
||||
placeholder="Enter username"
|
||||
placeholder="postgres"
|
||||
bind:value={$provider.username} />
|
||||
<InputPassword
|
||||
id="password"
|
||||
@@ -200,14 +194,12 @@
|
||||
<InputText
|
||||
id="database"
|
||||
label="Database"
|
||||
required
|
||||
placeholder="Enter database"
|
||||
placeholder={$provider.subdomain || 'Enter database'}
|
||||
bind:value={$provider.database} />
|
||||
<InputText
|
||||
id="username"
|
||||
label="Username"
|
||||
required
|
||||
placeholder="Enter username"
|
||||
placeholder="postgres"
|
||||
bind:value={$provider.username} />
|
||||
<InputPassword
|
||||
id="password"
|
||||
|
||||
@@ -40,9 +40,9 @@
|
||||
$provider.endpoint,
|
||||
$provider.apiKey,
|
||||
$provider.host,
|
||||
$provider.username,
|
||||
$provider.username || 'postgres',
|
||||
$provider.password,
|
||||
$provider.port
|
||||
$provider.port || 5432
|
||||
);
|
||||
|
||||
invalidate(Dependencies.MIGRATIONS);
|
||||
@@ -71,8 +71,8 @@
|
||||
$provider.subdomain,
|
||||
$provider.region,
|
||||
$provider.adminSecret,
|
||||
$provider.database,
|
||||
$provider.username,
|
||||
$provider.database || $provider.subdomain,
|
||||
$provider.username || 'postgres',
|
||||
$provider.password
|
||||
);
|
||||
|
||||
|
||||
@@ -110,7 +110,6 @@
|
||||
id="endpoint"
|
||||
placeholder="https://[YOUR_APPWRITE_HOSTNAME]"
|
||||
autofocus
|
||||
value="http://localhost:3000/"
|
||||
on:input={(e) => {
|
||||
if (!submitted) return;
|
||||
const input = e.target;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Box, CardGrid, Heading } from '$lib/components';
|
||||
import { BoxAvatar, CardGrid, Heading } from '$lib/components';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { webhook } from './store';
|
||||
import Delete from './delete.svelte';
|
||||
@@ -14,12 +14,12 @@
|
||||
</div>
|
||||
<p>The webhook will be permanently deleted. This action is irreversible.</p>
|
||||
<svelte:fragment slot="aside">
|
||||
<Box>
|
||||
<BoxAvatar>
|
||||
<svelte:fragment slot="title">
|
||||
<h6 class="u-bold u-trim-1">{$webhook.name}</h6>
|
||||
</svelte:fragment>
|
||||
<p>Last updated: {toLocaleDateTime($webhook.$updatedAt)}</p>
|
||||
</Box>
|
||||
</BoxAvatar>
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { CardGrid, Box, Heading, Alert, Id } from '$lib/components';
|
||||
import { CardGrid, BoxAvatar, Heading, Alert, Id } from '$lib/components';
|
||||
import { Container } from '$lib/layout';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { file } from './store';
|
||||
@@ -157,14 +157,14 @@
|
||||
<Heading tag="h6" size="7">Delete File</Heading>
|
||||
<p>The file will be permanently deleted. This action is irreversible.</p>
|
||||
<svelte:fragment slot="aside">
|
||||
<Box>
|
||||
<BoxAvatar>
|
||||
<svelte:fragment slot="title">
|
||||
<h6 class="u-bold u-trim-1" data-private>{$file.name}</h6>
|
||||
</svelte:fragment>
|
||||
<p>
|
||||
Last Updated: {toLocaleDateTime($file.$updatedAt)}
|
||||
</p>
|
||||
</Box>
|
||||
</BoxAvatar>
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Box, CardGrid, Heading } from '$lib/components';
|
||||
import { BoxAvatar, CardGrid, Heading } from '$lib/components';
|
||||
import { Permissions } from '$lib/components/permissions';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Pill } from '$lib/elements';
|
||||
@@ -451,12 +451,12 @@
|
||||
action is irreversible.
|
||||
</p>
|
||||
<svelte:fragment slot="aside">
|
||||
<Box>
|
||||
<BoxAvatar>
|
||||
<svelte:fragment slot="title">
|
||||
<h6 class="u-bold u-trim-1">{$bucket.name}</h6>
|
||||
</svelte:fragment>
|
||||
<p class="text">Last Updated: {toLocaleDateTime($bucket.$updatedAt)}</p>
|
||||
</Box>
|
||||
</BoxAvatar>
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 451 KiB After Width: | Height: | Size: 415 KiB |
Reference in new issue
Block a user