- {#if $activeHeaderAlert?.show} - - {/if} {#if $page.data?.header} {/if} @@ -247,4 +248,14 @@ grid-template-columns: auto 1fr !important; } } + // + //:global(main.has-alert > header) { + // top: 70px; + //} + //:global(main.has-alert > div nav) { + // @media (min-width: 1024px) { + // top: calc(48px + 70px) !important; + // height: calc(100vh - (48px + 70px)) !important; + // } + //} From e26e9129f8052e2d3d1d1a9e04711435459b46e1 Mon Sep 17 00:00:00 2001 From: ernstmul Date: Mon, 10 Mar 2025 14:11:01 +0100 Subject: [PATCH 097/187] Align padding with main sidebar --- .../collection-[collection]/subNavigation.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/subNavigation.svelte b/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/subNavigation.svelte index 55b7379d9..7d9bbfe92 100644 --- a/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/subNavigation.svelte +++ b/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/subNavigation.svelte @@ -54,7 +54,7 @@ {@const isSelected = collectionId === collection.$id}
  • Date: Mon, 10 Mar 2025 14:16:51 +0100 Subject: [PATCH 098/187] Update color vars --- src/lib/commandCenter/panels/template.svelte | 4 ++-- src/lib/components/breadcrumbs.svelte | 4 ++-- src/routes/(console)/onboarding/create-project/loading.svelte | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/commandCenter/panels/template.svelte b/src/lib/commandCenter/panels/template.svelte index 83071bcaf..311919e85 100644 --- a/src/lib/commandCenter/panels/template.svelte +++ b/src/lib/commandCenter/panels/template.svelte @@ -391,8 +391,8 @@ --cmd-center-bg: var(--bgcolor-neutral-primary); --footer-bg: var(--bgcolor-neutral-primary); --cmd-center-border: var(--border-neutral); - --result-bg: var(--color-overlay-neutral-hover); - --kbd-bg: var(--color-overlay-on-neutral); + --result-bg: var(--overlay-neutral-hover); + --kbd-bg: var(--overlay-on-neutral); --kbd-color: var(--fgcolor-neutral-secondary); --icon-color: var(--fgcolor-neutral-tertiary); --label-color: var(--fgcolor-neutral-secondary); diff --git a/src/lib/components/breadcrumbs.svelte b/src/lib/components/breadcrumbs.svelte index 30a99bcb5..bea8f0a55 100644 --- a/src/lib/components/breadcrumbs.svelte +++ b/src/lib/components/breadcrumbs.svelte @@ -399,7 +399,7 @@ :global(.item[data-highlighted]) { border-radius: var(--border-radius-S, 8px); - background: var(--color-overlay-neutral-hover, rgba(25, 25, 28, 0.03)); + background: var(--overlay-neutral-hover, rgba(25, 25, 28, 0.03)); } .trigger { display: inline-flex; @@ -424,7 +424,7 @@ } .trigger:hover { - background: var(--color-overlay-neutral-hover, rgba(25, 25, 28, 0.03)); + background: var(--overlay-neutral-hover, rgba(25, 25, 28, 0.03)); } :global(.trigger[data-highlighted]) { diff --git a/src/routes/(console)/onboarding/create-project/loading.svelte b/src/routes/(console)/onboarding/create-project/loading.svelte index 6d817bde4..23c467c2b 100644 --- a/src/routes/(console)/onboarding/create-project/loading.svelte +++ b/src/routes/(console)/onboarding/create-project/loading.svelte @@ -197,7 +197,7 @@ diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/+page.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/+page.svelte index 88cf037db..b7f2ac859 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/+page.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/+page.svelte @@ -183,31 +183,6 @@ {#if data.deploymentList.total} - -
    - - {#if $tags?.length} -
    -
    - - {/if} -
    -
    {/if}
    diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/executions/(components)/LogsRequest.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/executions/(components)/LogsRequest.svelte new file mode 100644 index 000000000..71fee3b9a --- /dev/null +++ b/src/routes/(console)/project-[project]/functions/function-[function]/executions/(components)/LogsRequest.svelte @@ -0,0 +1,114 @@ + + + + + + (requestTab = 'parameters')}> + Parameters + + + (requestTab = 'headers')}> + Headers + + + + + {#if requestTab === 'parameters'} + {#if parameters?.length} + + + Key + Value + + {#each parameters as parameter} + + {parameter.name} + {parameter.value} + + {/each} + + {:else} + + No parameters found. + + {/if} + {:else if requestTab === 'headers'} + {#if selectedLog.requestHeaders?.length} + + + Key + Value + + {#each selectedLog.requestHeaders as request} + + {request.name} + {request.value} + + {/each} + + + + + Missing headers? Check the docs to + see the supported data and how to log it. + + + {:else} + + No headers found. + + {/if} + {/if} + diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/executions/(components)/LogsResponse.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/executions/(components)/LogsResponse.svelte new file mode 100644 index 000000000..82e204396 --- /dev/null +++ b/src/routes/(console)/project-[project]/functions/function-[function]/executions/(components)/LogsResponse.svelte @@ -0,0 +1,127 @@ + + + + + + (responseTab = 'logs')}> + Logs + + (responseTab = 'errors')}> + Errors + + (responseTab = 'headers')}> + Headers + + + (responseTab = 'body')}> + Body + + + + + + {#if responseTab === 'logs'} + {#if selectedLog.logs} + + {:else} + + No logs found. + + {/if} + {:else if responseTab === 'errors'} + {#if selectedLog.errors} + + {:else} + + No errors found. + + {/if} + {:else if responseTab === 'headers'} + {#if selectedLog.responseHeaders?.length} + + + Key + Value + + {#each selectedLog.responseHeaders as request} + + {request.name} + {request.value} + + {/each} + + + + + Missing headers? Check the docs to + see the supported data and how to log it. + + + {:else} + + No headers found. + + {/if} + {:else if responseTab === 'body'} + {#if selectedLog.responseBody} + + {:else} + + Body data is not captured by Appwrite for your user's security and privacy. To + display body data in the Logs tab, use . + Learn more. + + + {/if} + {/if} + diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/executions/+page.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/executions/+page.svelte index f44dccf92..09c7544cd 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/executions/+page.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/executions/+page.svelte @@ -31,31 +31,7 @@ - + {#if data?.executions?.total} diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/executions/quickFilters.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/executions/quickFilters.svelte index df451a731..f9bb43bf0 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/executions/quickFilters.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/executions/quickFilters.svelte @@ -11,11 +11,9 @@ type TagValue } from '$lib/components/filters/store'; import type { Column } from '$lib/helpers/types'; - import { Card, Icon } from '@appwrite.io/pink-svelte'; - import { melt, createMenubar } from '@melt-ui/svelte'; import { type Writable } from 'svelte/store'; - import { Button } from '$lib/elements/forms'; - import { IconFilterLine } from '@appwrite.io/pink-icons-svelte'; + import Menu from '$lib/components/filters/menu.svelte'; + import { CustomFilters } from '$lib/components/filters'; export let columns: Writable; @@ -183,86 +181,53 @@ addFilter($columns, colId, ValidOperators.GreaterThanOrEqual, isoValue.toISOString()); addFilter($columns, colId, ValidOperators.LessThanOrEqual, now.toISOString()); } - - const { - elements: { menubar }, - builders: { createMenu } - } = createMenubar(); - - const { - elements: { trigger: trigger, menu: menu } - } = createMenu(); -
    -
    - {#if $tags.length} - - {:else} - - {/if} -
    - - -
    - - + + {#each [statusFilter, triggerFilter, methodFilter] as filter} + { + console.log('test'); + addFilterAndApply( + filter.id, + filter.title, + filter.operator, + e.detail.value, + filter?.array + ? (filter.options.filter((opt) => opt.checked).map((opt) => opt.value) ?? + []) + : [] + ); + }} + on:clear={() => { + filter.tag = null; + addFilterAndApply(filter.id, filter.title, filter.operator, null, []); + }} /> + {/each} + {#each [statusCodeFilter, createdAtFilter] as filter} + { + console.log('test'); + addFilterAndApply( + filter.id, + filter.title, + filter.operator, + e.detail.value, + filter?.array + ? (filter.options.filter((opt) => opt.checked).map((opt) => opt.value) ?? + []) + : [] + ); + }} + on:clear={() => { + filter.tag = null; + addFilterAndApply(filter.id, filter.title, filter.operator, null, []); + }} /> + {/each} + + + + diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/executions/sheet.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/executions/sheet.svelte index 70497878d..26c5b316e 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/executions/sheet.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/executions/sheet.svelte @@ -11,11 +11,16 @@ Layout, Sheet, Tag, - Typography + Typography, + Tooltip, + Status } from '@appwrite.io/pink-svelte'; - import { timeFromNow } from '$lib/helpers/date'; + import { timeFromNow, toLocaleDateTime } from '$lib/helpers/date'; import { capitalize } from '$lib/helpers/string'; import { Copy } from '$lib/components'; + import { logStatusConverter } from './store'; + import LogsResponse from './(components)/LogsResponse.svelte'; + import LogsRequest from './(components)/LogsRequest.svelte'; export let open = false; export let selectedLogId: string; @@ -40,14 +45,13 @@ $: selectedLog = logs?.find((log) => log.$id === selectedLogId); $: isFirstLog = logs.findIndex((log) => log.$id === selectedLogId) === 0; $: isLastLog = logs.findIndex((log) => log.$id === selectedLogId) === logs.length - 1; - $: console.log(selectedLog);
    - Log ID + Execution ID {selectedLog?.$id} @@ -66,66 +70,109 @@ - - - - - Method - - - {selectedLog.requestMethod} - - - - - Status - - - = 400 - ? 'error' - : 'success'} /> - - - - - Duration - - - {calculateTime(selectedLog.duration)} - - - - - Created - - - {capitalize(timeFromNow(selectedLog.$createdAt))} - - - - + + + + Method + + + {selectedLog.requestMethod} + + + + + Status code + + + = 400 + ? 'error' + : selectedLog.responseStatusCode === 0 + ? undefined + : 'success'} /> + + - - - Path - -
    - -
    -
    + + + Path + +
    + +
    +
    +
    + + + + Status + + + +
    + + {capitalize(selectedLog.status)} + +
    + + {`Scheduled to execute on ${toLocaleDateTime(selectedLog.scheduledAt)}`} + +
    +
    + + + Duration + + + {calculateTime(selectedLog.duration)} + + + + + Triggered + + + {capitalize(selectedLog.trigger)} + + + + + Created + + + {capitalize(timeFromNow(selectedLog.$createdAt))} + + +
    - + - +
    {/if} diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/executions/store.ts b/src/routes/(console)/project-[project]/functions/function-[function]/executions/store.ts index 2459b8059..2758f99ad 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/executions/store.ts +++ b/src/routes/(console)/project-[project]/functions/function-[function]/executions/store.ts @@ -3,29 +3,15 @@ import { writable } from 'svelte/store'; export const columns = writable([ { id: '$id', title: 'Execution ID', type: 'string', show: true, width: 150 }, - { - id: '$createdAt', - title: 'Created', - type: 'datetime', + id: 'requestPath', + title: 'Path', + type: 'string', show: true, - width: 120, - format: 'datetime', - elements: [ - { - value: 5 * 60 * 1000, - label: 'last 5 minutes' - }, - { - value: 60 * 60 * 1000, - label: 'last 1 hour' - }, - { - value: 24 * 60 * 60 * 1000, - label: 'last 24 hours' - } - ] + width: 90, + format: 'string' }, + { id: 'trigger', title: 'Trigger', @@ -79,14 +65,7 @@ export const columns = writable([ ], hide: true }, - { - id: 'requestPath', - title: 'Path', - type: 'string', - show: true, - width: 90, - format: 'string' - }, + { id: 'status', title: 'Status', @@ -118,5 +97,48 @@ export const columns = writable([ label: 'more than 30 seconds' } ] + }, + { + id: '$createdAt', + title: 'Created', + type: 'datetime', + show: true, + width: 120, + format: 'datetime', + elements: [ + { + value: 5 * 60 * 1000, + label: 'last 5 minutes' + }, + { + value: 60 * 60 * 1000, + label: 'last 1 hour' + }, + { + value: 24 * 60 * 60 * 1000, + label: 'last 24 hours' + } + ] } ]); + +export function logStatusConverter(status: string) { + // ['completed', 'failed', 'waiting', 'scheduled', 'processing', 'cancelled'] + + switch (status) { + case 'completed': + return 'complete'; + case 'scheduled': + return 'processing'; + case 'processing': + return 'processing'; + case 'waiting': + return 'waiting'; + case 'peding': + return 'pending'; + case 'cancelled': + return 'waiting'; + case 'failed': + return 'failed'; + } +} diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/executions/table.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/executions/table.svelte index 59be85c6a..fa1bf102c 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/executions/table.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/executions/table.svelte @@ -7,35 +7,13 @@ import Sheet from './sheet.svelte'; import { capitalize } from '$lib/helpers/string'; import { formatTimeDetailed } from '$lib/helpers/timeConversion'; + import { logStatusConverter } from './store'; export let columns: Column[]; export let logs: Models.ExecutionList; let openSheet = false; let selectedLogId: string = null; - - $: console.log(columns); - - export function logStatusConverter(status: string) { - // ['completed', 'failed', 'waiting', 'scheduled', 'processing', 'cancelled'] - - switch (status) { - case 'completed': - return 'complete'; - case 'scheduled': - return 'ready'; - case 'processing': - return 'processing'; - case 'waiting': - return 'waiting'; - case 'peding': - return 'pending'; - case 'cancelled': - return 'waiting'; - case 'failed': - return 'failed'; - } - } @@ -97,12 +75,7 @@ - {#if status === 'scheduled'} -
    diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/quickFilters.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/quickFilters.svelte index e171c5784..9286f84d0 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/quickFilters.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/quickFilters.svelte @@ -1,19 +1,18 @@ -{#each [typeFilter] as filter} - - - {#key filter.tag} - - {filter?.tag ?? filter.title} - - {/key} - - - - - {#each filter.options as option (option.value + option.checked)} - { - option.checked = !option.checked; - addFilterAndApply( - filter.id, - filter.title, - filter.operator, - filter?.array ? null : option.checked ? option.value : null, - filter?.array - ? (filter.options - .filter((opt) => opt.checked) - .map((opt) => opt.value) ?? []) - : [] - ); - }}> - {option.label} - - {/each} - {#if filter.options.some((option) => option.checked)} - { - toggle(e); - filter.tag = null; - addFilterAndApply(filter.id, filter.title, filter.operator, null, []); - }}> - Clear selection - - {/if} - - - -{/each} -{#each [sizeFilter] as filter} - - - {#key filter.tag} - - {filter?.tag ?? filter.title} - - {/key} - - - - - {#each filter.options as option (option.value + option.checked)} - { - addFilterAndApply( - filter.id, - filter.title, - filter.operator, - filter?.array ? null : option.value, - [] - ); - toggle(e); - }}> - {option.label} - - {/each} - {#if filter?.tag} - { - filter.tag = null; - addFilterAndApply(filter.id, filter.title, filter.operator, null, []); - toggle(e); - }}> - Clear selection - - {/if} - - - -{/each} + + {#each [typeFilter] as filter} + { + console.log('test'); + addFilterAndApply( + filter.id, + filter.title, + filter.operator, + e.detail.value, + filter?.array + ? (filter.options.filter((opt) => opt.checked).map((opt) => opt.value) ?? + []) + : [] + ); + }} + on:clear={() => { + filter.tag = null; + addFilterAndApply(filter.id, filter.title, filter.operator, null, []); + }} /> + {/each} + {#each [sizeFilter] as filter} + { + console.log('test'); + addFilterAndApply( + filter.id, + filter.title, + filter.operator, + e.detail.value, + filter?.array + ? (filter.options.filter((opt) => opt.checked).map((opt) => opt.value) ?? + []) + : [] + ); + }} + on:clear={() => { + filter.tag = null; + addFilterAndApply(filter.id, filter.title, filter.operator, null, []); + }} /> + {/each} + + + + diff --git a/src/routes/(console)/project-[project]/sites/site-[site]/logs/+page.svelte b/src/routes/(console)/project-[project]/sites/site-[site]/logs/+page.svelte index 95c47e7e1..6cd53aab5 100644 --- a/src/routes/(console)/project-[project]/sites/site-[site]/logs/+page.svelte +++ b/src/routes/(console)/project-[project]/sites/site-[site]/logs/+page.svelte @@ -20,6 +20,15 @@ const columns = writable([ { id: '$id', title: 'Log ID', type: 'string', show: true, width: 150 }, + + { + id: 'requestPath', + title: 'Path', + type: 'string', + show: true, + width: 90, + format: 'string' + }, { id: '$createdAt', title: 'Created', @@ -41,15 +50,6 @@ label: 'last 24 hours' } ] - }, - - { - id: 'requestPath', - title: 'Path', - type: 'string', - show: true, - width: 90, - format: 'string' } ]); let search = ''; diff --git a/src/routes/(console)/project-[project]/sites/site-[site]/logs/sheet.svelte b/src/routes/(console)/project-[project]/sites/site-[site]/logs/sheet.svelte index f31f2ca55..d50a824b3 100644 --- a/src/routes/(console)/project-[project]/sites/site-[site]/logs/sheet.svelte +++ b/src/routes/(console)/project-[project]/sites/site-[site]/logs/sheet.svelte @@ -80,7 +80,7 @@
    - Status + Status code Date: Mon, 10 Mar 2025 18:00:52 +0100 Subject: [PATCH 104/187] feat: functions and sites settings --- .../function-[function]/settings/+page.svelte | 19 +- .../function-[function]/settings/+page.ts | 5 +- .../settings/connectRepoModal.svelte | 150 ++++++++ .../settings/disconnectRepo.svelte | 6 +- .../settings/executeFunction.svelte | 49 ++- .../settings/gitConfigurationModal.svelte | 288 --------------- .../settings/updateConfiguration.svelte | 343 ------------------ .../settings/updateName.svelte | 14 +- .../settings/updateRepository.svelte | 256 +++++++++++++ .../settings/updateRuntime.svelte | 40 +- .../sites/site-[site]/settings/+page.svelte | 4 +- .../settings/disconnectRepo.svelte | 10 +- .../site-[site]/settings/updateName.svelte | 6 +- .../settings/updateRepository.svelte | 2 +- 14 files changed, 491 insertions(+), 701 deletions(-) create mode 100644 src/routes/(console)/project-[project]/functions/function-[function]/settings/connectRepoModal.svelte delete mode 100644 src/routes/(console)/project-[project]/functions/function-[function]/settings/gitConfigurationModal.svelte delete mode 100644 src/routes/(console)/project-[project]/functions/function-[function]/settings/updateConfiguration.svelte create mode 100644 src/routes/(console)/project-[project]/functions/function-[function]/settings/updateRepository.svelte diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/+page.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/settings/+page.svelte index 48ecdd002..cd423a188 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/settings/+page.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/settings/+page.svelte @@ -1,9 +1,7 @@ - Settings - {#if $func.version === 'v2' && showAlert} + {#if data.function.version === 'v2' && showAlert} - + {#key data.function.providerRepositoryId} + + {/key} diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/+page.ts b/src/routes/(console)/project-[project]/functions/function-[function]/settings/+page.ts index 91d0ea7c0..ee116f432 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/settings/+page.ts +++ b/src/routes/(console)/project-[project]/functions/function-[function]/settings/+page.ts @@ -1,10 +1,9 @@ import { sdk } from '$lib/stores/sdk'; import { Dependencies } from '$lib/constants'; -import type { PageLoad } from './$types'; -export const load: PageLoad = async ({ params, depends, parent }) => { +export const load = async ({ params, depends, parent }) => { depends(Dependencies.VARIABLES); - depends(Dependencies.FUNCTIONS); + depends(Dependencies.FUNCTION); const { runtimesList } = await parent(); diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/connectRepoModal.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/settings/connectRepoModal.svelte new file mode 100644 index 000000000..9709f8bf1 --- /dev/null +++ b/src/routes/(console)/project-[project]/functions/function-[function]/settings/connectRepoModal.svelte @@ -0,0 +1,150 @@ + + + + + Connect your function to an existing repository or create a new one. + + {#if hasInstallations} + + + {#if repositoryBehaviour === 'new'} + + {:else} + { + trackEvent(Click.ConnectRepositoryClick, { + from: 'functions' + }); + repository.set(e.detail); + repositoryName = e.detail.name; + selectedRepository = e.detail.id; + connectRepo(); + }} /> + {/if} + + {:else} + + {/if} + + {#if repositoryBehaviour === 'existing'} + + + + Missing a repository? check your permissions + + + + {:else if repositoryBehaviour === 'new'} + + + {/if} + + diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/disconnectRepo.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/settings/disconnectRepo.svelte index 33b849b9e..792506c3b 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/settings/disconnectRepo.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/settings/disconnectRepo.svelte @@ -2,7 +2,7 @@ import { invalidate } from '$app/navigation'; import { page } from '$app/stores'; import { Submit, trackEvent, trackError } from '$lib/actions/analytics'; - import { Modal } from '$lib/components'; + import { Confirm } from '$lib/components'; import { Dependencies } from '$lib/constants'; import { Button } from '$lib/elements/forms'; import { addNotification } from '$lib/stores/notifications'; @@ -61,7 +61,7 @@ } - +

    Are you sure you want to disconnect {$func.name}? This will affect future deployments to this function. @@ -70,4 +70,4 @@ - + diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/executeFunction.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/settings/executeFunction.svelte index b98a86cde..3feb55e48 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/settings/executeFunction.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/settings/executeFunction.svelte @@ -2,30 +2,45 @@ import { base } from '$app/paths'; import { CardGrid, SvgIcon } from '$lib/components'; import { Button } from '$lib/elements/forms'; - import { toLocaleDateTime } from '$lib/helpers/date'; + import { timeFromNow, toLocaleDateTime } from '$lib/helpers/date'; import { project } from '$routes/(console)/project-[project]/store'; - import { Typography } from '@appwrite.io/pink-svelte'; + import { Layout, Tooltip, Typography } from '@appwrite.io/pink-svelte'; import { func } from '../store'; + import { capitalize } from '$lib/helpers/string'; -

    - -
    - {$func.name} + {$func.name} -

    {$func.runtime}

    -
    -
    -
    -
    -

    Created at: {toLocaleDateTime($func.$createdAt)}

    -

    Last updated at: {toLocaleDateTime($func.$updatedAt)}

    -
    -
    + + + Runtime + + + + {capitalize($func.runtime)} + + + + + Updated + + + {capitalize(timeFromNow($func.$updatedAt))} + + {toLocaleDateTime($func.$updatedAt)} + + + + + + Created + + {toLocaleDateTime($func.$createdAt)} + + +
    diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/gitConfigurationModal.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/settings/gitConfigurationModal.svelte deleted file mode 100644 index 236c692a9..000000000 --- a/src/routes/(console)/project-[project]/functions/function-[function]/settings/gitConfigurationModal.svelte +++ /dev/null @@ -1,288 +0,0 @@ - - - -

    - Configure a Git repository that will trigger your function deployments when updated. -

    - {#if step === 1} - {#await getRepos()} - Fetching repositories.. - {:then} -
    -
    - -
    -
    - -
    -
    - -

    - Manage organization configuration in your project settings. -

    - {#if repositoriesList.length} -
      - {#each repositoriesList as repo} -
    • - -
    • - {/each} -
    -
    -

    Total results: {repositoriesList.length}

    - -
    - {:else if search} - -
    -
    - Sorry we couldn't find "{search}" -

    There are no repositories that match your search.

    -
    -
    - - -
    -
    -
    - {:else} - -
    -
    -

    You have no repositories.

    -

    - Need a hand? Learn more in our - documentation. -

    -
    -
    -
    - {/if} - {/await} - {:else} - {#await getBranches()} - Fetching branches.. - {:then} - - -
    - -
    -
    - -
    {selectedRepo.name}
    -
    -

    Last updated: {toLocaleDateTime(selectedRepo.pushedAt)}

    -
    - - { - selectedBranch = event.detail.value; - }} - name="branch" - options={branchesList?.branches?.map((branch) => { - return { - value: branch.name, - label: branch.name - }; - }) ?? []} /> - - - {/await} - {/if} - - - {#if step === 1} - - - {:else} - - - {/if} - - diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateConfiguration.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateConfiguration.svelte deleted file mode 100644 index 46a273527..000000000 --- a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateConfiguration.svelte +++ /dev/null @@ -1,343 +0,0 @@ - diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateName.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateName.svelte index eb2b3ddfe..8800fbad1 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateName.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateName.svelte @@ -63,14 +63,12 @@ Name -
      - -
    +
    diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateRepository.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateRepository.svelte new file mode 100644 index 000000000..bc7c2359d --- /dev/null +++ b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateRepository.svelte @@ -0,0 +1,256 @@ + + +
    + + Git repository + Automatically deploy changes for every commit pushed to your Git repository. + + {#if repository === false} + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    +
    + {:else if repository} + + + + + + + + {repository.name} + + + Last updated: {toLocaleDateTime(repository.pushedAt)} + + + + + + + +
    + + { + selectedBranch = event.detail.value; + }} + name="branch" + options={branchesList?.branches?.map((branch) => { + return { + value: branch.name, + label: branch.name + }; + }) ?? []} /> + + + + + + + +
    +
    + {:else if func.installationId || installations?.total} + + + + + + + + {:else} + + {/if} +
    + + + + +
    + + +{#if showConnectRepo} + +{/if} + +{#if showDisconnect} + +{/if} diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateRuntime.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateRuntime.svelte index 217ee3a63..02c9d94d1 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateRuntime.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateRuntime.svelte @@ -4,7 +4,7 @@ import { Submit, trackError, trackEvent } from '$lib/actions/analytics'; import { CardGrid } from '$lib/components'; import { Dependencies } from '$lib/constants'; - import { Button, Form, FormList } from '$lib/elements/forms'; + import { Button, Form, InputText } from '$lib/elements/forms'; import { addNotification } from '$lib/stores/notifications'; import { sdk } from '$lib/stores/sdk'; import { onMount } from 'svelte'; @@ -13,19 +13,18 @@ import { specificationsList } from '$lib/stores/specifications'; import { isValueOfStringEnum } from '$lib/helpers/types'; import { Runtime, type Models } from '@appwrite.io/console'; + import { Layout, Typography } from '@appwrite.io/pink-svelte'; + import Link from '$lib/elements/link.svelte'; export let runtimesList: Models.RuntimeList; const functionId = $page.params.function; - let runtime: string = null; - let specification: string = null; + let runtime: string = $func.runtime; + let entrypoint = $func.entrypoint; let options = []; let specificationOptions = []; onMount(async () => { - runtime ??= $func.runtime; - specification ??= $func.specification; - let allowedSpecifications = (await $specificationsList).specifications; options = runtimesList.runtimes.map((runtime) => ({ label: `${runtime.name} - ${runtime.version}`, @@ -56,7 +55,7 @@ $func.timeout || undefined, $func.enabled || undefined, $func.logging || undefined, - $func.entrypoint || undefined, + entrypoint || undefined, $func.commands || undefined, $func.scopes || undefined, $func.installationId || undefined, @@ -64,7 +63,7 @@ $func.providerBranch || undefined, $func.providerSilentMode || undefined, $func.providerRootDirectory || undefined, - specification + $func.specification || undefined ); await invalidate(Dependencies.FUNCTION); addNotification({ @@ -81,14 +80,20 @@ } } - $: isUpdateButtonEnabled = runtime !== $func?.runtime || specification !== $func?.specification; + $: isUpdateButtonEnabled = runtime !== $func?.runtime || entrypoint !== $func?.entrypoint;
    Runtime + + Select the runtime for executing your function and define its entrypoint. Version + changes apply on redeploy and can be updated here. Learn more. + - + - - + + diff --git a/src/routes/(console)/project-[project]/sites/site-[site]/settings/+page.svelte b/src/routes/(console)/project-[project]/sites/site-[site]/settings/+page.svelte index ccc537820..c554e38fd 100644 --- a/src/routes/(console)/project-[project]/sites/site-[site]/settings/+page.svelte +++ b/src/routes/(console)/project-[project]/sites/site-[site]/settings/+page.svelte @@ -56,7 +56,9 @@ - + {#key data.site.providerRepositoryId} + + {/key} import { invalidate } from '$app/navigation'; import { Submit, trackEvent, trackError } from '$lib/actions/analytics'; - import { Modal } from '$lib/components'; + import { Confirm } from '$lib/components'; import { Dependencies } from '$lib/constants'; import { Button } from '$lib/elements/forms'; import { addNotification } from '$lib/stores/notifications'; import { sdk } from '$lib/stores/sdk'; - import type { BuildRuntime, Framework, Models } from '@appwrite.io/console'; + import type { Adapter, BuildRuntime, Framework, Models } from '@appwrite.io/console'; import { createEventDispatcher } from 'svelte'; export let show = false; @@ -27,7 +27,7 @@ site.buildCommand || undefined, site.outputDirectory || undefined, (site?.buildRuntime as BuildRuntime) || undefined, - site.adapter, + site.adapter as Adapter, site.fallbackFile || undefined, '', '', @@ -54,7 +54,7 @@ } - +

    Are you sure you want to disconnect {site.name}? This will affect future deployments to this site. @@ -63,4 +63,4 @@ - + diff --git a/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateName.svelte b/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateName.svelte index 3b8290775..ab832d922 100644 --- a/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateName.svelte +++ b/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateName.svelte @@ -7,7 +7,7 @@ import { addNotification } from '$lib/stores/notifications'; import { sdk } from '$lib/stores/sdk'; import { onMount } from 'svelte'; - import { BuildRuntime, Framework, type Models } from '@appwrite.io/console'; + import { Adapter, BuildRuntime, Framework, type Models } from '@appwrite.io/console'; export let site: Models.Site; let siteName: string = null; @@ -28,7 +28,7 @@ site.buildCommand || undefined, site.outputDirectory || undefined, (site?.buildRuntime as BuildRuntime) || undefined, - site.adapter, + site.adapter as Adapter, site.fallbackFile || undefined, site.installationId || undefined, site.providerRepositoryId || undefined, @@ -60,7 +60,7 @@ id="name" label="Name" placeholder="Enter name" - autocomplete={false} + required bind:value={siteName} /> diff --git a/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateRepository.svelte b/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateRepository.svelte index 66856aa2e..5a83b474b 100644 --- a/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateRepository.svelte +++ b/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateRepository.svelte @@ -116,7 +116,7 @@ - + Git repository Automatically deploy changes for every commit pushed to your Git repository. From c073618bbdb05883281974468501a0386f447181 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Mon, 10 Mar 2025 23:42:57 +0400 Subject: [PATCH 105/187] fix: billing stuff --- package.json | 4 +- .../components/billing/paymentBoxes.svelte | 78 ++-- .../components/billing/paymentModal.svelte | 4 + src/lib/components/creditCardInfo.svelte | 63 ++- src/lib/stores/stripe.ts | 15 +- .../billing/availableCredit.svelte | 18 +- .../billing/billingAddress.svelte | 176 +++------ .../billing/budgetAlert.svelte | 18 +- .../billing/budgetCap.svelte | 19 +- .../billing/deleteOrgPayment.svelte | 15 +- .../billing/paymentHistory.svelte | 268 ++++++------- .../billing/paymentMethods.svelte | 372 +++++++++--------- .../billing/planSummary.svelte | 341 ++++++++-------- .../billing/replaceCard.svelte | 10 +- 14 files changed, 653 insertions(+), 748 deletions(-) diff --git a/package.json b/package.json index 42eb7d03d..48266d7b8 100644 --- a/package.json +++ b/package.json @@ -21,9 +21,9 @@ "dependencies": { "@appwrite.io/console": "https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@640f09c", "@appwrite.io/pink-icons": "0.25.0", - "@appwrite.io/pink-icons-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@525e5be8", + "@appwrite.io/pink-icons-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@3fd919a0", "@appwrite.io/pink-legacy": "^1.0.2", - "@appwrite.io/pink-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@30b0f25", + "@appwrite.io/pink-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@3fd919a0", "@popperjs/core": "^2.11.8", "@sentry/sveltekit": "^8.38.0", "@stripe/stripe-js": "^3.5.0", diff --git a/src/lib/components/billing/paymentBoxes.svelte b/src/lib/components/billing/paymentBoxes.svelte index 0ff377796..993e65d10 100644 --- a/src/lib/components/billing/paymentBoxes.svelte +++ b/src/lib/components/billing/paymentBoxes.svelte @@ -1,11 +1,12 @@ - - - - - - - - {element.brand} ending in {element.last4} - - - {#if element.$id === backupMethod} - Backup - {:else if element.$id === defaultMethod} - Default - {/if} - - {#if !!defaultMethod && element.$id !== defaultMethod && group === element.$id && showSetAsDefault && element.$id !== backupMethod} -

      - -
    + + {#each methods as method} + {@const value = method.$id.toString()} + + + {#if method.$id === backupMethod} + + {:else if method.$id === defaultMethod} + {/if} - - - - - Add new payment method - - - +
    + + {method.brand} ending in {method.last4} + + + + {/each} + + {#if group === '$new'} {/if} - - + {/if} + diff --git a/src/lib/components/creditCardInfo.svelte b/src/lib/components/creditCardInfo.svelte index f18743134..ff19679a8 100644 --- a/src/lib/components/creditCardInfo.svelte +++ b/src/lib/components/creditCardInfo.svelte @@ -1,41 +1,38 @@ -
    -
    -
    - -

    - {paymentMethod?.brand} ending in {paymentMethod?.last4} -

    - -
    -

    - Expires {paymentMethod?.expiryMonth}/{paymentMethod?.expiryYear} -

    - {#if paymentMethod?.name} -

    - {paymentMethod.name} -

    - {/if} -
    - - -
    - {#if paymentMethod?.expired} - - This payment method has expired - + + + + ending in {paymentMethod?.last4} + {#if isBackup} + + {/if} + + +{paymentMethod?.name} +{paymentMethod?.expiryMonth}/{paymentMethod?.expiryYear} + + {#if paymentMethod?.lastError || paymentMethod?.expired} + + + + Details + + + {#if paymentMethod?.expired} + This payment method has expired + {/if} + {#if paymentMethod?.lastError} + {paymentMethod.lastError} + {/if} + + {/if} - {#if paymentMethod?.lastError} - - {paymentMethod.lastError} - - {/if} -
    + diff --git a/src/lib/stores/stripe.ts b/src/lib/stores/stripe.ts index 58edfd431..86d879a07 100644 --- a/src/lib/stores/stripe.ts +++ b/src/lib/stores/stripe.ts @@ -7,6 +7,7 @@ import { Submit, trackError, trackEvent } from '$lib/actions/analytics'; import { addNotification } from './notifications'; import { organization } from './organization'; import { base } from '$app/paths'; +import { ThemeLightCloud } from '$themes'; export const stripe = writable(); let paymentMethod: PaymentMethodData; @@ -186,13 +187,13 @@ export async function confirmSetup( const appearanceLight = { variables: { - colorPrimary: '#606a7b', - colorText: 'rgb(107, 107, 112)', - colorBackground: '#FFFFFF', - color: '#606a7b', - colorDanger: '#df1b41', - fontFamily: 'Inter, arial, sans-serif', - borderRadius: '4px' + colorPrimary: ThemeLightCloud['fgcolor-neutral-primary'], + colorText: ThemeLightCloud['fgcolor-neutral-primary'], + colorBackground: ThemeLightCloud['bgcolor-neutral-primary'], + color: ThemeLightCloud['fgcolor-neutral-primary'], + colorDanger: ThemeLightCloud['fgcolor-error'], + fontFamily: ThemeLightCloud['font-family-sansserif'], + borderRadius: ThemeLightCloud['border-radius-s'] }, rules: { '.Input:hover': { diff --git a/src/routes/(console)/organization-[organization]/billing/availableCredit.svelte b/src/routes/(console)/organization-[organization]/billing/availableCredit.svelte index eaa630083..e4597d4fa 100644 --- a/src/routes/(console)/organization-[organization]/billing/availableCredit.svelte +++ b/src/routes/(console)/organization-[organization]/billing/availableCredit.svelte @@ -1,5 +1,5 @@ {#if $organization} @@ -40,166 +64,165 @@ $organization?.billingNextInvoiceDate )}

    - - -
    -
    - - {tierToPlan($organization?.billingPlan)?.name} plan -
    - {isTrial || - $organization?.billingPlan === BillingPlan.GITHUB_EDUCATION - ? formatCurrency(0) - : currentPlan - ? formatCurrency(currentPlan?.price) - : ''} -
    -
    + + + + + {tierToPlan($organization?.billingPlan)?.name} plan + + + {isTrial || $organization?.billingPlan === BillingPlan.GITHUB_EDUCATION + ? formatCurrency(0) + : currentPlan + ? formatCurrency(currentPlan?.price) + : ''} + + - {#if $organization?.billingPlan !== BillingPlan.FREE && $organization?.billingPlan !== BillingPlan.GITHUB_EDUCATION && extraUsage > 0} - - - Add-ons{extraMembers ? extraAddons + 1 : extraAddons} -
    - -
    -
    - -
    - - {formatCurrency(extraUsage >= 0 ? extraUsage : 0)} - -
    -
    + {#if $organization?.billingPlan !== BillingPlan.FREE && $organization?.billingPlan !== BillingPlan.GITHUB_EDUCATION && extraUsage > 0} + + + {formatCurrency(extraUsage >= 0 ? extraUsage : 0)} + + + {#if extraMembers} + + + Additional members + {formatCurrency( + extraMembers * + (currentPlan?.addons?.member?.price ?? 0) + )} + + + {extraMembers} + + + {/if} + {#if currentInvoice?.usage} + {#each currentInvoice.usage as excess, i} + {#if i > 0 || extraMembers} + + {/if} + {#if ['storage', 'bandwidth'].includes(excess.name)} + {@const excessValue = humanFileSize(excess.value)} + + + {usageNameToLabel( + excess.name + )} + {formatCurrency( + excess.amount + )} + + + + + + {formatNumberWithCommas( + excess.value ?? 0 + )} bytes + + {excessValue.value ?? + 0}{excessValue.unit} + + + + + {/if} + {#if ['users', 'executions'].includes(excess.name)} + + + {usageNameToLabel( + excess.name + )} + {formatCurrency( + excess.amount + )} + + + + + {formatNumberWithCommas(excess.value)} + + {abbreviateNumber(excess.value)} + + + + {/if} + {/each} + {/if} + + + {/if} -
      - {#if extraMembers} -
    • -
      -
      - Additional members -
      -
      - {formatCurrency( - extraMembers * - (currentPlan?.addons?.member?.price ?? - 0) - )} -
      -
      -
      -
      - {extraMembers} -
      -
      -
    • - {/if} - {#if currentInvoice?.usage} - {#each currentInvoice.usage as excess, i} -
    • 0 || extraMembers}> - {#if ['storage', 'bandwidth'].includes(excess.name)} - {@const excessValue = humanFileSize( - excess.value - )} -
      -
      - {excess.name} -
      - {formatCurrency(excess.amount)} -
      -
      - {excessValue.value ?? 0}{excessValue.unit} -
      - {/if} - {#if ['users', 'executions'].includes(excess.name)} -
      -
      - {excess.name} -
      - {formatCurrency(excess.amount)} -
      -
      - {abbreviateNumber(excess.value)} -
      - {/if} -
    • - {/each} - {/if} -
    -
    - {/if} + {#if $organization?.billingPlan !== BillingPlan.FREE && availableCredit > 0} + + + + Credits to be applied + + + {formatCurrency( + Math.min(availableCredit, currentInvoice?.amount ?? 0) + )} + + + {/if} - {#if $organization?.billingPlan !== BillingPlan.FREE && availableCredit > 0} - - - - - Credits to be applied - -
    - -{formatCurrency( - Math.min(availableCredit, currentInvoice?.amount ?? 0) - )} -
    -
    - {/if} - - {#if $organization?.billingPlan !== BillingPlan.FREE && $organization?.billingPlan !== BillingPlan.GITHUB_EDUCATION} - - Current total (USD) - - - -
    - {formatCurrency( - Math.max( - (currentInvoice?.amount ?? 0) - - Math.min( - availableCredit, - currentInvoice?.amount ?? 0 - ), - 0 - ) - )} -
    -
    - {/if} -
    -
    -
    + {#if $organization?.billingPlan !== BillingPlan.FREE && $organization?.billingPlan !== BillingPlan.GITHUB_EDUCATION} + + + + + Current total (USD) + + + + Estimates are updated daily and may differ from your + final invoice. + + + + + + {formatCurrency( + Math.max( + (currentInvoice?.amount ?? 0) - + Math.min(availableCredit, currentInvoice?.amount ?? 0), + 0 + ) + )} + + + {/if} + +
    {#if $organization?.billingPlan === BillingPlan.FREE || $organization?.billingPlan === BillingPlan.GITHUB_EDUCATION} diff --git a/src/routes/(console)/organization-[organization]/billing/replaceCard.svelte b/src/routes/(console)/organization-[organization]/billing/replaceCard.svelte index d432896e8..a4337aa06 100644 --- a/src/routes/(console)/organization-[organization]/billing/replaceCard.svelte +++ b/src/routes/(console)/organization-[organization]/billing/replaceCard.svelte @@ -5,7 +5,7 @@ import { sdk } from '$lib/stores/sdk'; import { organization } from '$lib/stores/organization'; import { Dependencies } from '$lib/constants'; - import { initializeStripe, isStripeInitialized, submitStripeCard } from '$lib/stores/stripe'; + import { submitStripeCard } from '$lib/stores/stripe'; import { onMount } from 'svelte'; import type { PaymentList } from '$lib/sdk/billing'; import { addNotification } from '$lib/stores/notifications'; @@ -90,14 +90,6 @@ $: filteredMethods = methods?.paymentMethods.filter((method) => !!method?.last4); - $: if (selectedPaymentMethodId === null && !$isStripeInitialized) { - initializeStripe(); - } - - $: if (selectedPaymentMethodId) { - isStripeInitialized.set(false); - } - $: if (!show) { selectedPaymentMethodId = null; } From 4e76c07a5cc5088c9b837c1ed03e5519eb4a92df Mon Sep 17 00:00:00 2001 From: ernstmul Date: Tue, 11 Mar 2025 10:52:04 +0100 Subject: [PATCH 106/187] WIP --- src/routes/(console)/supportWizard.svelte | 171 +++++++++++++++++----- 1 file changed, 136 insertions(+), 35 deletions(-) diff --git a/src/routes/(console)/supportWizard.svelte b/src/routes/(console)/supportWizard.svelte index d2e6a7fbc..c3d956e2a 100644 --- a/src/routes/(console)/supportWizard.svelte +++ b/src/routes/(console)/supportWizard.svelte @@ -1,4 +1,11 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + How can we help you? + Please describe your request in detail. If applicable, include steps for + reproduction of any in-app issues. + + + Choose a topic + + { + $supportData.category = 'general'; + }} + selected={$supportData.category === 'general'}>general + { + $supportData.category = 'billing'; + }} + selected={$supportData.category === 'billing'}>billing + { + $supportData.category = 'technical'; + }} + selected={$supportData.category === 'technical'}>technical + + + + + + + Submit + + + -

    Contact the Appwrite Team

    -

    - If you found a bug or have questions, please reach out to the Appwrite team. We try to - respond to all messages within our office hours. -

    -

    - Available: {supportWeekDays}, {supportTimings} -

    -
    - Currently: - {#if isSupportOnline()} -
    + + Contact the Appwrite Team + If you found a bug or have questions, please reach out to the Appwrite team. We try + to respond to all messages within our office hours. + + Available: + {supportWeekDays}, {supportTimings} + + + Currently: + {#if isSupportOnline()} + + + Online + {:else} + + + Offline + + {/if} + +
    -
    + From ad7d925c3910698be1c4cf3e466f096d0b4bf2c6 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 11 Mar 2025 11:01:15 +0100 Subject: [PATCH 107/187] feat: logs and settings --- src/lib/actions/analytics.ts | 1 + src/lib/components/permissions/roles.svelte | 2 +- .../executions/sheet.svelte | 62 ++++------ .../function-[function]/settings/+page.svelte | 12 +- .../settings/updateBuildCommand.svelte | 71 +++++++++++ .../settings/updatePermissions.svelte | 13 +- .../settings/updateRepository.svelte | 8 +- .../sites/site-[site]/+page.svelte | 25 ++-- .../sites/site-[site]/+page.ts | 15 ++- .../sites/site-[site]/deployments/store.ts | 4 +- .../site-[site]/instantRollbackModal.svelte | 113 +++++++++++------- .../settings/updateRepository.svelte | 8 +- 12 files changed, 216 insertions(+), 118 deletions(-) create mode 100644 src/routes/(console)/project-[project]/functions/function-[function]/settings/updateBuildCommand.svelte diff --git a/src/lib/actions/analytics.ts b/src/lib/actions/analytics.ts index 20db9c3a6..ff4fa94e5 100644 --- a/src/lib/actions/analytics.ts +++ b/src/lib/actions/analytics.ts @@ -293,6 +293,7 @@ export enum Submit { FunctionUpdateEvents = 'submit_function_update_events', FunctionUpdateScopes = 'submit_function_key_update_scopes', FunctionUpdateRuntime = 'submit_function_update_runtime', + FunctionUpdateBuildCommand = 'submit_function_update_build_command', FunctionConnectRepo = 'submit_function_connect_repo', FunctionDisconnectRepo = 'submit_function_disconnect_repo', FunctionRedeploy = 'submit_function_redeploy', diff --git a/src/lib/components/permissions/roles.svelte b/src/lib/components/permissions/roles.svelte index 8bb8743a2..83445ec99 100644 --- a/src/lib/components/permissions/roles.svelte +++ b/src/lib/components/permissions/roles.svelte @@ -107,7 +107,7 @@ on:create={create} let:toggle>
    - diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/executions/sheet.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/executions/sheet.svelte index 26c5b316e..6657a6fc0 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/executions/sheet.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/executions/sheet.svelte @@ -69,14 +69,8 @@ {#if selectedLog} - - + + Method @@ -100,26 +94,6 @@ : 'success'} /> - - - - Path - -
    - -
    -
    -
    - Status @@ -141,6 +115,16 @@ + + + + Triggered by + + + {capitalize(selectedLog.trigger)} + + + Duration @@ -149,14 +133,7 @@ {calculateTime(selectedLog.duration)} - - - Triggered - - - {capitalize(selectedLog.trigger)} - - + Created @@ -165,7 +142,18 @@ {capitalize(timeFromNow(selectedLog.$createdAt))} - +
    + + + Path + +
    + +
    +
    diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/+page.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/settings/+page.svelte index cd423a188..514359340 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/settings/+page.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/settings/+page.svelte @@ -18,6 +18,7 @@ import { Button } from '$lib/elements/forms'; import { Click, trackEvent } from '$lib/actions/analytics'; import UpdateRepository from './updateRepository.svelte'; + import UpdateBuildCommand from './updateBuildCommand.svelte'; export let data; let showAlert = true; @@ -76,10 +77,7 @@ {#key data.function.providerRepositoryId} {/key} - - - - + + + + + + + diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateBuildCommand.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateBuildCommand.svelte new file mode 100644 index 000000000..616259065 --- /dev/null +++ b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateBuildCommand.svelte @@ -0,0 +1,71 @@ + + + + + Build command + Define the command used to build your function before deployment. + + + + + + + + + diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updatePermissions.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updatePermissions.svelte index 67e461698..65cb5b134 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updatePermissions.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updatePermissions.svelte @@ -13,6 +13,7 @@ import { symmetricDifference } from '$lib/helpers/array'; import { isValueOfStringEnum } from '$lib/helpers/types'; import { Runtime } from '@appwrite.io/console'; + import { Link } from '$lib/elements'; const functionId = $page.params.function; @@ -72,14 +73,10 @@
    Execute access - Choose who can execute this function using the client API. Learn more about - - Permissions - . + Select who can execute this function using the client API. + + Learn more. diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateRepository.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateRepository.svelte index bc7c2359d..f639f3af7 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateRepository.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateRepository.svelte @@ -145,16 +145,16 @@ - + - + - - + + diff --git a/src/routes/(console)/project-[project]/sites/site-[site]/+page.svelte b/src/routes/(console)/project-[project]/sites/site-[site]/+page.svelte index 7aad5e733..80ec4e7ce 100644 --- a/src/routes/(console)/project-[project]/sites/site-[site]/+page.svelte +++ b/src/routes/(console)/project-[project]/sites/site-[site]/+page.svelte @@ -1,6 +1,6 @@ @@ -47,10 +47,20 @@ Visit {/if} - - + +
    + +
    + + Rollback is possible only if there is a deployment that is ready and was + active. + +
    {:else if data.deployment?.status === 'building'} @@ -98,5 +108,6 @@ + proxyRuleList={data.proxyRuleList} + prodReadyDeployments={data.prodReadyDeployments} /> {/if} diff --git a/src/routes/(console)/project-[project]/sites/site-[site]/+page.ts b/src/routes/(console)/project-[project]/sites/site-[site]/+page.ts index 1e6b4267b..16c38bd17 100644 --- a/src/routes/(console)/project-[project]/sites/site-[site]/+page.ts +++ b/src/routes/(console)/project-[project]/sites/site-[site]/+page.ts @@ -13,7 +13,8 @@ export const load = async ({ params, depends, parent }) => { sdk.forProject.sites.listDeployments(params.site, [Query.limit(4), Query.orderDesc('')]), sdk.forProject.sites.listDeployments(params.site, [ Query.equal('status', 'ready'), - Query.equal('activate', true) + Query.equal('activate', true), + Query.orderDesc('') ]), sdk.forProject.proxy.listRules([ Query.equal('type', RuleType.DEPLOYMENT), @@ -22,13 +23,17 @@ export const load = async ({ params, depends, parent }) => { Query.equal('deploymentId', site.deploymentId) ]) ]); + + const deployment = deploymentList?.total + ? await sdk.forProject.sites.getDeployment(params.site, site.deploymentId) + : null; return { site, deploymentList, - deployment: deploymentList?.total - ? await sdk.forProject.sites.getDeployment(params.site, site.deploymentId) - : null, + deployment, proxyRuleList, - hasProdReadyDeployments: prodReadyDeployments?.deployments?.length > 0 + prodReadyDeployments, + hasProdReadyDeployments: + prodReadyDeployments?.deployments?.filter((d) => d?.$id !== deployment?.$id).length > 0 }; }; diff --git a/src/routes/(console)/project-[project]/sites/site-[site]/deployments/store.ts b/src/routes/(console)/project-[project]/sites/site-[site]/deployments/store.ts index 055c2af08..1fba88f94 100644 --- a/src/routes/(console)/project-[project]/sites/site-[site]/deployments/store.ts +++ b/src/routes/(console)/project-[project]/sites/site-[site]/deployments/store.ts @@ -43,7 +43,7 @@ export const columns = writable([ id: 'sourceSize', title: 'Source size', type: 'integer', - show: true, + show: false, width: 140, elements: [ { @@ -64,7 +64,7 @@ export const columns = writable([ id: 'buildSize', title: 'Build size', type: 'integer', - show: false, + show: true, filter: false, width: 80 }, diff --git a/src/routes/(console)/project-[project]/sites/site-[site]/instantRollbackModal.svelte b/src/routes/(console)/project-[project]/sites/site-[site]/instantRollbackModal.svelte index 90a6fc1e2..874fea7ad 100644 --- a/src/routes/(console)/project-[project]/sites/site-[site]/instantRollbackModal.svelte +++ b/src/routes/(console)/project-[project]/sites/site-[site]/instantRollbackModal.svelte @@ -1,7 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - How can we help you? - Please describe your request in detail. If applicable, include steps for - reproduction of any in-app issues. - - - Choose a topic - - + + + + How can we help you? + Please describe your request in detail. If applicable, include steps for + reproduction of any in-app issues. + + + Choose a topic + + { + $supportData.category = 'general'; + }} + selected={$supportData.category === 'general'}>general + { + $supportData.category = 'billing'; + }} + selected={$supportData.category === 'billing'}>billing + { + $supportData.category = 'technical'; + }} + selected={$supportData.category === 'technical'}>technical + + + + + + + { - $supportData.category = 'general'; - }} - selected={$supportData.category === 'general'}>general - { - $supportData.category = 'billing'; - }} - selected={$supportData.category === 'billing'}>billing - { - $supportData.category = 'technical'; - }} - selected={$supportData.category === 'technical'}>technical + wizard.hide(); + }}>Cancel + Submit - - - - - Submit - - + From 6ceada073b5987056ddfbfb7d3f62ce24b8e9c0d Mon Sep 17 00:00:00 2001 From: ernstmul Date: Tue, 11 Mar 2025 11:15:24 +0100 Subject: [PATCH 109/187] Add card for aside --- src/routes/(console)/supportWizard.svelte | 50 ++++++++++++----------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/src/routes/(console)/supportWizard.svelte b/src/routes/(console)/supportWizard.svelte index 1caae890a..865260851 100644 --- a/src/routes/(console)/supportWizard.svelte +++ b/src/routes/(console)/supportWizard.svelte @@ -1,6 +1,6 @@ - - - How can we help you? - - Please describe your request in detail. If applicable, include steps for reproduction of any - in-app issues. - -
    -

    Choose a topic

    -
    - {#each ['general', 'billing', 'technical'] as topic} - { - $supportData.category = topic; - }}>{topic} - {/each} -
    -
    -
    - - {#if options?.length} - - {/if} - - - - -
    -
    From 72a36494b5046b63a3366d3654012e3c3d848dd4 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 11 Mar 2025 11:34:09 +0100 Subject: [PATCH 112/187] feat: function settings --- .../function-[function]/settings/+page.svelte | 7 +- .../function-[function]/settings/+page.ts | 5 +- .../settings/dangerZone.svelte | 3 +- .../settings/updateEvents.svelte | 78 +++++---------- .../settings/updateLogging.svelte | 23 ++--- .../settings/updateResourceLimits.svelte | 98 +++++++++++++++++++ .../settings/updateSchedule.svelte | 11 +-- .../settings/updateScopes.svelte | 8 +- .../settings/updateTimeout.svelte | 2 +- .../overview/keys/scopes.svelte | 6 +- .../webhooks/[webhook]/updateEvents.svelte | 1 - .../sites/site-[site]/settings/+page.svelte | 7 +- .../sites/site-[site]/settings/+page.ts | 17 ++-- .../settings/updateResourceLimits.svelte | 94 ++++++++++++++++++ 14 files changed, 263 insertions(+), 97 deletions(-) create mode 100644 src/routes/(console)/project-[project]/functions/function-[function]/settings/updateResourceLimits.svelte create mode 100644 src/routes/(console)/project-[project]/sites/site-[site]/settings/updateResourceLimits.svelte diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/+page.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/settings/+page.svelte index 514359340..e943e5701 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/settings/+page.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/settings/+page.svelte @@ -19,6 +19,8 @@ import { Click, trackEvent } from '$lib/actions/analytics'; import UpdateRepository from './updateRepository.svelte'; import UpdateBuildCommand from './updateBuildCommand.svelte'; + import UpdateResourceLimits from './updateResourceLimits.svelte'; + import { isCloud } from '$lib/system'; export let data; let showAlert = true; @@ -89,10 +91,13 @@ - + {#if isCloud} + + {/if} + diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/+page.ts b/src/routes/(console)/project-[project]/functions/function-[function]/settings/+page.ts index ee116f432..e4ec0997b 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/settings/+page.ts +++ b/src/routes/(console)/project-[project]/functions/function-[function]/settings/+page.ts @@ -5,7 +5,7 @@ export const load = async ({ params, depends, parent }) => { depends(Dependencies.VARIABLES); depends(Dependencies.FUNCTION); - const { runtimesList } = await parent(); + const { runtimesList, specificationsList } = await parent(); const [globalVariables, variables] = await Promise.all([ sdk.forProject.projectApi.listVariables(), @@ -33,6 +33,7 @@ export const load = async ({ params, depends, parent }) => { return { variables, globalVariables, - runtimesList + runtimesList, + specificationsList }; }; diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/dangerZone.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/settings/dangerZone.svelte index 20af9413e..1152f0337 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/settings/dangerZone.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/settings/dangerZone.svelte @@ -11,8 +11,7 @@ Delete function - The function will be permanently deleted, including all deployments associated with it. This action - is irreversible. + The function will be permanently deleted, including all deployments associated with it. diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateEvents.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateEvents.svelte index e191289b1..e6a711559 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateEvents.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateEvents.svelte @@ -1,14 +1,11 @@ + +
    + + Resource limits + Define your function's compute specifications, including CPU and memory, to optimize performance + for your workloads. + Learn more + . + + + {#if isCloud && $organization.billingPlan === BillingPlan.FREE} + + Upgrade to Pro or Scale to adjust your CPU and RAM beyond the default. + + + + + {/if} + + + + + + + diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateSchedule.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateSchedule.svelte index 6eb076eff..160c0c2fe 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateSchedule.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateSchedule.svelte @@ -11,6 +11,7 @@ import { func } from '../store'; import { isValueOfStringEnum } from '$lib/helpers/types'; import { Runtime } from '@appwrite.io/console'; + import { Link } from '$lib/elements'; const functionId = $page.params.function; let functionSchedule: string = null; @@ -63,18 +64,14 @@ Schedule Set a Cron schedule to trigger your function. Leave blank for no schedule. - - More details on Cron syntax here + Learn more. diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateScopes.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateScopes.svelte index a418a5b12..f5191feee 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateScopes.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateScopes.svelte @@ -13,6 +13,7 @@ import { Runtime } from '@appwrite.io/console'; import Scopes from '$routes/(console)/project-[project]/overview/keys/scopes.svelte'; import { symmetricDifference } from '$lib/helpers/array'; + import { Link } from '$lib/elements'; const functionId = $page.params.function; let functionScopes: string[] = null; @@ -68,11 +69,8 @@ Scopes Select scopes to grant the dynamic key generated temporarily for your function. It is best practice to allow only necessary permissions. - Learn moreLearn more. {#if functionScopes !== null} diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateTimeout.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateTimeout.svelte index 7b1abea85..5ab47da82 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateTimeout.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateTimeout.svelte @@ -62,7 +62,7 @@
    Timeout - Limit the execution time of your function. Maximum value is 900 seconds (15 minutes). + Limit the execution time of your function. The maximum value is 900 seconds (15 minutes). - import { Collapsible, CollapsibleItem } from '$lib/components'; - import { Button, FormList, InputChoice } from '$lib/elements/forms'; + import { Button } from '$lib/elements/forms'; import { scopes as allScopes } from '$lib/constants'; import { onMount } from 'svelte'; import { symmetricDifference } from '$lib/helpers/array'; - import Checkbox from './checkbox.svelte'; - import { Accordion, Divider, Input, Layout, Selector } from '@appwrite.io/pink-svelte'; + import { Accordion, Divider, Layout, Selector } from '@appwrite.io/pink-svelte'; export let scopes: string[]; diff --git a/src/routes/(console)/project-[project]/settings/webhooks/[webhook]/updateEvents.svelte b/src/routes/(console)/project-[project]/settings/webhooks/[webhook]/updateEvents.svelte index 0de4e2ac2..b82d94596 100644 --- a/src/routes/(console)/project-[project]/settings/webhooks/[webhook]/updateEvents.svelte +++ b/src/routes/(console)/project-[project]/settings/webhooks/[webhook]/updateEvents.svelte @@ -5,7 +5,6 @@ import { CardGrid, Empty, EventModal } from '$lib/components'; import { Dependencies } from '$lib/constants'; import { Button, Form } from '$lib/elements/forms'; - import { TableCell, TableCellText, TableList } from '$lib/elements/table'; import { symmetricDifference } from '$lib/helpers/array'; import { addNotification } from '$lib/stores/notifications'; import { sdk } from '$lib/stores/sdk'; diff --git a/src/routes/(console)/project-[project]/sites/site-[site]/settings/+page.svelte b/src/routes/(console)/project-[project]/sites/site-[site]/settings/+page.svelte index c554e38fd..dc90d58f4 100644 --- a/src/routes/(console)/project-[project]/sites/site-[site]/settings/+page.svelte +++ b/src/routes/(console)/project-[project]/sites/site-[site]/settings/+page.svelte @@ -13,6 +13,8 @@ import UpdateRepository from './updateRepository.svelte'; import { onMount } from 'svelte'; import { showConnectRepo } from './store'; + import { isCloud } from '$lib/system'; + import UpdateResourceLimits from './updateResourceLimits.svelte'; export let data; @@ -60,6 +62,7 @@ {/key} + - + {#if isCloud} + + {/if} diff --git a/src/routes/(console)/project-[project]/sites/site-[site]/settings/+page.ts b/src/routes/(console)/project-[project]/sites/site-[site]/settings/+page.ts index 10a99557a..3a46b9873 100644 --- a/src/routes/(console)/project-[project]/sites/site-[site]/settings/+page.ts +++ b/src/routes/(console)/project-[project]/sites/site-[site]/settings/+page.ts @@ -6,12 +6,14 @@ export const load = async ({ params, depends, parent }) => { depends(Dependencies.SITE); const { site } = await parent(); - const [globalVariables, variables, frameworks, installations] = await Promise.all([ - sdk.forProject.projectApi.listVariables(), - sdk.forProject.sites.listVariables(params.site), - sdk.forProject.sites.listFrameworks(), - sdk.forProject.vcs.listInstallations() - ]); + const [globalVariables, variables, frameworks, installations, specificationsList] = + await Promise.all([ + sdk.forProject.projectApi.listVariables(), + sdk.forProject.sites.listVariables(params.site), + sdk.forProject.sites.listFrameworks(), + sdk.forProject.vcs.listInstallations(), + sdk.forProject.sites.listSpecifications() + ]); // Conflicting variables first variables.variables = variables.variables.sort((var1, var2) => { @@ -36,6 +38,7 @@ export const load = async ({ params, depends, parent }) => { frameworks, variables, globalVariables, - installations + installations, + specificationsList }; }; diff --git a/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateResourceLimits.svelte b/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateResourceLimits.svelte new file mode 100644 index 000000000..8f9cc8285 --- /dev/null +++ b/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateResourceLimits.svelte @@ -0,0 +1,94 @@ + + + + + Resource limits + Define your sites's compute specifications, including CPU and memory, to optimize performance + for your workloads. + Learn more + . + + + {#if isCloud && $organization.billingPlan === BillingPlan.FREE} + + Upgrade to Pro or Scale to adjust your CPU and RAM beyond the default. + + + + + {/if} + + + + + + + From 682ac55ae4a3d4b8ed360771bafec97d0724f037 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 11 Mar 2025 11:47:16 +0100 Subject: [PATCH 113/187] design review: funciton review --- .../connectRepoModal.svelte | 0 .../function-[function]/domains/+page.svelte | 200 +++++++++++- .../function-[function]/domains/+page.ts | 6 +- .../domains/add-domain/+page.svelte | 296 ++++++++++++++++++ .../domains/add-domain/+page.ts | 28 ++ .../domains/add-domain/verify/+page.svelte | 182 +++++++++++ .../domains/add-domain/verify/+page.ts | 16 + .../domains/createAppwriteDomainModal.svelte | 104 ++++++ .../domains/deleteDomainModal.svelte | 54 ++++ .../domains/recordsCard.svelte | 52 +++ .../domains/retryDomainModal.svelte | 46 +++ .../settings/updateRepository.svelte | 2 +- 12 files changed, 976 insertions(+), 10 deletions(-) rename src/routes/(console)/project-[project]/functions/function-[function]/{settings => (modals)}/connectRepoModal.svelte (100%) create mode 100644 src/routes/(console)/project-[project]/functions/function-[function]/domains/add-domain/+page.svelte create mode 100644 src/routes/(console)/project-[project]/functions/function-[function]/domains/add-domain/+page.ts create mode 100644 src/routes/(console)/project-[project]/functions/function-[function]/domains/add-domain/verify/+page.svelte create mode 100644 src/routes/(console)/project-[project]/functions/function-[function]/domains/add-domain/verify/+page.ts create mode 100644 src/routes/(console)/project-[project]/functions/function-[function]/domains/createAppwriteDomainModal.svelte create mode 100644 src/routes/(console)/project-[project]/functions/function-[function]/domains/deleteDomainModal.svelte create mode 100644 src/routes/(console)/project-[project]/functions/function-[function]/domains/recordsCard.svelte create mode 100644 src/routes/(console)/project-[project]/functions/function-[function]/domains/retryDomainModal.svelte diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/connectRepoModal.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/(modals)/connectRepoModal.svelte similarity index 100% rename from src/routes/(console)/project-[project]/functions/function-[function]/settings/connectRepoModal.svelte rename to src/routes/(console)/project-[project]/functions/function-[function]/(modals)/connectRepoModal.svelte diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/domains/+page.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/domains/+page.svelte index 603219642..d29e991b3 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/domains/+page.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/domains/+page.svelte @@ -1,14 +1,198 @@ - - Domains - + + + + + + + + Custom domain + + (showAppwriteDomainModal = true)}> + Appwrite domain + + + + + + + {#if data.domains.total} + + + Domain + Redirect to + Production branch + + + {#each data.domains.rules as domain} + + + + + {domain.domain} + + + + + + {domain?.redirectUrl || 'No redirect'} + {domain?.redirectStatusCode ? `(${domain.redirectStatusCode})` : ''} + + + {domain.deploymentVcsProviderBranch || '-'} + + + + + + + + + {#if domain.status !== 'verified'} + { + e.preventDefault(); + selectedDomain = domain; + showRetry = true; + toggle(e); + }}> + Retry + + {/if} + { + e.preventDefault(); + selectedDomain = domain; + showDelete = true; + toggle(e); + trackEvent(Click.DomainDeleteClick, { + source: 'functions_domain_overview' + }); + }}> + Delete + + + + + + + + {/each} + + + + {:else if data?.search} + + + + + + {:else} + + + + + + + + + + {/if} + +{#if showDelete} + +{/if} + +{#if showRetry} + +{/if} + +{#if showAppwriteDomainModal} + +{/if} diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/domains/+page.ts b/src/routes/(console)/project-[project]/functions/function-[function]/domains/+page.ts index 734917a54..8f39e94d8 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/domains/+page.ts +++ b/src/routes/(console)/project-[project]/functions/function-[function]/domains/+page.ts @@ -22,7 +22,11 @@ export const load: PageLoad = async ({ depends, params, url, route }) => { queries.set(parsedQueries); return { - rules: await sdk.forProject.proxy.listRules( + offset, + limit, + query, + search, + domains: await sdk.forProject.proxy.listRules( [ Query.equal('type', [RuleType.DEPLOYMENT, RuleType.REDIRECT]), Query.equal('deploymentResourceType', DeploymentResourceType.FUNCTION), diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/domains/add-domain/+page.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/domains/add-domain/+page.svelte new file mode 100644 index 000000000..18f0b5eec --- /dev/null +++ b/src/routes/(console)/project-[project]/functions/function-[function]/domains/add-domain/+page.svelte @@ -0,0 +1,296 @@ + + + +
    + +
    + + +
    + + + + Connect this domain to your active deployment and configure the linked Git + branch as needed. + + + Automatically forward traffic from this domain to another URL of your choice. + + + + {#if behaviour === 'CREATE'} +
    + + {#if data.branches?.total} + {@const sortedBranches = sortBranches(data.branches.branches)} + {@const options = sortedBranches.map((branch) => ({ + label: branch.name, + value: branch.name + }))} + + {:else} + + + + +

    + The domain will be connected to your active deployment. + Connect your Git repository to link a production branch. +

    +
    + +
    +
    +
    + {/if} +
    +
    + + + {:else if behaviour === 'REDIRECT'} +
    + + + + + + Redirect this domain. Domains added to your project will be + listed here. + + + + + +
    + {/if} +
    + + + + + +
    + +{#if showConnectRepo} + +{/if} diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/domains/add-domain/+page.ts b/src/routes/(console)/project-[project]/functions/function-[function]/domains/add-domain/+page.ts new file mode 100644 index 000000000..1105f8445 --- /dev/null +++ b/src/routes/(console)/project-[project]/functions/function-[function]/domains/add-domain/+page.ts @@ -0,0 +1,28 @@ +import { Query } from '@appwrite.io/console'; +import { sdk } from '$lib/stores/sdk'; +import { RuleTrigger, RuleType } from '$lib/stores/sdk'; + +export const load = async ({ parent }) => { + const { site } = await parent(); + + const [domains, installations] = await Promise.all([ + sdk.forProject.proxy.listRules([ + Query.equal('type', RuleType.DEPLOYMENT), + Query.equal('trigger', RuleTrigger.MANUAL) + ]), + sdk.forProject.vcs.listInstallations() + ]); + + return { + site, + domains, + installations, + branches: + site?.installationId && site?.providerRepositoryId + ? await sdk.forProject.vcs.listRepositoryBranches( + site.installationId, + site.providerRepositoryId + ) + : undefined + }; +}; diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/domains/add-domain/verify/+page.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/domains/add-domain/verify/+page.svelte new file mode 100644 index 000000000..88289f579 --- /dev/null +++ b/src/routes/(console)/project-[project]/functions/function-[function]/domains/add-domain/verify/+page.svelte @@ -0,0 +1,182 @@ + + + + {#if isVerified} + + + {data.domain.domain} + + + + {:else} +
    + +
    + + (selectedTab = 'cname')} + active={selectedTab === 'cname'}> + CNAME + + (selectedTab = 'nameserver')} + active={selectedTab === 'nameserver'}> + Nameservers + + + +
    + {#if selectedTab === 'cname'} + + + {data.domain?.domain} + {#if isVerified} + + {:else} + + {/if} + + + Add the following record on your DNS provider. Note that DNS changes may + take time to propagate fully. + + + + + + Type + Name + Value + + + CNAME + {data.domain?.domain} + + + {globalThis?.location?.origin} + + + + + + + A list of all domain providers and their DNS setting is available here. + + + + + + + + {:else} + + + {data.domain?.domain} + + + + Add the following nameservers on your DNS provider. Note that DNS + changes may take time to propagate fully. + + + + + + Type + Value + + {#each nameservers as nameserver} + + NS + + + {nameserver} + + + {/each} + + + + + + + + {/if} +
    +
    + {/if} +
    diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/domains/add-domain/verify/+page.ts b/src/routes/(console)/project-[project]/functions/function-[function]/domains/add-domain/verify/+page.ts new file mode 100644 index 000000000..eab359a42 --- /dev/null +++ b/src/routes/(console)/project-[project]/functions/function-[function]/domains/add-domain/verify/+page.ts @@ -0,0 +1,16 @@ +import { sdk } from '$lib/stores/sdk'; +import { isCloud } from '$lib/system'; + +export const load = async ({ params }) => { + if (isCloud) { + // if (params?.id) { + // return { + // domain: await sdk.forConsole.domains.get(params.id) + // }; + // } + } else { + return { + domain: undefined + }; + } +}; diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/domains/createAppwriteDomainModal.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/domains/createAppwriteDomainModal.svelte new file mode 100644 index 000000000..34338c0ea --- /dev/null +++ b/src/routes/(console)/project-[project]/functions/function-[function]/domains/createAppwriteDomainModal.svelte @@ -0,0 +1,104 @@ + + + + + Get an auto-generated domain to quickly access your project. You can customize its prefix. + + + + + + + + .{$consoleVariables._APP_DOMAIN_TARGET} + + + + + + + + + + + + diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/domains/deleteDomainModal.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/domains/deleteDomainModal.svelte new file mode 100644 index 000000000..cbfc54944 --- /dev/null +++ b/src/routes/(console)/project-[project]/functions/function-[function]/domains/deleteDomainModal.svelte @@ -0,0 +1,54 @@ + + + + {#if selectedDomain} + + Are you sure you want to delete this domain? You will no longer be able to execute your + function by visiting: + + + {selectedDomain.domain} + + {/if} + + + + + + diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/domains/recordsCard.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/domains/recordsCard.svelte new file mode 100644 index 000000000..23beba2cd --- /dev/null +++ b/src/routes/(console)/project-[project]/functions/function-[function]/domains/recordsCard.svelte @@ -0,0 +1,52 @@ + + +
    + + + + + {domain?.domain} + + + + Add the following nameservers on your DNS provider. Note that DNS changes may + take time to propagate fully. + + + + + + Type + Name + Value + + + CNAME + {domain?.domain} + + {globalThis?.location?.origin} + + + + + + + A list of all domain providers and their DNS setting is available here. + + + + + +
    diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/domains/retryDomainModal.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/domains/retryDomainModal.svelte new file mode 100644 index 000000000..0afc74175 --- /dev/null +++ b/src/routes/(console)/project-[project]/functions/function-[function]/domains/retryDomainModal.svelte @@ -0,0 +1,46 @@ + + + + {#if selectedDomain} + + {/if} + + + + + + diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateRepository.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateRepository.svelte index f639f3af7..10fd6810f 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateRepository.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateRepository.svelte @@ -26,7 +26,7 @@ import { IconGithub } from '@appwrite.io/pink-icons-svelte'; import { ConnectGit } from '$lib/components/git'; import { isValueOfStringEnum } from '$lib/helpers/types'; - import ConnectRepoModal from './connectRepoModal.svelte'; + import ConnectRepoModal from '../(modals)/connectRepoModal.svelte'; export let func: Models.Function; export let installations: Models.InstallationList; From cada0b1342b6d9db8581238a2adcd980a809ab68 Mon Sep 17 00:00:00 2001 From: ernstmul Date: Tue, 11 Mar 2025 13:37:33 +0100 Subject: [PATCH 114/187] WIP --- src/lib/helpers/flag.ts | 8 ++ src/lib/layout/createProject.svelte | 80 ++++++++++++++++ .../onboarding/create-project/+page.svelte | 95 +++---------------- .../createProjectCloud.svelte | 16 ++-- 4 files changed, 111 insertions(+), 88 deletions(-) create mode 100644 src/lib/helpers/flag.ts create mode 100644 src/lib/layout/createProject.svelte diff --git a/src/lib/helpers/flag.ts b/src/lib/helpers/flag.ts new file mode 100644 index 000000000..a2e8e9d86 --- /dev/null +++ b/src/lib/helpers/flag.ts @@ -0,0 +1,8 @@ +import { isValueOfStringEnum } from '$lib/helpers/types'; +import { Flag } from '@appwrite.io/console'; +import { sdk } from '$lib/stores/sdk'; + +export function getFlagUrl(countryCode: string) { + if (!isValueOfStringEnum(Flag, countryCode)) return ''; + return sdk.forProject.avatars.getFlag(countryCode, 22, 15, 100)?.toString(); +} diff --git a/src/lib/layout/createProject.svelte b/src/lib/layout/createProject.svelte new file mode 100644 index 000000000..a844d44f3 --- /dev/null +++ b/src/lib/layout/createProject.svelte @@ -0,0 +1,80 @@ + + +
    + + Create your project + + + + + {#if !showCustomId} +
    + { + showCustomId = true; + }}> Project ID +
    + {/if} + +
    + {#if isCloud && regions.length > 0} + + Region cannot be changed after creation + + {/if} +
    +
    + + Create + +
    + diff --git a/src/routes/(console)/onboarding/create-project/+page.svelte b/src/routes/(console)/onboarding/create-project/+page.svelte index 3490f6d65..e3a1caa4f 100644 --- a/src/routes/(console)/onboarding/create-project/+page.svelte +++ b/src/routes/(console)/onboarding/create-project/+page.svelte @@ -1,7 +1,5 @@ @@ -144,57 +118,14 @@ height="22" class="u-only-dark" alt="Appwrite Logo" /> -
    - - Create your project - - - - - - {#if !showCustomId} -
    - { - showCustomId = true; - }}> Project ID -
    - {/if} - -
    - {#if data.regions} - - Region cannot be changed after creation - - {/if} -
    -
    - - Create - -
    -
    + + {/if}
    diff --git a/src/routes/(console)/organization-[organization]/createProjectCloud.svelte b/src/routes/(console)/organization-[organization]/createProjectCloud.svelte index c42d662c6..ec03cce96 100644 --- a/src/routes/(console)/organization-[organization]/createProjectCloud.svelte +++ b/src/routes/(console)/organization-[organization]/createProjectCloud.svelte @@ -1,5 +1,5 @@ - +ayyy + + + + + + From 7eed9d13e35447a3e309c97bb66b8ac674f07979 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 11 Mar 2025 16:02:07 +0100 Subject: [PATCH 115/187] fix: build settigs tab --- pnpm-lock.yaml | 28 ++--- .../sites/site-[site]/settings/store.ts | 90 ++++++++++++++ .../settings/updateBuildSettings.svelte | 114 ++++++++++++------ 3 files changed, 184 insertions(+), 48 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f8ed5a167..4ffde2176 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,14 +15,14 @@ importers: specifier: 0.25.0 version: 0.25.0 '@appwrite.io/pink-icons-svelte': - specifier: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@525e5be8 - version: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@525e5be8(svelte@4.2.19) + specifier: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@3fd919a0 + version: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@3fd919a0(svelte@4.2.19) '@appwrite.io/pink-legacy': specifier: ^1.0.2 version: 1.0.2 '@appwrite.io/pink-svelte': - specifier: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@30b0f25 - version: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@30b0f25(react-dom@18.3.1(react@18.3.1))(svelte@4.2.19) + specifier: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@3fd919a0 + version: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@3fd919a0(react-dom@18.3.1(react@18.3.1))(svelte@4.2.19) '@popperjs/core': specifier: ^2.11.8 version: 2.11.8 @@ -215,14 +215,14 @@ packages: resolution: {tarball: https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@640f09c} version: 1.2.1 - '@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@30b0f25a639a53ffae787fda44a57e1335cc2d1c': - resolution: {tarball: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@30b0f25a639a53ffae787fda44a57e1335cc2d1c} + '@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@3fd919a0': + resolution: {tarball: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@3fd919a0} version: 1.0.0-next.7 peerDependencies: svelte: ^4.0.0 - '@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@525e5be8': - resolution: {tarball: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@525e5be8} + '@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@3fd919a00b71d85d8b630f22953d28aa28ae0050': + resolution: {tarball: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@3fd919a00b71d85d8b630f22953d28aa28ae0050} version: 1.0.0-next.7 peerDependencies: svelte: ^4.0.0 @@ -236,8 +236,8 @@ packages: '@appwrite.io/pink-legacy@1.0.2': resolution: {integrity: sha512-1AYNcfbV+x0Tyj56CoieSq5g7+u+7F5/LDVN/z+Hx1kp9gj7xc1eT39Dy832xxfihImF6ksjp0FXEMVSBR8cew==} - '@appwrite.io/pink-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@30b0f25': - resolution: {tarball: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@30b0f25} + '@appwrite.io/pink-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@3fd919a0': + resolution: {tarball: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@3fd919a0} version: 1.0.0-next.85 peerDependencies: react-dom: ^18.0.0 @@ -4099,11 +4099,11 @@ snapshots: '@appwrite.io/console@https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@640f09c': {} - '@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@30b0f25a639a53ffae787fda44a57e1335cc2d1c(svelte@4.2.19)': + '@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@3fd919a0(svelte@4.2.19)': dependencies: svelte: 4.2.19 - '@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@525e5be8(svelte@4.2.19)': + '@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@3fd919a00b71d85d8b630f22953d28aa28ae0050(svelte@4.2.19)': dependencies: svelte: 4.2.19 @@ -4116,9 +4116,9 @@ snapshots: '@appwrite.io/pink-icons': 1.0.0 the-new-css-reset: 1.11.3 - '@appwrite.io/pink-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@30b0f25(react-dom@18.3.1(react@18.3.1))(svelte@4.2.19)': + '@appwrite.io/pink-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@3fd919a0(react-dom@18.3.1(react@18.3.1))(svelte@4.2.19)': dependencies: - '@appwrite.io/pink-icons-svelte': https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@30b0f25a639a53ffae787fda44a57e1335cc2d1c(svelte@4.2.19) + '@appwrite.io/pink-icons-svelte': https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@3fd919a00b71d85d8b630f22953d28aa28ae0050(svelte@4.2.19) '@floating-ui/dom': 1.6.13 '@melt-ui/pp': 0.3.2(@melt-ui/svelte@0.86.3(svelte@4.2.19))(svelte@4.2.19) '@melt-ui/svelte': 0.86.3(svelte@4.2.19) diff --git a/src/routes/(console)/project-[project]/sites/site-[site]/settings/store.ts b/src/routes/(console)/project-[project]/sites/site-[site]/settings/store.ts index 7b0c5c905..d903d3239 100644 --- a/src/routes/(console)/project-[project]/sites/site-[site]/settings/store.ts +++ b/src/routes/(console)/project-[project]/sites/site-[site]/settings/store.ts @@ -1,3 +1,93 @@ import { writable } from 'svelte/store'; export const showConnectRepo = writable(false); + +export const adapterDataList = [ + { + framework: 'sveltekit', + ssr: { + desc: 'Use $ adapter in $ file.', + code: ['@sveltejs/adapter-node', 'svelte.config.js'], + url: 'https://kit.svelte.dev/docs#adapter-node' + }, + static: { + desc: 'Use $ adapter in $ file.', + code: ['@sveltejs/adapter-static', 'svelte.config.js'], + url: 'https://kit.svelte.dev/docs#adapter-static' + } + }, + { + framework: 'astro', + ssr: { + desc: 'Use $ adapter in $ file.', + code: ['@astro/node', 'astro.config.mjs'], + url: 'https://docs.astro.build/en/guides/server-side-rendering/' + }, + static: { + desc: "Ensure you don't set $ adapter in $ file.", + code: ['adapter', 'astro.config.mjs'], + url: 'https://docs.astro.build/en/guides/deploy/' + } + }, + { + framework: 'remix', + ssr: { + desc: 'Ensure $ file uses $ package.', + code: ['entry.server.tsx', '@remix-run/node'] + }, + static: { + desc: 'Set $ in $ plugin in $ file.', + code: ['ssr: false', 'remix', 'vite.config.ts'] + } + }, + { + framework: 'nuxt', + ssr: { + desc: 'Set build command to $ in site settings.', + code: ['npm run build'], + url: 'https://nuxt.com/docs/getting-started/deployment' + }, + static: { + desc: 'Set build command to $ in site settings.', + code: ['npm run generate'], + url: 'https://nuxt.com/docs/getting-started/deployment#static-hosting' + } + }, + { + framework: 'next', + ssr: { + desc: "Ensure you don't set $ in $ file.", + code: ['output', 'next.config.js'], + url: 'https://nextjs.org/docs/pages/building-your-application/deploying' + }, + static: { + desc: 'Set $ in $ file', + code: ["output: 'export'", 'next.config.js'], + url: 'https://nextjs.org/docs/pages/building-your-application/deploying/static-exports' + } + }, + { + framework: 'analog', + ssr: { + desc: 'Set $ in $ plugin in $', + code: ['ssr: true', 'analog', 'vite.config.ts'], + url: 'https://analogjs.org/docs/features/server/server-side-rendering' + }, + static: { + desc: 'Set $ in $ plugin in $', + code: ['static: true', 'analog', 'vite.config.ts'], + url: 'https://analogjs.org/docs/features/server/static-site-generation' + } + }, + { + framework: 'angular', + ssr: { + desc: 'Ensure $ file uses $ package.', + code: ['src/server.ts', '@angular/ssr/node'], + url: 'https://angular.dev/guide/ssr' + }, + static: { + desc: "Angular's default build is static. No further action needed." + } + } +]; diff --git a/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateBuildSettings.svelte b/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateBuildSettings.svelte index 93bfad25d..2609399f0 100644 --- a/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateBuildSettings.svelte +++ b/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateBuildSettings.svelte @@ -13,24 +13,25 @@ import { getFrameworkIcon } from '../../store'; import { Link } from '$lib/elements'; import { IconInfo } from '@appwrite.io/pink-icons-svelte'; + import { adapterDataList } from './store'; export let site: Models.Site; export let frameworks: Models.Framework[]; - let selectedFramework: Models.Framework = null; + let selectedFramework: Models.Framework = frameworks.find( + (framework) => framework.key === site.framework + ); + let frameworkKey = site.framework; + let adapter: Adapter = site.adapter as Adapter; let installCommand = undefined; let buildCommand = undefined; let outputDirectory = undefined; - let frameworkKey = site.framework; - let adapter: Adapter = site.adapter as Adapter; let fallback = site.fallbackFile; let isButtonDisabled = true; let showFallback = site.adapter === Adapter.Static; onMount(async () => { - selectedFramework ??= frameworks.find((framework) => framework.key === site.framework); - - installCommand = - site?.installCommand ?? selectedFramework.adapters[site.adapter].defaultInstallCommand; + installCommand ??= installCommand = + site?.installCommand ?? selectedFramework.adapters[site.adapter].installCommand; buildCommand = site?.buildCommand ?? selectedFramework.adapters[site.adapter].defaultBuildCommand; outputDirectory = @@ -73,7 +74,6 @@ } } - $: frameworkData = frameworks.find((framework) => framework.key === frameworkKey); $: if ( installCommand === site?.installCommand && buildCommand === site?.buildCommand && @@ -89,17 +89,28 @@ $: if (adapter === Adapter.Static) { showFallback = true; + fallback ||= selectedFramework.adapters.static.fallbackFile; + console.log(fallback, selectedFramework.adapters.static); } else { showFallback = false; + fallback = undefined; } $: if (fallback === '') { fallback = null; } - $: frameworkDataAdapter = frameworkData.adapters?.length - ? frameworkData.adapters[site.adapter] + $: frameworkDataAdapter = selectedFramework.adapters?.length + ? selectedFramework.adapters[site.adapter] : frameworks[0].adapters[site.adapter]; + + //TODO: fix after backend type is fixed + $: if (selectedFramework?.adapters?.length <= 1 || !selectedFramework?.adapters?.ssr?.key) { + adapter = Adapter.Static; + } + $: if (selectedFramework?.adapters?.length <= 1 || !selectedFramework?.adapters?.static?.key) { + adapter = Adapter.Ssr; + }
    @@ -108,6 +119,9 @@ Default build settings are configured based on your framework, ensuring optimal performance. Adjust the settings here if needed. + {@const adapterData = adapterDataList.find( + (adapterData) => adapterData.framework === frameworkKey.toLowerCase() + )} framework.key === frameworkKey ); }} /> - - - Use adapter in your {frameworkData.name} - config file. Learn more. - - - Use adapter in your {frameworkData.name} - config file. Learn more. - - + {#if selectedFramework.adapters?.length || (selectedFramework.adapters?.ssr?.key && selectedFramework.adapters?.static?.key)} + + + {#if adapterData.ssr.desc.includes('$')} + {@const parts = adapterData.ssr.desc.split('$')} + {#each parts as part, i} + {#if i === 0} + {part} + {:else} + + {part} + {/if} + {/each} + {:else} + {adapterData.ssr.desc} + {/if} + {#if adapterData.ssr.url} + Learn more + {/if} + + + {#if adapterData.static.desc.includes('$')} + {@const parts = adapterData.static.desc.split('$')} + {#each parts as part, i} + {#if i === 0} + {part} + {:else} + + {part} + {/if} + {/each} + {:else} + {adapterData.static.desc} + {/if} + {#if adapterData.static.url} + Learn more + {/if} + + + {/if}
    From 17507c662531fec412116f3377d28abad1957343 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 11 Mar 2025 16:06:31 +0100 Subject: [PATCH 116/187] fix: updateBuildSettings --- .../sites/site-[site]/settings/updateBuildSettings.svelte | 4 ++-- .../sites/site-[site]/settings/updateRuntimeSettings.svelte | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateBuildSettings.svelte b/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateBuildSettings.svelte index 2609399f0..c7612e1a6 100644 --- a/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateBuildSettings.svelte +++ b/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateBuildSettings.svelte @@ -30,8 +30,8 @@ let showFallback = site.adapter === Adapter.Static; onMount(async () => { - installCommand ??= installCommand = - site?.installCommand ?? selectedFramework.adapters[site.adapter].installCommand; + installCommand = + site?.installCommand ?? selectedFramework.adapters[site.adapter].defaultInstallCommand; buildCommand = site?.buildCommand ?? selectedFramework.adapters[site.adapter].defaultBuildCommand; outputDirectory = diff --git a/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateRuntimeSettings.svelte b/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateRuntimeSettings.svelte index 3beaaeae3..ff894e165 100644 --- a/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateRuntimeSettings.svelte +++ b/src/routes/(console)/project-[project]/sites/site-[site]/settings/updateRuntimeSettings.svelte @@ -7,7 +7,7 @@ import { addNotification } from '$lib/stores/notifications'; import { sdk } from '$lib/stores/sdk'; import { onMount } from 'svelte'; - import { BuildRuntime, Framework, type Models } from '@appwrite.io/console'; + import { Adapter, BuildRuntime, Framework, type Models } from '@appwrite.io/console'; export let site: Models.Site; export let frameworks: Models.Framework[]; @@ -34,7 +34,7 @@ site.buildCommand || undefined, site.outputDirectory || undefined, (buildRuntime as BuildRuntime) || undefined, - site.adapter, + site.adapter as Adapter, site.fallbackFile || undefined, site.installationId || undefined, site.providerRepositoryId || undefined, From 446250fe0eac8e692d929ebc832e369af17d6603 Mon Sep 17 00:00:00 2001 From: ernstmul Date: Tue, 11 Mar 2025 16:26:49 +0100 Subject: [PATCH 117/187] Creat project to new v2 modal --- src/lib/layout/createProject.svelte | 13 +- .../onboarding/create-project/+page.svelte | 13 -- .../organization-[organization]/+page.svelte | 7 +- .../createProjectCloud.svelte | 40 +++--- .../wizard/step1.svelte | 42 ------ .../wizard/step2.svelte | 133 ------------------ 6 files changed, 33 insertions(+), 215 deletions(-) delete mode 100644 src/routes/(console)/organization-[organization]/wizard/step1.svelte delete mode 100644 src/routes/(console)/organization-[organization]/wizard/step2.svelte diff --git a/src/lib/layout/createProject.svelte b/src/lib/layout/createProject.svelte index a844d44f3..8e5eeb0cb 100644 --- a/src/lib/layout/createProject.svelte +++ b/src/lib/layout/createProject.svelte @@ -7,12 +7,14 @@ import { isCloud } from '$lib/system.js'; export let projectName: string; - export let showCustomId: boolean; export let id: string; export let regions: Array = []; export let region: string; + export let showTitle = true; export let createProject: () => Promise; + let showCustomId = false; + function getRegions() { return regions .filter((region) => region.$id !== 'default') @@ -33,9 +35,16 @@ } + + {#each regions as region} + + {/each} + - Create your project + {#if showTitle} + Create your project + {/if} diff --git a/src/routes/(console)/onboarding/create-project/+page.svelte b/src/routes/(console)/onboarding/create-project/+page.svelte index e3a1caa4f..7e2fe4904 100644 --- a/src/routes/(console)/onboarding/create-project/+page.svelte +++ b/src/routes/(console)/onboarding/create-project/+page.svelte @@ -1,10 +1,8 @@ -ayyy - - - - - - + + diff --git a/src/routes/(console)/organization-[organization]/wizard/step1.svelte b/src/routes/(console)/organization-[organization]/wizard/step1.svelte deleted file mode 100644 index 331a27fc3..000000000 --- a/src/routes/(console)/organization-[organization]/wizard/step1.svelte +++ /dev/null @@ -1,42 +0,0 @@ - - - - Details - - - - {#if !showCustomId} -
    - (showCustomId = !showCustomId)}> - -
    - {:else} - - {/if} -
    -
    diff --git a/src/routes/(console)/organization-[organization]/wizard/step2.svelte b/src/routes/(console)/organization-[organization]/wizard/step2.svelte deleted file mode 100644 index c28a43875..000000000 --- a/src/routes/(console)/organization-[organization]/wizard/step2.svelte +++ /dev/null @@ -1,133 +0,0 @@ - - - - Regions - - Choose a deployment region for your project. This region cannot be changed. - - {#if $regions} -
      - {#each $regions.regions - .filter((r) => r.$id !== 'default') - .sort((regionA, regionB) => { - if (regionA.disabled >= regionB.disabled) { - return 1; - } - return -1; - }) as region} -
    • - -
      - {#if region.disabled} - -

      {region.name}

      - {#if !notifications.includes(region.$id)} - { - notifyRegion(region); - }}> - - {:else} - { - unNotifyRegion(region); - }}> - - {/if} - {:else} - - {region.name} - {/if} -
      -
      -
    • - {/each} -
    - {/if} -
    From d5fff3faa11abf8b274a7cffa2e7a57e73f6cd79 Mon Sep 17 00:00:00 2001 From: ernstmul Date: Tue, 11 Mar 2025 16:30:31 +0100 Subject: [PATCH 118/187] Cleanup --- .../organization-[organization]/createProjectCloud.svelte | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/routes/(console)/organization-[organization]/createProjectCloud.svelte b/src/routes/(console)/organization-[organization]/createProjectCloud.svelte index 1cef7ce04..8d2faf2a0 100644 --- a/src/routes/(console)/organization-[organization]/createProjectCloud.svelte +++ b/src/routes/(console)/organization-[organization]/createProjectCloud.svelte @@ -42,7 +42,6 @@ }); await onFinish(); await goto(`${base}/project-${project.$id}`); - wizard.hide(); } catch (e) { addNotification({ type: 'error', @@ -69,4 +68,3 @@ bind:projectName={$createProject.name} bind:region={$createProject.region} {regions} /> - From 50e31b623769193fdf17f1990a84a898a9bcd79e Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 11 Mar 2025 16:31:38 +0100 Subject: [PATCH 119/187] feat: add detection --- .../sites/create-site/configuration.svelte | 17 ++++--- .../repository-[repository]/+page.svelte | 48 +++++++++++++++---- 2 files changed, 50 insertions(+), 15 deletions(-) diff --git a/src/routes/(console)/project-[project]/sites/create-site/configuration.svelte b/src/routes/(console)/project-[project]/sites/create-site/configuration.svelte index c6f964b38..c76d00c9f 100644 --- a/src/routes/(console)/project-[project]/sites/create-site/configuration.svelte +++ b/src/routes/(console)/project-[project]/sites/create-site/configuration.svelte @@ -52,7 +52,7 @@ let currentVariable: Partial; let frameworkId = selectedFramework.key; - $: frameworkData = frameworks.find((framework) => framework.key === selectedFramework.key); + $: frameworkData = frameworks.find((framework) => framework.key === selectedFramework?.key);
    @@ -81,11 +81,12 @@ id="installCommand" label="Install command" bind:value={installCommand} - placeholder={frameworkData?.defaultInstallCommand} /> + placeholder={frameworkData?.adapters?.ssr?.installCommand} /> @@ -95,11 +96,12 @@ id="buildCommand" label="Build command" bind:value={buildCommand} - placeholder={frameworkData?.defaultBuildCommand} /> + placeholder={frameworkData?.adapters?.ssr?.buildCommand} /> @@ -109,11 +111,12 @@ id="outputDirectory" label="Output directory" bind:value={outputDirectory} - placeholder={frameworkData?.defaultOutputDirectory} /> + placeholder={frameworkData?.adapters?.ssr?.outputDirectory} /> diff --git a/src/routes/(console)/project-[project]/sites/create-site/repositories/repository-[repository]/+page.svelte b/src/routes/(console)/project-[project]/sites/create-site/repositories/repository-[repository]/+page.svelte index 72439b932..2d77315d0 100644 --- a/src/routes/(console)/project-[project]/sites/create-site/repositories/repository-[repository]/+page.svelte +++ b/src/routes/(console)/project-[project]/sites/create-site/repositories/repository-[repository]/+page.svelte @@ -15,7 +15,13 @@ import Details from '../../details.svelte'; import ProductionBranch from '$lib/components/git/productionBranchFieldset.svelte'; import Aside from '../../aside.svelte'; - import { BuildRuntime, Framework, ID, VCSDeploymentType } from '@appwrite.io/console'; + import { + BuildRuntime, + Framework, + ID, + VCSDeploymentType, + VCSDetectionType + } from '@appwrite.io/console'; import type { Models } from '@appwrite.io/console'; import { onMount } from 'svelte'; import Configuration from '../../configuration.svelte'; @@ -46,8 +52,30 @@ installation.set(data.installation); repository.set(data.repository); name = data.repository.name; + + await detectFramwork(); }); + async function detectFramwork() { + try { + const response = await sdk.forProject.vcs.createRepositoryDetection( + $installation.$id, + data.repository.id, + VCSDetectionType.Framework, + rootDir + ); + framework = data.frameworks.frameworks.find((f) => f.key === response.framework); + adapter = framework?.adapters[0]; + installCommand = adapter?.installCommand; + buildCommand = adapter?.buildCommand; + outputDirectory = adapter?.outputDirectory; + console.log(framework); + console.log(response); + } catch (error) { + console.log(error); + } + } + async function create() { try { domain = await buildVerboseDomain( @@ -119,6 +147,8 @@ trackError(e, Submit.SiteCreate); } } + + $: console.log(framework); @@ -160,13 +190,15 @@ installationId={data.installation.$id} repositoryId={data.repository.id} /> - + {#key framework.key} + + {/key} From 8011a60e5982381a9b36ef06593215273155cfd7 Mon Sep 17 00:00:00 2001 From: ernstmul Date: Tue, 11 Mar 2025 16:50:43 +0100 Subject: [PATCH 120/187] Feedback on support wizard --- src/routes/(console)/supportWizard.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/(console)/supportWizard.svelte b/src/routes/(console)/supportWizard.svelte index 2f8c3db8a..b6a177eb7 100644 --- a/src/routes/(console)/supportWizard.svelte +++ b/src/routes/(console)/supportWizard.svelte @@ -107,7 +107,6 @@
    - How can we help you? Please describe your request in detail. If applicable, include steps for reproduction of any in-app issues. @@ -145,11 +144,12 @@ label="Tell us a bit more" /> { wizard.hide(); }}>Cancel - Submit + Submit From 3101f7b0460e499a06497870cdb86e26d236a32a Mon Sep 17 00:00:00 2001 From: ernstmul Date: Tue, 11 Mar 2025 17:10:15 +0100 Subject: [PATCH 121/187] Fix alert header position --- src/lib/layout/headerAlert.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/layout/headerAlert.svelte b/src/lib/layout/headerAlert.svelte index 0d315853e..4e26306c9 100644 --- a/src/lib/layout/headerAlert.svelte +++ b/src/lib/layout/headerAlert.svelte @@ -68,7 +68,7 @@ + + {formatCurrency(project.estimate ?? 0)} + + + {:else} + + + {data.projectNames[project.projectId]?.name ?? 'Unknown'} + + {#if databaseOperationMetric} + + {format(project.databasesReads ?? 0)} + + + {format(project.databasesWrites ?? 0)} + + {:else} + + {format(project.usage)} + + {/if} + + + {formatCurrency(project.estimate ?? 0)} + + + {/if} + {/each} + + +{/if} diff --git a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/totalMembers.svelte b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/totalMembers.svelte index 2e3ad968d..e97db98e4 100644 --- a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/totalMembers.svelte +++ b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/totalMembers.svelte @@ -3,22 +3,13 @@ import { EmptyCardCloud } from '$lib/components/billing'; import { BillingPlan } from '$lib/constants'; import { Button } from '$lib/elements/forms'; - import { - TableBody, - TableCell, - TableCellHead, - TableCellText, - TableHeader, - TableRow, - TableScroll - } from '$lib/elements/table'; import { toLocaleDate } from '$lib/helpers/date'; import { formatCurrency } from '$lib/helpers/numbers'; import { plansInfo, tierToPlan } from '$lib/stores/billing'; import { newMemberModal, organization } from '$lib/stores/organization'; import type { Models } from '@appwrite.io/console'; - import { IconPlus } from '@appwrite.io/pink-icons-svelte'; - import { Icon, Tooltip } from '@appwrite.io/pink-svelte'; + import { IconInfo, IconPlus } from '@appwrite.io/pink-icons-svelte'; + import { Icon, Layout, Table, Tooltip, Typography } from '@appwrite.io/pink-svelte'; export let members: Models.MembershipList; @@ -32,54 +23,68 @@ {#if $organization.billingPlan !== BillingPlan.FREE}
    -
    -

    - {total} - Members -

    + + + + {total} + + Members + / + + + unlimited + + + + + You can add unlimited organization members on the {tierToPlan( + $organization.billingPlan + ).name} plan {$organization.billingPlan === BillingPlan.PRO + ? `for ${formatCurrency(plan?.addons?.member?.price)} each per billing period.` + : '.'} + + + + -
    -

    - Unlimited - - - {`You can add unlimited organization members on the ${tierToPlan($organization.billingPlan).name} plan ${$organization.billingPlan === BillingPlan.PRO ? `for ${formatCurrency(plan.addons.member.price)} each per billing period.` : '.'}`} - -

    +
    - - - Members - Joined - - - {#each paginatedItems as member} - - -
    - - + + + Members + Joined + + {#each paginatedItems as member} + + + + + + {member.userName ? member.userName : member.userEmail} - -
    -
    - - {member.joined - ? toLocaleDate(member.joined) - : toLocaleDate(member.$createdAt)} - -
    - {/each} -
    -
    + +
    + + + + {member.joined + ? toLocaleDate(member.joined) + : toLocaleDate(member.$createdAt)} + + + {/each} + {:else} diff --git a/src/routes/(console)/project-[project]/overview/bandwidth.svelte b/src/routes/(console)/project-[project]/overview/bandwidth.svelte index 75adde40c..308a702e0 100644 --- a/src/routes/(console)/project-[project]/overview/bandwidth.svelte +++ b/src/routes/(console)/project-[project]/overview/bandwidth.svelte @@ -15,7 +15,11 @@ Layout, Button } from '@appwrite.io/pink-svelte'; - import { IconChevronDown, IconChevronUp } from '@appwrite.io/pink-icons-svelte'; + import { + IconChartSquareBar, + IconChevronDown, + IconChevronUp + } from '@appwrite.io/pink-icons-svelte'; export let period: UsagePeriods; @@ -80,12 +84,9 @@ {:else} -
    -
    + + + No data to show +
    {/if} diff --git a/src/routes/(console)/project-[project]/overview/realtime.svelte b/src/routes/(console)/project-[project]/overview/realtime.svelte index 14b5f50f3..9e21c4b9c 100644 --- a/src/routes/(console)/project-[project]/overview/realtime.svelte +++ b/src/routes/(console)/project-[project]/overview/realtime.svelte @@ -3,8 +3,9 @@ import { BarChart } from '$lib/charts'; import { Card } from '$lib/components'; import { formatNum } from '$lib/helpers/string'; - import { Link, Typography } from '@appwrite.io/pink-svelte'; + import { Icon, Layout, Link, Typography } from '@appwrite.io/pink-svelte'; import { stats } from '../store'; + import { IconChartSquareBar } from '@appwrite.io/pink-icons-svelte'; $: projectId = $page.params.project; $: projectStats = $stats?.get(projectId); @@ -28,18 +29,13 @@ {:else} -
    -
    +
    {/if} diff --git a/src/routes/(console)/project-[project]/overview/requests.svelte b/src/routes/(console)/project-[project]/overview/requests.svelte index 9a484763a..e9e193ed4 100644 --- a/src/routes/(console)/project-[project]/overview/requests.svelte +++ b/src/routes/(console)/project-[project]/overview/requests.svelte @@ -14,7 +14,11 @@ Popover, Typography } from '@appwrite.io/pink-svelte'; - import { IconChevronDown, IconChevronUp } from '@appwrite.io/pink-icons-svelte'; + import { + IconChartSquareBar, + IconChevronDown, + IconChevronUp + } from '@appwrite.io/pink-icons-svelte'; export let period: UsagePeriods; @@ -68,12 +72,9 @@ {:else} -
    -
    + + + No data to show +
    {/if} diff --git a/src/routes/(console)/project-[project]/settings/usage/[[invoice]]/+page.svelte b/src/routes/(console)/project-[project]/settings/usage/[[invoice]]/+page.svelte index 11fbbfc7b..69fd01c78 100644 --- a/src/routes/(console)/project-[project]/settings/usage/[[invoice]]/+page.svelte +++ b/src/routes/(console)/project-[project]/settings/usage/[[invoice]]/+page.svelte @@ -1,15 +1,6 @@ @@ -77,39 +54,25 @@ {#if $organization.billingPlan === BillingPlan.SCALE}

    On the Scale plan, you'll be charged only for any usage that exceeds the thresholds - per resource listed below. + per resource listed below. ($showUsageRatesModal = true)} + >Learn more about plan usage limits.

    {:else if $organization.billingPlan === BillingPlan.PRO}

    On the Pro plan, you'll be charged only for any usage that exceeds the thresholds - per resource listed below. + per resource listed below. ($showUsageRatesModal = true)} + >Learn more about plan usage limits.

    {:else if $organization.billingPlan === BillingPlan.FREE}

    If you exceed the limits of the {plan} plan, services for your projects may be disrupted. - Upgrade for greater capacity. + Upgrade for greater capacity.

    {/if} - - Bandwidth @@ -117,10 +80,12 @@ {#if network} {@const humanized = humanFileSize(total(network))} -
    - {humanized.value} - {humanized.unit} -
    + + + {humanized.value} + + {humanized.unit} + {:else} -
    -
    + + + No data to show +
    {/if}
    @@ -163,14 +125,12 @@ {#if users} {@const current = formatNum(usersTotal)} -
    -
    -

    - {current} - Users -

    -
    -
    + + + {current} + + Users + {:else} -
    -
    + + + No data to show +
    {/if}
    @@ -227,13 +184,10 @@ {:else} -
    -
    + + + No data to show +
    {/if}
    @@ -244,14 +198,12 @@ {#if executions} {@const current = formatNum(executionsTotal)} -
    -
    -

    - {current} - Executions -

    -
    -
    + + + {current} + + Executions + {#if data.usage.executionsBreakdown.length > 0} -