From adf99fa4ef7ded859114617535eb3f12fd267308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Tue, 5 Sep 2023 16:12:38 +0200 Subject: [PATCH 01/14] Fix AI assistant headers for console user --- src/lib/commandCenter/panels/ai.svelte | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib/commandCenter/panels/ai.svelte b/src/lib/commandCenter/panels/ai.svelte index f2887239b..e94024816 100644 --- a/src/lib/commandCenter/panels/ai.svelte +++ b/src/lib/commandCenter/panels/ai.svelte @@ -15,7 +15,6 @@ const { input, handleSubmit, completion, isLoading, complete, error } = useCompletion({ api: endpoint + '/console/assistant', headers: { - 'x-appwrite-mode': 'admin', 'content-type': 'application/json' } }); From b8ba4ac99567a22456110f47b651925c60b4b48d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Tue, 5 Sep 2023 16:31:20 +0200 Subject: [PATCH 02/14] Fix missing credentials --- src/lib/commandCenter/panels/ai.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/commandCenter/panels/ai.svelte b/src/lib/commandCenter/panels/ai.svelte index e94024816..5fd3d8b65 100644 --- a/src/lib/commandCenter/panels/ai.svelte +++ b/src/lib/commandCenter/panels/ai.svelte @@ -16,7 +16,8 @@ api: endpoint + '/console/assistant', headers: { 'content-type': 'application/json' - } + }, + credentials: 'include' }); let question = $input; From 1eca2e934c3e026f43091708fc313522a491f79e Mon Sep 17 00:00:00 2001 From: Arman Date: Wed, 6 Sep 2023 15:55:36 +0200 Subject: [PATCH 03/14] fix: disable last step button wizard after submission --- src/lib/layout/wizard.svelte | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/layout/wizard.svelte b/src/lib/layout/wizard.svelte index 25067cf9d..149192fe3 100644 --- a/src/lib/layout/wizard.svelte +++ b/src/lib/layout/wizard.svelte @@ -74,8 +74,13 @@ wizard.setInterceptor(null); if (isLastStep) { + $wizard.nextDisabled = true; trackEvent('wizard_finish'); dispatch('finish'); + //Reactivate button in case there are errors + setTimeout(() => { + $wizard.nextDisabled = false; + }, 2000); } else { trackEvent('wizard_next'); $wizard.step++; From 38e9b400bcaaec41f0a353ab4fb44c7ca8882563 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Fri, 1 Sep 2023 16:40:54 -0700 Subject: [PATCH 04/14] Fix infinite loading of quickstart templates This happens when Appwrite deosn't have the runtime from the quickstart template enabled. This change filters the quickstart templates to only include enabled runtimes. --- src/lib/wizards/functions/cover.svelte | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/lib/wizards/functions/cover.svelte b/src/lib/wizards/functions/cover.svelte index 069005605..189ed47d2 100644 --- a/src/lib/wizards/functions/cover.svelte +++ b/src/lib/wizards/functions/cover.svelte @@ -106,21 +106,22 @@ {/each} {:then response} - {@const runtimes = response.runtimes} - {#each quickStart.runtimes.filter((_template, index) => index < 6) as runtime} - {@const runtimeDetail = runtimes.find( - (r) => r.$id === runtime.name - )} + {@const runtimes = new Map(response.runtimes.map((r) => [r.$id, r]))} + {@const templates = quickStart.runtimes.filter((_template) => + runtimes.has(_template.name) + )} + {#each templates.slice(0, 6) as template} + {@const runtimeDetail = runtimes.get(template.name)}
  • {/each} - {#if quickStart.runtimes.length < 6} + {#if templates.length < 6}
  • Date: Wed, 6 Sep 2023 17:26:21 +0200 Subject: [PATCH 05/14] Set AI project --- src/lib/commandCenter/panels/ai.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/commandCenter/panels/ai.svelte b/src/lib/commandCenter/panels/ai.svelte index 5fd3d8b65..1c589e138 100644 --- a/src/lib/commandCenter/panels/ai.svelte +++ b/src/lib/commandCenter/panels/ai.svelte @@ -15,7 +15,8 @@ const { input, handleSubmit, completion, isLoading, complete, error } = useCompletion({ api: endpoint + '/console/assistant', headers: { - 'content-type': 'application/json' + 'content-type': 'application/json', + 'x-appwrite-project': 'console' }, credentials: 'include' }); From 800262e0b5143d48c12c7c4a29f67f091132f003 Mon Sep 17 00:00:00 2001 From: Arman Date: Wed, 6 Sep 2023 18:30:58 +0200 Subject: [PATCH 06/14] fix: design fixes from QA --- .../functions/steps/gitConfiguration.svelte | 20 +-- .../function-[function]/createCli.svelte | 2 +- .../function-[function]/createGit.svelte | 92 +++++++------- .../function-[function]/createManual.svelte | 27 ++-- .../deployment-[deployment]/+page.svelte | 5 +- .../function-[function]/execute.svelte | 120 +++++++++--------- .../settings/disconnectRepo.svelte | 4 +- .../settings/updateConfiguration.svelte | 23 +--- .../promoteVariableModal.svelte | 2 - .../uploadVariablesModal.svelte | 9 +- 10 files changed, 144 insertions(+), 160 deletions(-) diff --git a/src/lib/wizards/functions/steps/gitConfiguration.svelte b/src/lib/wizards/functions/steps/gitConfiguration.svelte index ff6463b1d..d021ca656 100644 --- a/src/lib/wizards/functions/steps/gitConfiguration.svelte +++ b/src/lib/wizards/functions/steps/gitConfiguration.svelte @@ -1,5 +1,5 @@ - +

    Deploy your function using the Appwrite CLI by running the following command inside your function's folder. diff --git a/src/routes/console/project-[project]/functions/function-[function]/createGit.svelte b/src/routes/console/project-[project]/functions/function-[function]/createGit.svelte index be6d88241..4360458c1 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/createGit.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/createGit.svelte @@ -8,7 +8,7 @@ export let show = false; - + {#if $func.installationId && $func.providerRepositoryId}

    Deploy your function from the Git provider of your choice by following the steps below. @@ -19,52 +19,50 @@ class="link">documentation.

    - - - - Checkout your production branch. -
    - -
    -
    - - Add your changes -
    - -
    -
    - - Create a new commit -
    - -
    -
    - - Push your new commit -
    - -
    -
    - - A new deployment will be triggered automatically. - -
    -
    + + + Checkout your production branch. +
    + +
    +
    + + Add your changes +
    + +
    +
    + + Create a new commit +
    + +
    +
    + + Push your new commit +
    + +
    +
    + + A new deployment will be triggered automatically. + +
    {:else}
    diff --git a/src/routes/console/project-[project]/functions/function-[function]/createManual.svelte b/src/routes/console/project-[project]/functions/function-[function]/createManual.svelte index be24aece1..024ec8f6e 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/createManual.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/createManual.svelte @@ -1,12 +1,5 @@ - +

    Manually deploy a function by uploading a zip file containing the source code and a relative path to the entry point. @@ -66,7 +65,7 @@ class="link">Learn more about function deployments.

    - + Build settings (optional) - - +

    + Overwrite your function configuration for a single deployment or save + commands for future use. +

    +
    -
    +

    Build {$func.name}

    {#if $deployment.status === 'building'} Building... {:else} - {$deployment.status} + {$deployment.status} {/if}
    diff --git a/src/routes/console/project-[project]/functions/function-[function]/execute.svelte b/src/routes/console/project-[project]/functions/function-[function]/execute.svelte index 26824e5f7..6302f5d97 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/execute.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/execute.svelte @@ -147,66 +147,68 @@ tooltip="Headers should contain alphanumeric characters (a-z, A-Z, and 0-9) and hyphens only (- and _)."> Headers +
    + + {#if headers} + {#each headers as [name, value], index} + + + + + + + + {/each} + {/if} + + +
    -
    - - {#if headers} - {#each headers as [name, value], index} - - - - - - - - {/each} - {/if} - - -
    +

    - Are you sure you want to disconnect {$func.name}? This will affect future deployments to - this function. + Are you sure you want to disconnect {$func.name}? This will affect future deployments + to this function.

    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 index df75532d1..e29904e78 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/settings/updateConfiguration.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/settings/updateConfiguration.svelte @@ -102,15 +102,6 @@ azure = 'Azure' } - function getProviderIcon(provider: string) { - switch (provider) { - case 'github': - return 'icon-github'; - default: - return ''; - } - } - function getRepositoryLink(repository: Models.ProviderRepository) { switch (repository.provider) { case 'github': @@ -218,21 +209,21 @@ {#if repository} -
    -
    - -
    -
    +
    + +
    {repository.name} {#if repository.private}
    -

    Last updated: {toLocaleDateTime(repository.pushedAt)}

    +

    + Last updated: {toLocaleDateTime(repository.pushedAt)} +

    diff --git a/src/routes/console/project-[project]/promoteVariableModal.svelte b/src/routes/console/project-[project]/promoteVariableModal.svelte index 785ef5f74..8216fed3a 100644 --- a/src/routes/console/project-[project]/promoteVariableModal.svelte +++ b/src/routes/console/project-[project]/promoteVariableModal.svelte @@ -16,8 +16,6 @@ onSubmit={() => { dispatch('promoted'); }} - icon="exclamation" - state="warning" headerDivider={false}> {isConflicting ? 'Overwrite global variable' : 'Promote variable'} diff --git a/src/routes/console/project-[project]/uploadVariablesModal.svelte b/src/routes/console/project-[project]/uploadVariablesModal.svelte index 0a8484b7c..0bf44006a 100644 --- a/src/routes/console/project-[project]/uploadVariablesModal.svelte +++ b/src/routes/console/project-[project]/uploadVariablesModal.svelte @@ -68,10 +68,13 @@ Import new {isGlobal ? 'global' : 'environment'} variables -
    +

    - Import new {isGlobal ? 'global' : 'environment'} variables from .env file that will be passed - to {isGlobal ? 'all functions within your project' : 'your function'}. + Import new {isGlobal ? 'global' : 'environment'} variables from + .env + file that will be passed to {isGlobal + ? 'all functions within your project' + : 'your function'}.

    {#if variableList.total > 0} From e7b16b7255bfac36aa7699ccd0a3f8c759aba6a1 Mon Sep 17 00:00:00 2001 From: Arman Date: Wed, 6 Sep 2023 18:39:52 +0200 Subject: [PATCH 07/14] fix: design and logic in env variables card --- .../project-[project]/updateVariables.svelte | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/routes/console/project-[project]/updateVariables.svelte b/src/routes/console/project-[project]/updateVariables.svelte index f9232bf84..8a17fa61d 100644 --- a/src/routes/console/project-[project]/updateVariables.svelte +++ b/src/routes/console/project-[project]/updateVariables.svelte @@ -174,8 +174,9 @@ - {isGlobal ? 'Global Variables' : 'Environment Variables'} + + {isGlobal ? 'Global variables' : 'Environment variables'} + {#if isGlobal}

    Set the environment variables or secret keys that will be passed to all functions within @@ -216,7 +217,7 @@

    {@const sum = variableList.total} {#if sum} -
    +
    {#if conflictVariables.length > 0}

    @@ -227,7 +228,7 @@ {/if} a naming conflict with a global variable. View global variables in project settings - Key + Key Value - + {#each variableList.variables.slice(offset, offset + limit) as variable, i} @@ -251,16 +252,16 @@ globalVariable.key === variable.key ) !== undefined : false} - {#if isConflicting} -

    + class={isConflicting && hasConflictOnPage + ? 'u-flex u-gap-4 u-cross-center' + : ''}> + {#if isConflicting && hasConflictOnPage} +
    {/if} -
    All
    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 d09a6161f..1d85970ce 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/+page.ts +++ b/src/routes/console/project-[project]/functions/function-[function]/+page.ts @@ -5,7 +5,7 @@ import { Dependencies, PAGE_LIMIT } from '$lib/constants'; import type { PageLoad } from './$types'; export const load: PageLoad = async ({ params, depends, url, route, parent }) => { - await parent(); + const data = await parent(); depends(Dependencies.DEPLOYMENTS); const page = getPage(url); const limit = getLimit(url, route, PAGE_LIMIT); @@ -14,6 +14,12 @@ export const load: PageLoad = async ({ params, depends, url, route, parent }) => return { offset, limit, + activeDeployment: data.function.deployment + ? await sdk.forProject.functions.getDeployment( + params.function, + data.function.deployment + ) + : null, deploymentList: await sdk.forProject.functions.listDeployments(params.function, [ Query.limit(limit), Query.offset(offset), From 44ad1357c258c3087c32d823677d9341a93fb59c Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Thu, 7 Sep 2023 16:43:47 +0200 Subject: [PATCH 11/14] fix: total number overflow with 5000 --- src/lib/components/limit.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/components/limit.svelte b/src/lib/components/limit.svelte index bf5ed752c..934354860 100644 --- a/src/lib/components/limit.svelte +++ b/src/lib/components/limit.svelte @@ -41,5 +41,5 @@ {options} bind:value={limit} on:change={limitChange} /> -

    {name} per page. Total results: {sum}

    +

    {name} per page. Total results: {sum >= 5000 ? `${sum}+` : sum}

    From 62b816cd00274e94ed0c95701d02cd3a79699895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Sat, 9 Sep 2023 11:50:05 +0200 Subject: [PATCH 12/14] Fix discord template docs & setup --- src/lib/stores/marketplace.ts | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/lib/stores/marketplace.ts b/src/lib/stores/marketplace.ts index 9433a3f82..0a6da219c 100644 --- a/src/lib/stores/marketplace.ts +++ b/src/lib/stores/marketplace.ts @@ -132,7 +132,7 @@ export const marketplace: MarketplaceTemplate[] = [ { name: 'node-18.0', commands: 'npm install && npm run setup', - entrypoint: 'src/main.js && npm run setup', + entrypoint: 'src/main.js', providerRootDirectory: 'node/discord-command-bot' }, { @@ -150,9 +150,25 @@ export const marketplace: MarketplaceTemplate[] = [ variables: [ { name: 'DISCORD_PUBLIC_KEY', - description: `Discord Public Key to verify request signature. Learn more.`, + description: `Public Key of your application in Discord Developer Portal. Learn more.`, value: '', - placeholder: 'd1efb...aec35', + placeholder: 'db9...980', + required: true, + type: 'password' + }, + { + name: 'DISCORD_APPLICATION_ID', + description: `ID of your application in Discord Developer Portal. Learn more.`, + value: '', + placeholder: '427...169', + required: true, + type: 'password' + }, + { + name: 'DISCORD_TOKEN', + description: `Bot token of your application in Discord Developer Portal. Learn more.`, + value: '', + placeholder: 'NDI...LUfg', required: true, type: 'password' } From 503697895061f92152b9b65a444a16695f2fbfeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Sat, 9 Sep 2023 16:30:53 +0200 Subject: [PATCH 13/14] Mark form var text, not url --- src/lib/stores/marketplace.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/stores/marketplace.ts b/src/lib/stores/marketplace.ts index 9433a3f82..98ac7c0ec 100644 --- a/src/lib/stores/marketplace.ts +++ b/src/lib/stores/marketplace.ts @@ -698,7 +698,7 @@ export const marketplace: MarketplaceTemplate[] = [ value: '', placeholder: 'smtp.mailgun.org', required: true, - type: 'url' + type: 'text' }, { name: 'SMTP_PORT', From 5a3c7b73588cd2d5ff04a80d15f8d6496c40504d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Sat, 9 Sep 2023 18:42:09 +0200 Subject: [PATCH 14/14] Add stripe templates --- src/lib/stores/marketplace.ts | 128 ++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) diff --git a/src/lib/stores/marketplace.ts b/src/lib/stores/marketplace.ts index 9433a3f82..94074bc7c 100644 --- a/src/lib/stores/marketplace.ts +++ b/src/lib/stores/marketplace.ts @@ -737,6 +737,134 @@ export const marketplace: MarketplaceTemplate[] = [ type: 'text' } ] + }, + { + icon: 'icon-stripe', + id: 'subscriptions-with-stripe', + name: 'Subscriptions with Stripe', + tagline: 'Receive recurring card payments and grant subscribers extra permissions.', + permissions: ['any'], + events: [], + cron: '', + timeout: 15, + usecases: ['Utilities'], + runtimes: [ + { + name: 'node-18.0', + commands: 'npm install', + entrypoint: 'src/main.js', + providerRootDirectory: 'node/subscriptions-with-stripe' + } + ], + instructions: `For documentation and instructions check out file.`, + vcsProvider: 'github', + providerRepositoryId: 'templates', + providerOwner: 'appwrite', + providerBranch: 'main', + variables: [ + { + name: 'APPWRITE_API_KEY', + description: `The API Key to talk to Appwrite backend APIs. Learn more.`, + value: '', + placeholder: 'd1efb...aec35', + required: true, + type: 'password' + }, + { + name: 'APPWRITE_ENDPOINT', + description: `The URL endpoint of the Appwrite server. Learn more.`, + value: 'https://cloud.appwrite.io/v1', + placeholder: 'https://cloud.appwrite.io/v1', + required: false, + type: 'url' + }, + { + name: 'STRIPE_SECRET_KEY', + description: `Secret for sending requests to the Stripe API. Learn more.`, + placeholder: 'sk_test_51J...', + required: true, + type: 'password' + }, + { + name: 'STRIPE_WEBHOOK_SECRET', + description: `Secret used to validate the Stripe Webhook signature. Learn more.`, + placeholder: 'whsec_...', + required: true, + type: 'password' + } + ] + }, + { + icon: 'icon-stripe', + id: 'payments-with-stripe', + name: 'Payments with Stripe', + tagline: 'Receive card payments and store paid orders.', + permissions: ['any'], + events: [], + cron: '', + timeout: 15, + usecases: ['Utilities'], + runtimes: [ + { + name: 'node-18.0', + commands: 'npm install && npm run setup', + entrypoint: 'src/main.js', + providerRootDirectory: 'node/payments-with-stripe' + } + ], + instructions: `For documentation and instructions check out file.`, + vcsProvider: 'github', + providerRepositoryId: 'templates', + providerOwner: 'appwrite', + providerBranch: 'main', + variables: [ + { + name: 'APPWRITE_API_KEY', + description: `The API Key to talk to Appwrite backend APIs. Learn more.`, + value: '', + placeholder: 'd1efb...aec35', + required: true, + type: 'password' + }, + { + name: 'APPWRITE_ENDPOINT', + description: `The URL endpoint of the Appwrite server. Learn more.`, + value: 'https://cloud.appwrite.io/v1', + placeholder: 'https://cloud.appwrite.io/v1', + required: false, + type: 'url' + }, + { + name: 'STRIPE_SECRET_KEY', + description: `Secret for sending requests to the Stripe API. Learn more.`, + placeholder: 'sk_test_51J...', + required: true, + type: 'password' + }, + { + name: 'STRIPE_WEBHOOK_SECRET', + description: `Secret used to validate the Stripe Webhook signature. Learn more.`, + placeholder: 'whsec_...', + required: true, + type: 'password' + }, + { + name: 'APPWRITE_DATABASE_ID', + description: `The ID of the database to store paid orders. Learn more.`, + value: 'orders', + placeholder: 'orders', + required: false, + type: 'text' + }, + { + name: 'APPWRITE_COLLECTION_ID', + description: `The ID of the collection to store paid orders. Learn more.`, + value: 'orders', + placeholder: 'orders', + required: false, + type: 'text' + } + ] } ];