From 644072ad9a17008bbdd96baa6583e1bc1de9b943 Mon Sep 17 00:00:00 2001 From: Arman Date: Mon, 4 Sep 2023 18:03:20 +0200 Subject: [PATCH 01/24] fix: form items tags can be changed to fix Safari bug --- src/lib/components/limit.svelte | 1 + src/lib/elements/forms/formItem.svelte | 13 +++++++++++-- src/lib/elements/forms/inputSelect.svelte | 4 +++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/lib/components/limit.svelte b/src/lib/components/limit.svelte index 7594ccc94e..bf5ed752ce 100644 --- a/src/lib/components/limit.svelte +++ b/src/lib/components/limit.svelte @@ -34,6 +34,7 @@
+ export type FormItemTag = 'li' | 'div'; + + -
  • + -
  • + diff --git a/src/lib/elements/forms/inputSelect.svelte b/src/lib/elements/forms/inputSelect.svelte index f55fc25cb5..c675626083 100644 --- a/src/lib/elements/forms/inputSelect.svelte +++ b/src/lib/elements/forms/inputSelect.svelte @@ -1,5 +1,6 @@ - + {#if label}
    From 42b91fba923936c0ea1fd1f490adc895a0a5db2c Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 5 Sep 2023 15:18:15 +0200 Subject: [PATCH 12/24] fix: active deployment is updated correctly --- .../function-[function]/+page.svelte | 40 +++++++++++-------- .../functions/function-[function]/+page.ts | 2 +- .../function-[function]/activate.svelte | 6 ++- .../function-[function]/redeployModal.svelte | 2 +- .../functions/function-[function]/store.ts | 4 ++ 5 files changed, 35 insertions(+), 19 deletions(-) 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 1e2490be33..4e5652c90c 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/+page.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/+page.svelte @@ -25,15 +25,13 @@ TableRow, TableScroll } from '$lib/elements/table'; - import { execute, func, proxyRuleList } from './store'; + import { deploymentList, execute, func, proxyRuleList } from './store'; import { Container } from '$lib/layout'; import { app } from '$lib/stores/app'; import { calculateSize, humanFileSize } from '$lib/helpers/sizeConvertion'; import { Query, type Models } from '@appwrite.io/console'; - import type { PageData } from './$types'; import Delete from './delete.svelte'; import Create from './create.svelte'; - import { onMount } from 'svelte'; import { sdk } from '$lib/stores/sdk'; import Activate from './activate.svelte'; import { calculateTime } from '$lib/helpers/timeConversion'; @@ -43,7 +41,7 @@ import DeploymentCreatedBy from './deploymentCreatedBy.svelte'; import DeploymentDomains from './deploymentDomains.svelte'; - export let data: PageData; + export let data; let showDropdown = []; let showDelete = false; @@ -53,10 +51,6 @@ let selectedDeployment: Models.Deployment = null; let activeDeployment: Models.Deployment = null; - onMount(async () => { - activeDeployment = await getActiveDeployment(); - }); - async function getActiveDeployment() { const list = await sdk.forProject.functions.listDeployments($page.params.function, [ Query.equal('$id', $func?.deployment) @@ -67,6 +61,19 @@ function handleActivate() { invalidate(Dependencies.DEPLOYMENTS); } + + deploymentList.subscribe((list: Models.DeploymentList | null) => { + if (list?.deployments) { + let active = list.deployments.find((deployment) => deployment.$id === $func.deployment); + if (!active) { + getActiveDeployment().then((deployment) => { + activeDeployment = deployment; + }); + } else { + activeDeployment = active; + } + } + }); @@ -74,7 +81,7 @@ Deployments - {#if data.deployments.total} + {#if $deploymentList.total}
    Active
    @@ -131,10 +138,11 @@ danger={status === 'failed'} warning={status === 'building'} success={status === 'ready'}> - {activeDeployment.status === 'ready' + + {activeDeployment.status === 'ready' ? 'active' - : activeDeployment.status} + : activeDeployment.status} + @@ -186,12 +194,12 @@
    All
    - {#if data.deployments.total > 0} + {#if $deploymentList.total}
    Deployment ID - Status + Status Source Updated Build Time @@ -199,7 +207,7 @@ - {#each data.deployments.deployments as deployment, index} + {#each $deploymentList.deployments as deployment, index (deployment.$id)} {@const status = deployment.status} @@ -336,7 +344,7 @@ name="Deployments" limit={data.limit} offset={data.offset} - total={data.deployments.total} /> + total={$deploymentList.total} /> {#if selectedDeployment} diff --git a/src/routes/console/project-[project]/functions/function-[function]/+page.ts b/src/routes/console/project-[project]/functions/function-[function]/+page.ts index 1da9b2ebc2..d09a6161f5 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/+page.ts +++ b/src/routes/console/project-[project]/functions/function-[function]/+page.ts @@ -14,7 +14,7 @@ export const load: PageLoad = async ({ params, depends, url, route, parent }) => return { offset, limit, - deployments: await sdk.forProject.functions.listDeployments(params.function, [ + deploymentList: await sdk.forProject.functions.listDeployments(params.function, [ Query.limit(limit), Query.offset(offset), Query.orderDesc('') diff --git a/src/routes/console/project-[project]/functions/function-[function]/activate.svelte b/src/routes/console/project-[project]/functions/function-[function]/activate.svelte index 69aefb4462..4da5196f38 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/activate.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/activate.svelte @@ -35,7 +35,11 @@ }; - +

    Are you sure you want to activate this deployment?

    diff --git a/src/routes/console/project-[project]/functions/function-[function]/redeployModal.svelte b/src/routes/console/project-[project]/functions/function-[function]/redeployModal.svelte index 6d68e2ec35..6f04929c0b 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/redeployModal.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/redeployModal.svelte @@ -25,8 +25,8 @@ }); trackEvent(Submit.FunctionRedeploy); - invalidate(Dependencies.DEPLOYMENTS); invalidate(Dependencies.FUNCTION); + invalidate(Dependencies.DEPLOYMENTS); show = false; } catch (error) { addNotification({ diff --git a/src/routes/console/project-[project]/functions/function-[function]/store.ts b/src/routes/console/project-[project]/functions/function-[function]/store.ts index 21af90eb48..c08ec380a8 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/store.ts +++ b/src/routes/console/project-[project]/functions/function-[function]/store.ts @@ -3,6 +3,10 @@ import { derived, writable, type Writable } from 'svelte/store'; import type { Models } from '@appwrite.io/console'; export const func = derived(page, ($page) => $page.data.function as Models.Function); +export const deploymentList = derived( + page, + ($page) => $page.data.deploymentList as Models.DeploymentList +); export const proxyRuleList = derived( page, ($page) => $page.data.proxyRuleList as Models.ProxyRuleList From 5d1b353add72fc04aa855165080478705b5509b0 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 5 Sep 2023 15:19:34 +0200 Subject: [PATCH 13/24] fix: avoid elipsys on tag --- .../functions/function-[function]/+page.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 4e5652c90c..806d86d9b2 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/+page.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/+page.svelte @@ -199,7 +199,7 @@ Deployment ID - Status + Status Source Updated Build Time From 915203e6d95d6564d6ecc15be39d955e6d141ac3 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 5 Sep 2023 15:37:32 +0200 Subject: [PATCH 14/24] fix: deplyment page loading --- .../functions/function-[function]/+page.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 806d86d9b2..8b62d00ca5 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/+page.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/+page.svelte @@ -81,7 +81,7 @@ Deployments
    - {#if $deploymentList.total} + {#if $deploymentList?.total}
    Active
    @@ -344,7 +344,7 @@ name="Deployments" limit={data.limit} offset={data.offset} - total={$deploymentList.total} /> + total={$deploymentList?.total} />
    {#if selectedDeployment} From 2604d6950de8efb2ff013f2412502819cfbd106e Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 5 Sep 2023 16:46:18 +0200 Subject: [PATCH 15/24] fix: small stuff --- .../functions/function-[function]/+page.svelte | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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 8b62d00ca5..acd668132a 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/+page.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/+page.svelte @@ -52,8 +52,9 @@ let activeDeployment: Models.Deployment = null; async function getActiveDeployment() { + if (!$func?.deployment) return null; const list = await sdk.forProject.functions.listDeployments($page.params.function, [ - Query.equal('$id', $func?.deployment) + Query.equal('$id', $func.deployment) ]); return list?.deployments?.[0]; } @@ -64,13 +65,15 @@ deploymentList.subscribe((list: Models.DeploymentList | null) => { if (list?.deployments) { - let active = list.deployments.find((deployment) => deployment.$id === $func.deployment); - if (!active) { + let activeDep = list.deployments.find( + (deployment) => deployment.$id === $func.deployment + ); + if (!activeDep) { getActiveDeployment().then((deployment) => { activeDeployment = deployment; }); } else { - activeDeployment = active; + activeDeployment = activeDep; } } }); From bc60c664ced741187d23dffd85842dab13fe47be Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 5 Sep 2023 16:58:14 +0200 Subject: [PATCH 16/24] fix: remove card from templates --- .../functions/templates/template-[template]/+page.svelte | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/routes/console/project-[project]/functions/templates/template-[template]/+page.svelte b/src/routes/console/project-[project]/functions/templates/template-[template]/+page.svelte index 7bbe932537..bb3e30b435 100644 --- a/src/routes/console/project-[project]/functions/templates/template-[template]/+page.svelte +++ b/src/routes/console/project-[project]/functions/templates/template-[template]/+page.svelte @@ -84,13 +84,11 @@ - {@html $template.instructions} From 8efae201dddb4390ae27080956bc3f47b2ba54d1 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 5 Sep 2023 17:04:47 +0200 Subject: [PATCH 17/24] fix: add tooltip to runtimes --- src/lib/wizards/functions/cover.svelte | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib/wizards/functions/cover.svelte b/src/lib/wizards/functions/cover.svelte index fdf925f62d..89f7593ef5 100644 --- a/src/lib/wizards/functions/cover.svelte +++ b/src/lib/wizards/functions/cover.svelte @@ -42,6 +42,7 @@ import Repositories from './components/repositories.svelte'; import CreateManual from './createManual.svelte'; import CreateGit from './createGit.svelte'; + import { tooltip } from '$lib/actions/tooltip'; let hasInstallations: boolean; let selectedRepository: string; @@ -141,7 +142,10 @@ {/each} {#if quickStart.runtimes.length < 6} -
  • +
  • -
    +
    {template.name}
    {template.tagline} From 8d99b455ff364e4998fd3709a22547a7b8bf2c84 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 5 Sep 2023 17:30:18 +0200 Subject: [PATCH 18/24] fix: english --- .../collection-[collection]/settings/updatePermissions.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/updatePermissions.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/updatePermissions.svelte index 63e48a07fb..d8822331e2 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/updatePermissions.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/updatePermissions.svelte @@ -63,7 +63,7 @@ target="_blank" rel="noopener noreferrer" class="link"> - Permissions fuide + Permissions guide .

    From 9702fbc9e6b6f71df1ac30f80d4a82c297d975e8 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 5 Sep 2023 18:19:54 +0200 Subject: [PATCH 19/24] fix: design for cover screen --- src/lib/components/avatarGroup.svelte | 5 +++-- src/lib/components/emptySearch.svelte | 2 +- .../functions/components/repositories.svelte | 22 +++---------------- src/lib/wizards/functions/cover.svelte | 6 ++--- 4 files changed, 10 insertions(+), 25 deletions(-) diff --git a/src/lib/components/avatarGroup.svelte b/src/lib/components/avatarGroup.svelte index c09a5368f2..c9091ffcf5 100644 --- a/src/lib/components/avatarGroup.svelte +++ b/src/lib/components/avatarGroup.svelte @@ -7,6 +7,7 @@ export let size = 40; export let avatarSize: keyof typeof Sizes = 'medium'; export let bordered = false; + export let color = ''; enum Sizes { xsmall = 'is-size-x-small', @@ -28,13 +29,13 @@ {#each icons as icon}
  • - +
  • {/each} {#if total > 2}
  • -
    +{total - 2}
    +
    +{total - 2}
  • {/if} diff --git a/src/lib/components/emptySearch.svelte b/src/lib/components/emptySearch.svelte index 43a41d217d..2f5cc759a0 100644 --- a/src/lib/components/emptySearch.svelte +++ b/src/lib/components/emptySearch.svelte @@ -20,7 +20,7 @@ {#if !hidePagination} -
    +

    Total results: 0

    diff --git a/src/lib/wizards/functions/components/repositories.svelte b/src/lib/wizards/functions/components/repositories.svelte index a1fcd6c134..ee2dfdfe0a 100644 --- a/src/lib/wizards/functions/components/repositories.svelte +++ b/src/lib/wizards/functions/components/repositories.svelte @@ -117,7 +117,7 @@
    {/await} -

    +

    Manage organization configuration in your project settings {/if} -

    +
    {repo.name} {#if repo.private} There are no repositories that match your search.

    -
    {:else} - -
    -
    -

    You have no repositories.

    -

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

    -
    -
    -
    + {/if} {/await} {/if} diff --git a/src/lib/wizards/functions/cover.svelte b/src/lib/wizards/functions/cover.svelte index 89f7593ef5..069005605f 100644 --- a/src/lib/wizards/functions/cover.svelte +++ b/src/lib/wizards/functions/cover.svelte @@ -85,9 +85,7 @@

    Quick start

    -

    - Use a starter templates to begin with the basics. -

    +

    Use a starter template.

      @@ -197,6 +196,7 @@
    -
    - - +
    From da1cc365a8c0f8912c0c5cdbc3006acda8067add Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 5 Sep 2023 19:08:33 +0200 Subject: [PATCH 21/24] fix: design template pages --- .../functions/templates/+page.svelte | 27 +++++++++---------- .../template-[template]/+page.svelte | 8 +++--- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/routes/console/project-[project]/functions/templates/+page.svelte b/src/routes/console/project-[project]/functions/templates/+page.svelte index 9c8c8333b5..3e6c37fb44 100644 --- a/src/routes/console/project-[project]/functions/templates/+page.svelte +++ b/src/routes/console/project-[project]/functions/templates/+page.svelte @@ -8,10 +8,10 @@ CollapsibleItem, EmptySearch, Heading, - Pagination + Pagination, + SvgIcon } from '$lib/components'; import { Button, InputSearch } from '$lib/elements/forms'; - import { debounce } from '$lib/helpers/debounce'; import { Container } from '$lib/layout'; import { app } from '$lib/stores/app'; import { connectTemplate } from '$lib/wizards/functions/cover.svelte'; @@ -120,11 +120,11 @@ on:change={(e) => applyFilter('runtime', runtime, e)} />
    - {icon} + +
    +
    + {runtime?.split('-')?.join(' ')}
    -
    {runtime}
    @@ -155,10 +155,8 @@ {@const hidden = template.runtimes.slice(1, -1)}
  • -
    -

    +
    +

    {template.name}

      @@ -226,11 +224,10 @@
    {/if} +
    +

    Total templates: {data.sum}

    + +

  • -
    -
    - -
    -
    diff --git a/src/routes/console/project-[project]/functions/templates/template-[template]/+page.svelte b/src/routes/console/project-[project]/functions/templates/template-[template]/+page.svelte index bb3e30b435..7a8809820b 100644 --- a/src/routes/console/project-[project]/functions/templates/template-[template]/+page.svelte +++ b/src/routes/console/project-[project]/functions/templates/template-[template]/+page.svelte @@ -1,6 +1,6 @@ +{$domain.domain} {#if $domain.status === 'created'}
    @@ -63,7 +64,6 @@
    {:else if $domain.status === 'unverified'} - {$domain.domain}
    {:else} - + 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 acd668132a..6e686948ff 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/+page.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/+page.svelte @@ -47,6 +47,7 @@ let showDelete = false; let showActivate = false; let showRedeploy = false; + let showAlert = true; let selectedDeployment: Models.Deployment = null; let activeDeployment: Models.Deployment = null; @@ -88,13 +89,16 @@
    Active
    - {#if activeDeployment && !$func.live} -
    - - Some configuration options are not live yet. Redeploy your function to apply - latest changes. - -
    + {#if activeDeployment && !$func.live && showAlert} + (showAlert = false)}> + Some configuration options are not live yet. Redeploy your function to apply latest + changes. + {/if} {#if activeDeployment} 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 dabf341fe3..499c2d49f0 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 @@ -20,6 +20,7 @@ import { Button } from '$lib/elements/forms'; export let data; + let showAlert = true; const sdkCreateVariable = async (key: string, value: string) => { await sdk.forProject.functions.createVariable($func.$id, key, value); @@ -42,8 +43,12 @@ Settings - {#if $func.version !== 'v3'} - + {#if $func.version !== 'v3' && showAlert} + (showAlert = false)}> Your function is outdated Update your function version to make use of new features including build commands and HTTP data in your executions. To update, follow the steps outlined in our