Merge branch 'main' of https://github.com/appwrite/appwrite-console-poc into feat-datetime-attribute

This commit is contained in:
Torsten Dittmann committed 2022-11-03 18:04:28 +01:00
commit 1ea41f7572
30 files changed
+455 -226

No files matched your search

+1 -1
View File
@@ -12,7 +12,7 @@
style={`--grid-gap:1.5rem; --grid-item-size:${total > 3 ? '22rem' : '25rem'};`}>
<slot />
{#if limit + offset > total && (total % 2 !== 0 || total % 4 === 0)}
{#if total > 3 ? total < limit + offset : total % 2 !== 0}
<Empty isButton on:click>
<slot name="empty" />
</Empty>
+16 -14
View File
@@ -22,21 +22,23 @@
};
</script>
<div class="input-text-wrapper is-with-end-button">
<div>
<label class:u-hide={!showLabel} class="label" for={label}>{label}</label>
<div class="input-text-wrapper">
<div class="input-text-wrapper" style="--amount-of-buttons:1">
<input {value} id={label} type="text" class="input-text" readonly />
<button
type="button"
class="input-button"
aria-label="Click to copy."
on:click={copy}
on:mouseenter={() => setTimeout(() => (content = 'Click to copy'))}
use:tooltip={{
content,
hideOnClick: false
}}>
<span class="icon-duplicate" aria-hidden="true" />
</button>
<div class="options-list">
<button
type="button"
class="input-button"
aria-label="Click to copy."
on:click={copy}
on:mouseenter={() => setTimeout(() => (content = 'Click to copy'))}
use:tooltip={{
content,
hideOnClick: false
}}>
<span class="icon-duplicate" aria-hidden="true" />
</button>
</div>
</div>
</div>
+3 -1
View File
@@ -3,6 +3,8 @@
import Light from '$lib/images/search-light.svg';
import Dark from '$lib/images/search-dark.svg';
import PaginationInline from './paginationInline.svelte';
export let hidePages = false;
</script>
<article class="card u-grid u-cross-center u-width-full-line common-section">
@@ -18,5 +20,5 @@
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: 0</p>
<PaginationInline limit={1} offset={0} sum={0} />
<PaginationInline limit={1} offset={0} sum={0} {hidePages} />
</div>
+27 -21
View File
@@ -1,27 +1,33 @@
<script>
import { FormItem } from '$lib/elements/forms';
export let show = false;
</script>
{#if show}
<section class="modal is-inner-modal">
<header class="modal-header u-flex-wrap">
<h4 class="modal-title body-text-1">
<slot name="title" />
</h4>
<button
type="button"
class="x-button"
aria-label="Close"
title="Close"
on:click={() => (show = false)}>
<span class="icon-x" aria-hidden="true" />
</button>
<p class="u-flex-basis-100-percent">
<slot name="subtitle" />
</p>
</header>
<div class="modal-content">
<slot name="content" />
</div>
</section>
<FormItem>
<section class="modal is-inner-modal">
<div class="modal-form">
<header class="modal-header u-flex-wrap">
<h4 class="modal-title body-text-1">
<slot name="title" />
</h4>
<button
type="button"
class="x-button"
aria-label="Close"
title="Close"
on:click={() => (show = false)}>
<span class="icon-x" aria-hidden="true" />
</button>
<p class="u-flex-basis-100-percent">
<slot name="subtitle" />
</p>
</header>
<div class="modal-content">
<slot name="content" />
</div>
</div>
</section>
</FormItem>
{/if}
@@ -1,6 +1,5 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte';
import { Button } from '$lib/elements/forms';
import { DropList, DropListItem } from '..';
import Custom from './custom.svelte';
import Team from './team.svelte';
@@ -22,10 +21,7 @@
</script>
<DropList bind:show={showDropdown} placement="bottom-end">
<Button text noMargin on:click={() => (showDropdown = !showDropdown)}>
<span class="icon-plus" aria-hidden="true" />
<span class="text">Add role</span>
</Button>
<slot />
<svelte:fragment slot="list">
<DropListItem disabled={$groups.has('any')} on:click={() => dispatch('create', ['any'])}>
Any
+1
View File
@@ -1,3 +1,4 @@
export { default as Permissions } from './permissions.svelte';
export { default as Roles } from './roles.svelte';
export { default as Team } from './team.svelte';
export { default as User } from './user.svelte';
@@ -10,26 +10,23 @@
</script>
<script lang="ts">
import { Button } from '$lib/elements/forms';
import {
Table,
TableBody,
TableCell,
TableCellHead,
TableCellText,
TableHeader,
TableRow
} from '$lib/elements/table';
import { difference } from '$lib/helpers/array';
import { onDestroy, onMount } from 'svelte';
import { writable, type Unsubscriber } from 'svelte/store';
import { Empty } from '../';
import Actions from './actions.svelte';
import Row from './row.svelte';
export let withCreate = false;
export let withCrud = true;
export let permissions: string[] = [];
export let executeAccess: string[] = [];
let showUser = false;
let showTeam = false;
@@ -145,76 +142,61 @@
return a.localeCompare(b);
}
$: if (executeAccess.length && !permissions.length) {
executeAccess.forEach((permission) => {
addRole(permission);
});
}
$: if ([...$groups]?.length && !permissions.length) {
executeAccess = [...$groups].sort(sortRoles).map(([role]) => role);
}
//TODO: click on Empty components opens the dropdown
</script>
{#if [...$groups]?.length}
<Table noMargin noStyles noMobile>
<TableHeader>
<TableCellHead>Role</TableCellHead>
{#if withCrud}
{#if withCreate}
<TableCellHead width={70}>Create</TableCellHead>
{/if}
<TableCellHead width={70}>Read</TableCellHead>
<TableCellHead width={70}>Update</TableCellHead>
<TableCellHead width={70}>Delete</TableCellHead>
{#if withCreate}
<TableCellHead width={70}>Create</TableCellHead>
{/if}
<TableCellHead width={70}>Read</TableCellHead>
<TableCellHead width={70}>Update</TableCellHead>
<TableCellHead width={70}>Delete</TableCellHead>
<TableCellHead width={40} />
</TableHeader>
<TableBody>
{#each [...$groups].sort(sortRoles) as [role, permission]}
<TableRow>
<TableCellText title="Role">
<TableCell title="Role">
<Row {role} />
</TableCellText>
</TableCell>
{#if withCrud}
{#if withCreate}
<TableCell title="Create">
<input
type="checkbox"
class="icon-check"
aria-label="Create"
checked={permission.create}
on:change={() => togglePermission(role, 'create')} />
</TableCell>
{/if}
<TableCell title="Read">
{#if withCreate}
<TableCell title="Create">
<input
type="checkbox"
class="icon-check"
aria-label="Read"
checked={permission.read}
on:change={() => togglePermission(role, 'read')} />
</TableCell>
<TableCell title="Update">
<input
type="checkbox"
class="icon-check"
aria-label="Update"
checked={permission.update}
on:change={() => togglePermission(role, 'update')} />
</TableCell>
<TableCell title="Delete">
<input
type="checkbox"
class="icon-check"
aria-label="Delete"
checked={permission.delete}
on:change={() => togglePermission(role, 'delete')} />
aria-label="Create"
checked={permission.create}
on:change={() => togglePermission(role, 'create')} />
</TableCell>
{/if}
<TableCell title="Read">
<input
type="checkbox"
class="icon-check"
aria-label="Read"
checked={permission.read}
on:change={() => togglePermission(role, 'read')} />
</TableCell>
<TableCell title="Update">
<input
type="checkbox"
class="icon-check"
aria-label="Update"
checked={permission.update}
on:change={() => togglePermission(role, 'update')} />
</TableCell>
<TableCell title="Delete">
<input
type="checkbox"
class="icon-check"
aria-label="Delete"
checked={permission.delete}
on:change={() => togglePermission(role, 'delete')} />
</TableCell>
<TableCell title="Remove" width={40}>
<div class="u-flex">
@@ -231,18 +213,38 @@
{/each}
</TableBody>
</Table>
<Actions
bind:showCustom
bind:showDropdown
bind:showTeam
bind:showUser
{groups}
on:create={create}>
<Button text noMargin on:click={() => (showDropdown = !showDropdown)}>
<span class="icon-plus" aria-hidden="true" />
<span class="text">Add role</span>
</Button>
</Actions>
{:else}
<span class="eyebrow-heading-3 u-sep-block-end">ROLE</span>
<Empty isButton on:click={() => (showDropdown = !showDropdown)}>
Add a role to get started
</Empty>
<article class="card u-grid u-cross-center u-width-full-line dashed">
<div class="u-flex u-cross-center u-flex-vertical u-main-center u-flex">
<div class="common-section">
<Actions
bind:showCustom
bind:showDropdown
bind:showTeam
bind:showUser
{groups}
on:create={create}>
<Button secondary round on:click={() => (showDropdown = !showDropdown)}>
<i class="icon-plus" />
</Button>
</Actions>
</div>
<div class="common-section">
<span class="text"> Add a role to get started </span>
</div>
</div>
</article>
{/if}
<Actions
bind:showCustom
bind:showDropdown
bind:showTeam
bind:showUser
{groups}
on:create={create} />
+81 -34
View File
@@ -1,7 +1,9 @@
<script lang="ts">
import { Button } from '$lib/elements/forms';
import {
Table,
TableBody,
TableCell,
TableCellHead,
TableCellText,
TableHeader,
@@ -69,39 +71,84 @@
return n;
});
}
function sortRoles(a: string, b: string) {
if ((a === 'any') !== (b === 'any')) {
return a === 'any' ? -1 : 1;
}
if ((a === 'users') !== (b === 'users')) {
return a === 'users' ? -1 : 1;
}
if ((a === 'guests') !== (b === 'guests')) {
return a === 'guests' ? -1 : 1;
}
return a.localeCompare(b);
}
$: if (roles) {
roles.forEach(addRole);
}
</script>
<Table noMargin noStyles noMobile>
<TableHeader>
<TableCellHead>Role</TableCellHead>
<TableCellHead width={40} />
</TableHeader>
<TableBody>
{#each [...$groups.keys()] as role}
<TableRow>
<TableCellText title="Role">
<Row {role} />
</TableCellText>
<TableCellText title="Remove">
<div class="u-flex">
<button
class="button is-text is-only-icon"
type="button"
aria-label="delete"
on:click={() => deleteRole(role)}>
<span class="icon-x" aria-hidden="true" />
</button>
</div>
</TableCellText>
</TableRow>
{/each}
</TableBody>
</Table>
<Actions
bind:showCustom
bind:showDropdown
bind:showTeam
bind:showUser
{groups}
on:create={create} />
{#if [...$groups.keys()]?.length}
<Table noMargin noStyles noMobile>
<TableHeader>
<TableCellHead>Role</TableCellHead>
<TableCellHead width={40} />
</TableHeader>
<TableBody>
{#each [...$groups.keys()].sort(sortRoles) as role}
<TableRow>
<TableCell title="Role">
<Row {role} />
</TableCell>
<TableCellText title="Remove">
<div class="u-flex">
<button
class="button is-text is-only-icon"
type="button"
aria-label="delete"
on:click={() => deleteRole(role)}>
<span class="icon-x" aria-hidden="true" />
</button>
</div>
</TableCellText>
</TableRow>
{/each}
</TableBody>
</Table>
<Actions
bind:showCustom
bind:showDropdown
bind:showTeam
bind:showUser
{groups}
on:create={create}>
<Button text noMargin on:click={() => (showDropdown = !showDropdown)}>
<span class="icon-plus" aria-hidden="true" />
<span class="text">Add role</span>
</Button>
</Actions>
{:else}
<article class="card u-grid u-cross-center u-width-full-line dashed">
<div class="u-flex u-cross-center u-flex-vertical u-main-center u-flex">
<div class="common-section">
<Actions
bind:showCustom
bind:showDropdown
bind:showTeam
bind:showUser
{groups}
on:create={create}>
<Button secondary round on:click={() => (showDropdown = !showDropdown)}>
<i class="icon-plus" />
</Button>
</Actions>
</div>
<div class="common-section">
<span class="text"> Add a role to get started </span>
</div>
</div>
</article>
{/if}
+39 -7
View File
@@ -3,7 +3,7 @@
import { createEventDispatcher } from 'svelte';
import { sdkForProject } from '$lib/stores/sdk';
import { Query, type Models } from '@aw-labs/appwrite-console';
import { AvatarInitials, Modal, PaginationInline } from '..';
import { AvatarInitials, EmptySearch, Modal, PaginationInline } from '..';
import type { Writable } from 'svelte/store';
import type { Permission } from './permissions.svelte';
@@ -60,8 +60,8 @@
<Modal bind:show on:submit={create} on:close={reset} size="big">
<svelte:fragment slot="header">Select teams</svelte:fragment>
<InputSearch bind:value={search} />
{#if results?.teams}
<InputSearch autofocus disabled={!results?.teams?.length && !search} bind:value={search} />
{#if results?.teams?.length}
<div class="table-wrapper">
<table class="table is-table-layout-auto is-remove-outer-styles">
<tbody class="table-tbody">
@@ -93,11 +93,43 @@
</tbody>
</table>
</div>
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: {results?.total}</p>
<PaginationInline limit={5} bind:offset sum={results?.total} hidePages />
</div>
{:else if search}
<EmptySearch hidePages>
<div class="common-section">
<div class="u-text-center common-section">
<b class="body-text-2">Sorry we couldn't find "{search}"</b>
<p>There are no Teams that match your search.</p>
</div>
<div class="u-flex u-gap-16 common-section u-main-center">
<Button external href="#/" text>Documentation</Button>
<Button secondary on:click={() => (search = '')}>Clear search</Button>
</div>
</div>
</EmptySearch>
{:else}
<EmptySearch hidePages>
<div class="common-section">
<div class="u-text-center common-section">
<b class="body-text-2">Sorry we couldn't find "{search}"</b>
<p>You have no Teams. Create a user to see them here.</p>
<p>
Need a hand? Check out our <a
href="#/"
target="_blank"
rel="noopener noreferrer">
documentation</a
>.
</p>
</div>
</div>
</EmptySearch>
{/if}
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: {results?.total}</p>
<PaginationInline limit={5} bind:offset sum={results?.total} hidePages />
</div>
<svelte:fragment slot="footer">
<Button submit disabled={!hasSelection}>Create</Button>
</svelte:fragment>
+70 -12
View File
@@ -1,7 +1,7 @@
<script lang="ts">
import { Button, InputSearch } from '$lib/elements/forms';
import { createEventDispatcher } from 'svelte';
import { AvatarInitials, Modal, PaginationInline } from '..';
import { AvatarInitials, EmptySearch, Modal, PaginationInline } from '..';
import { sdkForProject } from '$lib/stores/sdk';
import { Query, type Models } from '@aw-labs/appwrite-console';
import type { Writable } from 'svelte/store';
@@ -60,8 +60,8 @@
<Modal bind:show on:submit={create} on:close={reset} size="big">
<svelte:fragment slot="header">Select users</svelte:fragment>
<InputSearch bind:value={search} />
{#if results?.users}
<InputSearch autofocus disabled={!results?.users?.length && !search} bind:value={search} />
{#if results?.users?.length}
<div class="table-wrapper">
<table class="table is-table-layout-auto is-remove-outer-styles">
<tbody class="table-tbody">
@@ -81,11 +81,37 @@
</td>
<td class="table-col" data-title="User">
<label class="u-flex u-cross-center u-gap-8" for={user.$id}>
<AvatarInitials size={32} name={user.name} />
<div class="u-line-height-1-5">
<div class="body-text-2">{user.name}</div>
<div class="u-x-small">{user.$id}</div>
</div>
{#if user.email || user.phone}
{#if user.name}
<AvatarInitials size={32} name={user.name} />
<div class="u-line-height-1-5">
<div class="body-text-2">
{user.name}
</div>
<div class="u-x-small">{user.$id}</div>
</div>
{:else}
<div class="avatar is-size-small ">
<span class="icon-minus-sm" aria-hidden="true" />
</div>
<div class="u-line-height-1-5">
<div class="body-text-2">
{user.email ? user.email : user.phone}
</div>
<div class="u-x-small">{user.$id}</div>
</div>
{/if}
{:else}
<div class="avatar is-size-small ">
<span class="icon-anonymous" aria-hidden="true" />
</div>
<div class="u-line-height-1-5">
<div class="body-text-2">
{user.name ? user.name : '-'}
</div>
<div class="u-x-small">{user.$id}</div>
</div>
{/if}
</label>
</td>
</tr>
@@ -93,11 +119,43 @@
</tbody>
</table>
</div>
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: {results?.total}</p>
<PaginationInline limit={5} bind:offset sum={results?.total} hidePages />
</div>
{:else if search}
<EmptySearch hidePages>
<div class="common-section">
<div class="u-text-center common-section">
<b class="body-text-2">Sorry we couldn't find "{search}"</b>
<p>There are no Users that match your search.</p>
</div>
<div class="u-flex u-gap-16 common-section u-main-center">
<Button external href="#/" text>Documentation</Button>
<Button secondary on:click={() => (search = '')}>Clear search</Button>
</div>
</div>
</EmptySearch>
{:else}
<EmptySearch hidePages>
<div class="common-section">
<div class="u-text-center common-section">
<b class="body-text-2">Sorry we couldn't find "{search}"</b>
<p>You have no Users. Create a user to see them here.</p>
<p>
Need a hand? Check out our <a
href="#/"
target="_blank"
rel="noopener noreferrer">
documentation</a
>.
</p>
</div>
</div>
</EmptySearch>
{/if}
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: {results?.total}</p>
<PaginationInline limit={5} bind:offset sum={results?.total} hidePages />
</div>
<svelte:fragment slot="footer">
<Button submit disabled={!hasSelection}>Create</Button>
</svelte:fragment>
+3
View File
@@ -18,6 +18,8 @@
let element: HTMLInputElement;
let error: string;
const pattern = String.raw`^[^]+\s+[^]+\s+[^]+\s+[^]+\s+[^]`;
onMount(() => {
if (element && autofocus) {
element.focus();
@@ -57,6 +59,7 @@
{maxlength}
{readonly}
{step}
{pattern}
type="text"
class="input-text"
bind:value
+8 -2
View File
@@ -2,6 +2,12 @@
import { clickOnEnter } from '$lib/helpers/a11y';
</script>
<div class="table-row" role="row" on:keyup={clickOnEnter} on:click|preventDefault>
<!-- svelte-ignore a11y-unknown-role -->
<tr
class="table-row"
role="row button"
tabindex="0"
on:keyup={clickOnEnter}
on:click|preventDefault>
<slot />
</div>
</tr>
+9
View File
@@ -35,8 +35,17 @@
.getElementsByClassName('code-panel-content')[0]
.scrollTo({ top: 0, left: 0, behavior: 'smooth' });
}
function handleKeydown(event: KeyboardEvent) {
if (event.key === 'Escape') {
event.preventDefault();
$log.show = false;
}
}
</script>
<svelte:window on:keydown={handleKeydown} />
{#if $log.data}
<section class="cover-frame">
<header class="cover-frame-header u-flex u-gap-16 u-main-space-between u-cross-center">
+2 -1
View File
@@ -28,7 +28,8 @@
let showExitModal = false;
function handleKeydown(event: KeyboardEvent) {
if (event.key === 'Escape' && !showExitModal) {
const openDialog = document.querySelectorAll('dialog[open]');
if (event.key === 'Escape' && !showExitModal && !openDialog?.length) {
event.preventDefault();
dispatch('exit');
wizard.hide();
@@ -422,6 +422,7 @@
{/if}
</ul>
<Button
noMargin
text
on:click={() => {
if (prefs[prefs.length - 1][0] && prefs[prefs.length - 1][1]) {
@@ -101,7 +101,7 @@
</svelte:fragment>
<svelte:fragment slot="title">
<h6 class="u-bold">{$database.name}</h6>
<span>Last Updated: TO IMPLEMENT</span>
<span>Last Updated: {toLocaleDateTime($database.$updatedAt)}</span>
</svelte:fragment>
</Box>
</svelte:fragment>
@@ -11,8 +11,12 @@
import Step5 from './wizard/step5.svelte';
import { createFunction } from './wizard/store';
import type { WizardStepsType } from '$lib/layout/wizard.svelte';
import { invalidate } from '$app/navigation';
import { goto, invalidate } from '$app/navigation';
import { Dependencies } from '$lib/constants';
import { base } from '$app/paths';
import { page } from '$app/stores';
const projectId = $page.params.project;
async function onFinish() {
await invalidate(Dependencies.FUNCTIONS);
@@ -33,6 +37,7 @@
await sdkForProject.functions.createVariable(response.$id, v.key, v.value)
);
await invalidate(Dependencies.FUNCTIONS);
goto(`${base}/console/project-${projectId}/functions/function-${response.$id}`);
addNotification({
message: `${$createFunction.name} has been created`,
@@ -90,7 +90,7 @@
{#if activeDeployment}
<CardGrid>
<div class="grid-1-2-col-1 u-flex u-cross-center u-gap-16">
<div class="avatar is-medium">
<div class="avatar is-medium" aria-hidden="true">
<img
src={`${base}/icons/${$app.themeInUse}/color/${
$func.runtime.split('-')[0]
@@ -22,7 +22,7 @@
import Variable from '../../createVariable.svelte';
import Upload from './uploadVariables.svelte';
import { toLocaleDateTime } from '$lib/helpers/date';
import { Permissions } from '$lib/components/permissions';
import { Roles } from '$lib/components/permissions';
import { difference } from '$lib/helpers/array';
import TableList from '$lib/elements/table/tableList.svelte';
import { TableCell, TableCellText } from '$lib/elements/table';
@@ -324,7 +324,7 @@
check out the Permissions Guide in our documentation.
</p>
<svelte:fragment slot="aside">
<Permissions withCrud={false} bind:executeAccess={permissions} />
<Roles bind:roles={permissions} />
</svelte:fragment>
<svelte:fragment slot="actions">
@@ -393,7 +393,7 @@
<svelte:fragment slot="aside">
<FormList>
<InputCron
bind:value={$func.schedule}
bind:value={functionSchedule}
label="Schedule (CRON Syntax)"
id="schedule" />
</FormList>
@@ -14,7 +14,7 @@
onMount(async () => {
let runtimes = await sdkForProject.functions.listRuntimes();
options = runtimes.runtimes.map((runtime) => ({
label: runtime.name,
label: `${runtime.name} - ${runtime.version}`,
value: runtime.$id
}));
});
@@ -39,18 +39,16 @@
{options}
required />
<ul class="form-list">
{#if !showCustomId}
<div>
<Pill button on:click={() => (showCustomId = !showCustomId)}>
<span class="icon-pencil" aria-hidden="true" /><span class="text">
Function ID
</span>
</Pill>
</div>
{:else}
<CustomId bind:show={showCustomId} name="Function" bind:id={$createFunction.id} />
{/if}
</ul>
{#if !showCustomId}
<div>
<Pill button on:click={() => (showCustomId = !showCustomId)}>
<span class="icon-pencil" aria-hidden="true" /><span class="text">
Function ID
</span>
</Pill>
</div>
{:else}
<CustomId bind:show={showCustomId} name="Function" bind:id={$createFunction.id} />
{/if}
</FormList>
</WizardStep>
@@ -1,11 +1,11 @@
<script lang="ts">
import { WizardStep } from '$lib/layout';
import { createFunction } from './store';
import { Permissions } from '$lib/components/permissions';
import { Roles } from '$lib/components/permissions';
</script>
<WizardStep>
<svelte:fragment slot="title">Execute access (optional)</svelte:fragment>
<svelte:fragment slot="title">Execute access</svelte:fragment>
<svelte:fragment slot="subtitle">
Choose who can execute this function using the client API. Check out our documentation for
more on <a
@@ -17,5 +17,5 @@
>.
</svelte:fragment>
<Permissions withCrud={false} bind:executeAccess={$createFunction.execute} />
<Roles bind:roles={$createFunction.execute} />
</WizardStep>
@@ -17,7 +17,7 @@
</script>
<WizardStep>
<svelte:fragment slot="title">Events (optional)</svelte:fragment>
<svelte:fragment slot="title">Events</svelte:fragment>
<svelte:fragment slot="subtitle">
Set the events that will trigger your function. Maximum 100 events allowed.
</svelte:fragment>
@@ -5,7 +5,7 @@
</script>
<WizardStep>
<svelte:fragment slot="title">Scheduling (optional)</svelte:fragment>
<svelte:fragment slot="title">Scheduling</svelte:fragment>
<svelte:fragment slot="subtitle">
Set a CRON schedule to trigger your function. Leave blank for no schedule. <a
href="https://appwrite.io/docs/functions#createFunction"
@@ -22,7 +22,16 @@
function handleCreated(dispatchEvent: CustomEvent) {
createFunction.update((n) => {
n.vars.push(dispatchEvent.detail);
if (n.vars.length) {
n.vars.map((v) => {
if (v.key !== dispatchEvent.detail.key) {
n.vars.push(dispatchEvent.detail);
}
});
} else {
n.vars.push(dispatchEvent.detail);
}
return n;
});
}
@@ -35,7 +44,7 @@
</script>
<WizardStep>
<svelte:fragment slot="title">Variables (optional)</svelte:fragment>
<svelte:fragment slot="title">Variables</svelte:fragment>
<svelte:fragment slot="subtitle">
Create a variable (or secret key) that will be passed to your function at runtime.
</svelte:fragment>
@@ -9,6 +9,7 @@
import { DropList, DropListItem, Heading } from '$lib/components';
import { BarChart, LineChart } from '$lib/charts';
import { humanFileSize } from '$lib/helpers/sizeConvertion';
import { base } from '$app/paths';
$: projectId = $page.params.project;
$: path = `/console/project-${projectId}/overview`;
@@ -161,7 +162,9 @@
</div>
{/if}
</div>
<div class="card is-2-columns-large-screen">
<a
href={`${base}/console/project-${projectId}/databases`}
class="card is-2-columns-large-screen">
<div class="grid-item-1">
<div class="grid-item-1-start-start">
<div class="eyebrow-heading-3">
@@ -181,8 +184,10 @@
<div class="text">Documents: {last($usage.documents).value}</div>
</div>
</div>
</div>
<div class="card is-2-columns-large-screen">
</a>
<a
href={`${base}/console/project-${projectId}/storage`}
class="card is-2-columns-large-screen">
<div class="grid-item-1">
<div class="grid-item-1-start-start">
<div class="eyebrow-heading-3">
@@ -205,13 +210,15 @@
<div class="text">Buckets: XX</div>
</div>
</div>
</div>
<div class="card is-2-columns-large-screen">
</a>
<a
href={`${base}/console/project-${projectId}/authentication`}
class="card is-2-columns-large-screen">
<div class="grid-item-1">
<div class="grid-item-1-start-start">
<div class="eyebrow-heading-3">
<span class="icon-user-group" aria-hidden="true" />
<span class="text">authentication</span>
<span class="text">Authentication</span>
</div>
</div>
@@ -228,8 +235,10 @@
<div class="text">Sessions: XX</div>
</div>
</div>
</div>
<div class="card is-2-columns-large-screen">
</a>
<a
href={`${base}/console/project-${projectId}/functions`}
class="card is-2-columns-large-screen">
<div class="grid-item-1">
<div class="grid-item-1-start-start">
<div class="eyebrow-heading-3">
@@ -251,7 +260,7 @@
<div class="text" />
</div>
</div>
</div>
</a>
<div
class="card is-2-columns-medium-screen is-2-columns-large-screen is-2-rows-large-screen is-location-row-2-end-large-screen">
{#if $stats.get(projectId)}
@@ -10,6 +10,8 @@
import CreateWeb from './createWeb.svelte';
import { versions } from './wizard/store';
import type { PageData } from './$types';
import { base } from '$app/paths';
import { app } from '$lib/stores/app';
export let data: PageData;
@@ -30,6 +32,20 @@
[Platform.Apple]: CreateApple
};
const getPlatformInfo = (platform: string) => {
if (platform.includes('flutter')) {
return 'color/flutter';
} else if (platform.includes('apple')) {
return 'color/apple';
} else if (platform.includes('android')) {
return 'color/android';
} else if (platform.includes('web')) {
return 'grayscale/code';
} else {
return 'unknown';
}
};
async function addPlatform(type: Platform) {
await versions.load();
wizard.start(platforms[type]);
@@ -61,7 +77,18 @@
<div class="grid-box u-margin-block-start-32" style="--grid-gap:1.5rem; --grid-item-size:25rem;">
{#each data.platforms.platforms as platform}
<GridItem1 href={`${path}/${platform.$id}`}>
<svelte:fragment slot="title">{platform.name}</svelte:fragment>
<svelte:fragment slot="title">
<div class="u-flex u-gap-8 u-cross-center">
<div class="avatar is-medium" aria-hidden="true">
<img
src={`${base}/icons/${$app.themeInUse}/${getPlatformInfo(
platform.type.toLowerCase()
)}.svg`}
alt="technology" />
</div>
<span class="text">{platform.name}</span>
</div>
</svelte:fragment>
<div class="grid-item-1-end-start">
<p>Last Updated</p>
<p>{toLocaleDateTime(platform.$updatedAt)}</p>
@@ -21,11 +21,14 @@
import { difference } from '$lib/helpers/array';
import { invalidate } from '$app/navigation';
import { Dependencies } from '$lib/constants';
import { writable, type Writable } from 'svelte/store';
const projectId = $page.params.project;
let name: string = null;
let url: string = null;
let events = [];
const eventSet: Writable<Set<string>> = writable(new Set());
let httpUser: string = null;
let httpPass: string = null;
let security = false;
@@ -37,7 +40,7 @@
onMount(async () => {
name ??= $webhook.name;
url ??= $webhook.url;
events = $webhook.events;
$eventSet = new Set($webhook.events);
httpUser ??= $webhook.httpUser;
httpPass ??= $webhook.httpPass;
security = $webhook.security;
@@ -93,7 +96,7 @@
projectId,
$webhook.$id,
$webhook.name,
events,
Array.from($eventSet),
$webhook.url,
$webhook.security
);
@@ -110,6 +113,7 @@
});
}
}
async function updateSecurity() {
try {
await sdkForConsole.projects.updateWebhook(
@@ -135,8 +139,17 @@
}
}
$: if (difference(events, $webhook.events).length > 0) {
areEventsDisabled = false;
function handleEvent(event: CustomEvent) {
eventSet.set($eventSet.add(event.detail));
}
$: if ($eventSet) {
if (
difference(Array.from($eventSet), $webhook.events).length ||
difference($webhook.events, Array.from($eventSet)).length
) {
areEventsDisabled = false;
} else areEventsDisabled = true;
}
</script>
@@ -200,24 +213,25 @@
<Form on:submit={updateEvents}>
<CardGrid>
<Heading tag="h2" size="7">Update Events</Heading>
<Heading tag="h6" size="7">Update Events</Heading>
<p class="text">
Set the events that will trigger your webhook. Maximum 100 events allowed.
</p>
<svelte:fragment slot="aside">
{#if events?.length}
{#if $eventSet.size}
<TableList>
{#each events as id}
{#each Array.from($eventSet) as event}
<li class="table-row">
<TableCellText title="id">
{id}
{event}
</TableCellText>
<TableCell showOverflow title="options" width={40}>
<button
class="button is-text is-only-icon"
aria-label="delete id"
on:click|preventDefault={() => {
events = events.filter((item) => item !== id);
$eventSet.delete(event);
eventSet.set($eventSet);
}}>
<span class="icon-x" aria-hidden="true" />
</button>
@@ -226,14 +240,17 @@
{/each}
</TableList>
{:else}
<Empty isButton single on:click={() => (showCreateEvent = !showCreateEvent)}
>Add a event to get started</Empty>
<Empty isButton on:click={() => (showCreateEvent = true)}>
Add a event to get started
</Empty>
{/if}
<Button text on:click={() => (showCreateEvent = !showCreateEvent)}>
<span class="icon-plus" aria-hidden="true" />
<span class="u-text">Add event</span>
</Button>
<div class="u-flex u-margin-block-start-16">
<Button text noMargin on:click={() => (showCreateEvent = true)}>
<span class="icon-plus" aria-hidden="true" />
<span class="u-text">Add event</span>
</Button>
</div>
</svelte:fragment>
<svelte:fragment slot="actions">
@@ -317,9 +334,5 @@
<Delete bind:showDelete />
<Regenerate bind:show={showRegenerate} />
<EventModal
bind:show={showCreateEvent}
on:created={(e) => {
events.push(e.detail[0]);
events = events;
}} />
<EventModal bind:show={showCreateEvent} on:created={handleEvent} />
@@ -5,7 +5,7 @@
</script>
<WizardStep>
<svelte:fragment slot="title">Security (optional)</svelte:fragment>
<svelte:fragment slot="title">Security</svelte:fragment>
<svelte:fragment slot="subtitle">
Set an optional basic HTTP authentication username and password to protect your endpoint
from unauthorized access.
+1
View File
@@ -0,0 +1 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13.940 3.740 C 13.556 3.949,13.447 4.129,13.068 5.180 C 12.431 6.947,9.209 16.623,8.645 18.460 C 8.444 19.117,8.420 19.271,8.482 19.529 C 8.571 19.897,9.072 20.304,9.491 20.348 C 9.972 20.397,10.353 20.170,10.594 19.691 C 10.826 19.228,12.607 14.019,14.153 9.280 C 15.524 5.079,15.612 4.771,15.526 4.483 C 15.465 4.281,15.128 3.910,14.909 3.805 C 14.668 3.690,14.103 3.652,13.940 3.740 M5.512 7.388 C 5.213 7.566,4.589 8.142,3.302 9.425 C 1.537 11.187,1.220 11.575,1.220 11.978 C 1.221 12.403,1.449 12.684,3.377 14.632 C 5.273 16.547,5.493 16.725,5.970 16.725 C 6.111 16.725,6.279 16.712,6.343 16.696 C 6.603 16.633,6.977 16.288,7.082 16.016 C 7.159 15.814,7.141 15.317,7.049 15.138 C 6.938 14.921,6.356 14.284,5.141 13.048 L 4.111 12.000 5.083 11.010 C 6.318 9.752,6.939 9.069,7.043 8.853 C 7.147 8.638,7.182 8.309,7.123 8.092 C 7.067 7.882,6.739 7.516,6.509 7.404 C 6.405 7.355,6.216 7.314,6.020 7.299 C 5.719 7.276,5.689 7.282,5.512 7.388 M17.430 7.403 C 17.247 7.499,16.947 7.871,16.885 8.078 C 16.827 8.272,16.827 8.551,16.886 8.724 C 16.976 8.992,17.512 9.589,19.094 11.187 L 19.893 11.994 18.762 13.147 C 17.025 14.916,16.810 15.203,16.850 15.696 C 16.898 16.296,17.392 16.735,18.023 16.739 C 18.284 16.740,18.324 16.728,18.526 16.594 C 18.861 16.372,19.539 15.734,20.861 14.396 C 22.121 13.120,22.556 12.642,22.687 12.386 C 22.784 12.197,22.791 11.871,22.702 11.659 C 22.566 11.332,21.586 10.269,20.108 8.844 C 19.053 7.827,18.676 7.495,18.460 7.396 C 18.229 7.289,17.638 7.293,17.430 7.403 " fill="#C4C6D7" stroke="none" fill-rule="evenodd"></path></svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

+1
View File
@@ -0,0 +1 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13.940 3.740 C 13.556 3.949,13.447 4.129,13.068 5.180 C 12.431 6.947,9.209 16.623,8.645 18.460 C 8.444 19.117,8.420 19.271,8.482 19.529 C 8.571 19.897,9.072 20.304,9.491 20.348 C 9.972 20.397,10.353 20.170,10.594 19.691 C 10.826 19.228,12.607 14.019,14.153 9.280 C 15.524 5.079,15.612 4.771,15.526 4.483 C 15.465 4.281,15.128 3.910,14.909 3.805 C 14.668 3.690,14.103 3.652,13.940 3.740 M5.512 7.388 C 5.213 7.566,4.589 8.142,3.302 9.425 C 1.537 11.187,1.220 11.575,1.220 11.978 C 1.221 12.403,1.449 12.684,3.377 14.632 C 5.273 16.547,5.493 16.725,5.970 16.725 C 6.111 16.725,6.279 16.712,6.343 16.696 C 6.603 16.633,6.977 16.288,7.082 16.016 C 7.159 15.814,7.141 15.317,7.049 15.138 C 6.938 14.921,6.356 14.284,5.141 13.048 L 4.111 12.000 5.083 11.010 C 6.318 9.752,6.939 9.069,7.043 8.853 C 7.147 8.638,7.182 8.309,7.123 8.092 C 7.067 7.882,6.739 7.516,6.509 7.404 C 6.405 7.355,6.216 7.314,6.020 7.299 C 5.719 7.276,5.689 7.282,5.512 7.388 M17.430 7.403 C 17.247 7.499,16.947 7.871,16.885 8.078 C 16.827 8.272,16.827 8.551,16.886 8.724 C 16.976 8.992,17.512 9.589,19.094 11.187 L 19.893 11.994 18.762 13.147 C 17.025 14.916,16.810 15.203,16.850 15.696 C 16.898 16.296,17.392 16.735,18.023 16.739 C 18.284 16.740,18.324 16.728,18.526 16.594 C 18.861 16.372,19.539 15.734,20.861 14.396 C 22.121 13.120,22.556 12.642,22.687 12.386 C 22.784 12.197,22.791 11.871,22.702 11.659 C 22.566 11.332,21.586 10.269,20.108 8.844 C 19.053 7.827,18.676 7.495,18.460 7.396 C 18.229 7.289,17.638 7.293,17.430 7.403 " fill="#373B4D" stroke="none" fill-rule="evenodd"></path></svg>

After

Width:  |  Height:  |  Size: 1.6 KiB