From 5a5c27c1491616fe7095cee2536bc0254195f8f1 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Fri, 8 Sep 2023 17:32:06 -0700 Subject: [PATCH 01/27] Fix users list not re-rendering --- src/routes/console/project-[project]/auth/+page.svelte | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/routes/console/project-[project]/auth/+page.svelte b/src/routes/console/project-[project]/auth/+page.svelte index 742fa8a78..bdd8d834a 100644 --- a/src/routes/console/project-[project]/auth/+page.svelte +++ b/src/routes/console/project-[project]/auth/+page.svelte @@ -34,13 +34,6 @@ export let data: PageData; - // TODO: Remove this when the console SDK is updated - const users = data.users.users.map((user) => { - const labels: string[] = []; - const accessedAt = ''; - return { accessedAt, labels, ...user }; - }); - const projectId = $page.params.project; async function userCreated(event: CustomEvent>>) { await goto(`${base}/console/project-${projectId}/auth/user-${event.detail.$id}`); @@ -65,7 +58,7 @@ Last Activity - {#each users as user} + {#each data.users.users as user} From 2b6106578408534613040731acd695332bd3e9da Mon Sep 17 00:00:00 2001 From: Shardul Kurdukar <24shardul@gmail.com> Date: Sun, 10 Sep 2023 00:16:15 +0530 Subject: [PATCH 02/27] Added flutter web option for updating hostname --- .../platforms/[platform]/+page@project-[project].svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/routes/console/project-[project]/overview/platforms/[platform]/+page@project-[project].svelte b/src/routes/console/project-[project]/overview/platforms/[platform]/+page@project-[project].svelte index 96727fce9..61b9e7d31 100644 --- a/src/routes/console/project-[project]/overview/platforms/[platform]/+page@project-[project].svelte +++ b/src/routes/console/project-[project]/overview/platforms/[platform]/+page@project-[project].svelte @@ -33,7 +33,8 @@ 'flutter-android': FlutterAndroid, 'flutter-linux': FlutterLinux, 'flutter-macos': FlutterMacOs, - 'flutter-windows': FlutterWindows + 'flutter-windows': FlutterWindows, + 'flutter-web': Web }; let showDelete = false; From cb06fe4e0acbda454b3960bc35366fd42e0675d2 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Tue, 12 Sep 2023 14:04:14 -0700 Subject: [PATCH 03/27] Fix incorrect links to migration docs for self-hosted <> cloud --- .../project-[project]/settings/migrations/+page.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/console/project-[project]/settings/migrations/+page.svelte b/src/routes/console/project-[project]/settings/migrations/+page.svelte index 857c0bcdc..e879a1b5d 100644 --- a/src/routes/console/project-[project]/settings/migrations/+page.svelte +++ b/src/routes/console/project-[project]/settings/migrations/+page.svelte @@ -235,7 +235,7 @@

Export data from your project to Appwrite Cloud. Learn more in our documentation. @@ -262,7 +262,7 @@

Export data from your project to a self-hosted instance. Learn more in our documentation. From a40f72aac7764144eab5b74cf3643a5cd22edc0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 13 Sep 2023 18:33:27 +0200 Subject: [PATCH 04/27] PoC: All runtimes support --- src/lib/stores/marketplace.ts | 66 +++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/src/lib/stores/marketplace.ts b/src/lib/stores/marketplace.ts index 5c95eb771..11bc1256b 100644 --- a/src/lib/stores/marketplace.ts +++ b/src/lib/stores/marketplace.ts @@ -1,3 +1,28 @@ +const Runtimes = { + NODE: { name: 'node', versions: ['20.0', '19.0', '18.0', '16.0', '14.5'] }, + PHP: { name: 'php', versions: ['8.2', '8.1', '8.0'] }, + RUBY: { name: 'ruby', versions: ['3.2', '3.1', '3.0'] }, + PYTHON: { name: 'python', versions: ['3.11', '3.10', '3.9', '3.8'] }, + DART: { name: 'dart', versions: ['3.0', '2.19', '2.18', '2.17', '2.16', '2.16'] }, + BUN: { name: 'bun', versions: ['1.0'] } +}; + +const getRuntimes = ( + runtime: any, + commands: string, + entrypoint: string, + providerRootDirectory: string +) => { + return runtime.versions.map((version) => { + return { + name: `${runtime.name}-${version}`, + commands, + entrypoint, + providerRootDirectory + }; + }); +}; + export const marketplace: MarketplaceTemplate[] = [ { icon: 'icon-lightning-bolt', @@ -11,36 +36,17 @@ export const marketplace: MarketplaceTemplate[] = [ timeout: 15, usecases: ['Starter'], runtimes: [ - { - name: 'node-18.0', - commands: 'npm install', - entrypoint: 'src/main.js', - providerRootDirectory: 'node/starter' - }, - { - name: 'php-8.0', - commands: 'composer install', - entrypoint: 'src/index.php', - providerRootDirectory: 'php/starter' - }, - { - name: 'ruby-3.0', - commands: 'bundle install', - entrypoint: 'lib/main.rb', - providerRootDirectory: 'ruby/starter' - }, - { - name: 'python-3.9', - commands: 'pip install -r requirements.txt', - entrypoint: 'src/main.py', - providerRootDirectory: 'python/starter' - }, - { - name: 'dart-2.17', - commands: 'dart pub get', - entrypoint: 'lib/main.dart', - providerRootDirectory: 'dart/starter' - } + ...getRuntimes(Runtimes.NODE, 'npm install', 'src/main.js', 'node/starter'), + ...getRuntimes(Runtimes.PHP, 'composer install', 'src/index.php', 'php/starter'), + ...getRuntimes(Runtimes.RUBY, 'bundle install', 'lib/main.rb', 'ruby/starter'), + ...getRuntimes( + Runtimes.PYTHON, + 'pip install -r requirements.txt', + 'src/main.py', + 'python/starter' + ), + ...getRuntimes(Runtimes.DART, 'dart pub get', 'lib/main.dart', 'dart/starter'), + ...getRuntimes(Runtimes.BUN, 'bun install', 'src/main.ts', 'bun/starter') ], instructions: `For documentation and instructions check out file.`, vcsProvider: 'github', From 53f0f1eac21c012f12a90fd96d4a9d91ccfc4876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 13 Sep 2023 18:37:36 +0200 Subject: [PATCH 05/27] Remove "any" type --- src/lib/stores/marketplace.ts | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/lib/stores/marketplace.ts b/src/lib/stores/marketplace.ts index 11bc1256b..8682c0179 100644 --- a/src/lib/stores/marketplace.ts +++ b/src/lib/stores/marketplace.ts @@ -1,4 +1,9 @@ -const Runtimes = { +type TemplateRuntime = { + name: string; + versions: string[]; +}; + +const TemplateRuntimes = { NODE: { name: 'node', versions: ['20.0', '19.0', '18.0', '16.0', '14.5'] }, PHP: { name: 'php', versions: ['8.2', '8.1', '8.0'] }, RUBY: { name: 'ruby', versions: ['3.2', '3.1', '3.0'] }, @@ -8,7 +13,7 @@ const Runtimes = { }; const getRuntimes = ( - runtime: any, + runtime: TemplateRuntime, commands: string, entrypoint: string, providerRootDirectory: string @@ -36,17 +41,22 @@ export const marketplace: MarketplaceTemplate[] = [ timeout: 15, usecases: ['Starter'], runtimes: [ - ...getRuntimes(Runtimes.NODE, 'npm install', 'src/main.js', 'node/starter'), - ...getRuntimes(Runtimes.PHP, 'composer install', 'src/index.php', 'php/starter'), - ...getRuntimes(Runtimes.RUBY, 'bundle install', 'lib/main.rb', 'ruby/starter'), + ...getRuntimes(TemplateRuntimes.NODE, 'npm install', 'src/main.js', 'node/starter'), ...getRuntimes( - Runtimes.PYTHON, + TemplateRuntimes.PHP, + 'composer install', + 'src/index.php', + 'php/starter' + ), + ...getRuntimes(TemplateRuntimes.RUBY, 'bundle install', 'lib/main.rb', 'ruby/starter'), + ...getRuntimes( + TemplateRuntimes.PYTHON, 'pip install -r requirements.txt', 'src/main.py', 'python/starter' ), - ...getRuntimes(Runtimes.DART, 'dart pub get', 'lib/main.dart', 'dart/starter'), - ...getRuntimes(Runtimes.BUN, 'bun install', 'src/main.ts', 'bun/starter') + ...getRuntimes(TemplateRuntimes.DART, 'dart pub get', 'lib/main.dart', 'dart/starter'), + ...getRuntimes(TemplateRuntimes.BUN, 'bun install', 'src/main.ts', 'bun/starter') ], instructions: `For documentation and instructions check out file.`, vcsProvider: 'github', From d2d30a58210f5dadb1addf9b249c59cf541e20f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 13 Sep 2023 19:02:31 +0200 Subject: [PATCH 06/27] Improve marketplace structure --- src/lib/stores/marketplace.ts | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/lib/stores/marketplace.ts b/src/lib/stores/marketplace.ts index 8682c0179..ea4499214 100644 --- a/src/lib/stores/marketplace.ts +++ b/src/lib/stores/marketplace.ts @@ -16,16 +16,19 @@ const getRuntimes = ( runtime: TemplateRuntime, commands: string, entrypoint: string, - providerRootDirectory: string + providerRootDirectory: string, + versionsDenyList: string[] = [] ) => { - return runtime.versions.map((version) => { - return { - name: `${runtime.name}-${version}`, - commands, - entrypoint, - providerRootDirectory - }; - }); + return runtime.versions + .filter((version) => !versionsDenyList.includes(version)) + .map((version) => { + return { + name: `${runtime.name}-${version}`, + commands, + entrypoint, + providerRootDirectory + }; + }); }; export const marketplace: MarketplaceTemplate[] = [ @@ -41,7 +44,15 @@ export const marketplace: MarketplaceTemplate[] = [ timeout: 15, usecases: ['Starter'], runtimes: [ - ...getRuntimes(TemplateRuntimes.NODE, 'npm install', 'src/main.js', 'node/starter'), + ...getRuntimes(TemplateRuntimes.NODE, 'npm install', 'src/main.js', 'node/starter', [ + '20.0' + ]), + { + name: `node-20.0`, + commands: 'npm install --version=20', + entrypoint: 'src/mainv20.js', + providerRootDirectory: 'node20/starter' + }, ...getRuntimes( TemplateRuntimes.PHP, 'composer install', From 1dfb1b2c421decad8e103b904e1dc0dd977e0f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 13 Sep 2023 19:06:32 +0200 Subject: [PATCH 07/27] Finalize marketplace structure --- src/lib/stores/marketplace.ts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/lib/stores/marketplace.ts b/src/lib/stores/marketplace.ts index ea4499214..1d6f88411 100644 --- a/src/lib/stores/marketplace.ts +++ b/src/lib/stores/marketplace.ts @@ -44,15 +44,7 @@ export const marketplace: MarketplaceTemplate[] = [ timeout: 15, usecases: ['Starter'], runtimes: [ - ...getRuntimes(TemplateRuntimes.NODE, 'npm install', 'src/main.js', 'node/starter', [ - '20.0' - ]), - { - name: `node-20.0`, - commands: 'npm install --version=20', - entrypoint: 'src/mainv20.js', - providerRootDirectory: 'node20/starter' - }, + ...getRuntimes(TemplateRuntimes.NODE, 'npm install', 'src/main.js', 'node/starter'), ...getRuntimes( TemplateRuntimes.PHP, 'composer install', From bad30827a057b6223159f03de908b23dacb4b733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 13 Sep 2023 19:28:31 +0200 Subject: [PATCH 08/27] Add bun logo --- static/icons/dark/color/bun.svg | 1 + static/icons/light/color/bun.svg | 1 + 2 files changed, 2 insertions(+) create mode 100644 static/icons/dark/color/bun.svg create mode 100644 static/icons/light/color/bun.svg diff --git a/static/icons/dark/color/bun.svg b/static/icons/dark/color/bun.svg new file mode 100644 index 000000000..7ef15001d --- /dev/null +++ b/static/icons/dark/color/bun.svg @@ -0,0 +1 @@ +Bun Logo \ No newline at end of file diff --git a/static/icons/light/color/bun.svg b/static/icons/light/color/bun.svg new file mode 100644 index 000000000..7ef15001d --- /dev/null +++ b/static/icons/light/color/bun.svg @@ -0,0 +1 @@ +Bun Logo \ No newline at end of file From f1b1ed826a0309164b11210e62ee2ce04b851324 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Wed, 13 Sep 2023 10:50:07 -0700 Subject: [PATCH 09/27] Update template configuration to show supported runtimes There are times when people jump into creating the function without reading the template details. Because templates only support certain runtime versions, it's important to show the supported runtimes in the wizard or else the developer will be confused why their enabled incompatible runtime doesn't show in the Runtime dropdown. --- .../wizards/functions/steps/templateConfiguration.svelte | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib/wizards/functions/steps/templateConfiguration.svelte b/src/lib/wizards/functions/steps/templateConfiguration.svelte index 49be494b6..afa87567a 100644 --- a/src/lib/wizards/functions/steps/templateConfiguration.svelte +++ b/src/lib/wizards/functions/steps/templateConfiguration.svelte @@ -33,6 +33,15 @@ {$template.name} {$template.tagline} +
+
+ Supported runtimes: +
+

+ {#each $template.runtimes as runtime} + {runtime.name} + {/each} +
Date: Wed, 13 Sep 2023 11:47:19 -0700 Subject: [PATCH 10/27] Sort list of supported runtimes A sorted list is easier to scan if a developer is looking for a specific version. --- src/lib/wizards/functions/steps/templateConfiguration.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/wizards/functions/steps/templateConfiguration.svelte b/src/lib/wizards/functions/steps/templateConfiguration.svelte index afa87567a..1f6beac3d 100644 --- a/src/lib/wizards/functions/steps/templateConfiguration.svelte +++ b/src/lib/wizards/functions/steps/templateConfiguration.svelte @@ -38,7 +38,7 @@ Supported runtimes:
- {#each $template.runtimes as runtime} + {#each $template.runtimes.sort((r1, r2) => r1.name.localeCompare(r2.name)) as runtime} {runtime.name} {/each}
From 91df9e05c258ebae55697138b8a8f36d06b81740 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Tue, 12 Sep 2023 17:11:18 -0700 Subject: [PATCH 11/27] Simplify usage of console variables await the data during load so it's available downstream without needing to await. --- src/lib/pages/domains/wizard/step1.svelte | 11 +---------- src/routes/console/+layout.svelte | 5 +---- src/routes/console/+layout.ts | 11 +++++++---- .../settings/updateConfiguration.svelte | 5 +++-- .../templates/template-[template]/+page.svelte | 6 ++++-- .../settings/updateInstallations.svelte | 7 ++++--- src/routes/console/store.ts | 5 +---- 7 files changed, 21 insertions(+), 29 deletions(-) diff --git a/src/lib/pages/domains/wizard/step1.svelte b/src/lib/pages/domains/wizard/step1.svelte index 480a58580..2c8a0e884 100644 --- a/src/lib/pages/domains/wizard/step1.svelte +++ b/src/lib/pages/domains/wizard/step1.svelte @@ -6,21 +6,12 @@ import { sdk } from '$lib/stores/sdk'; import { isSelfHosted } from '$lib/system'; import { func } from '$routes/console/project-[project]/functions/function-[function]/store'; - import { onMount } from 'svelte'; import { ProxyTypes } from '../index.svelte'; import { domain, typeStore } from './store'; import { consoleVariables } from '$routes/console/store'; let error = null; - let isDomainsEnabled = false; - - onMount(async () => { - if (!isSelfHosted) { - return; - } - - isDomainsEnabled = (await $consoleVariables)?._APP_DOMAIN_ENABLED === true; - }); + const isDomainsEnabled = $consoleVariables?._APP_DOMAIN_ENABLED === true; async function createDomain() { try { diff --git a/src/routes/console/+layout.svelte b/src/routes/console/+layout.svelte index c7e0bda5a..cb94ecde7 100644 --- a/src/routes/console/+layout.svelte +++ b/src/routes/console/+layout.svelte @@ -33,10 +33,7 @@ .join(' '); } - let isAssistantEnabled = false; - onMount(async () => { - isAssistantEnabled = (await $consoleVariables)?._APP_ASSISTANT_ENABLED === true; - }); + const isAssistantEnabled = $consoleVariables?._APP_ASSISTANT_ENABLED === true; $: isOnSettingsLayout = $project?.$id ? $page.url.pathname.includes(`project-${$project.$id}/settings`) diff --git a/src/routes/console/+layout.ts b/src/routes/console/+layout.ts index 8221f5d43..fdcdec07f 100644 --- a/src/routes/console/+layout.ts +++ b/src/routes/console/+layout.ts @@ -8,15 +8,18 @@ export const load: LayoutLoad = async ({ fetch, depends }) => { depends(Dependencies.CONSOLE_VARIABLES); const { endpoint, project } = sdk.forConsole.client.config; - const response = await fetch(`${endpoint}/health/version`, { + const versionPromise = fetch(`${endpoint}/health/version`, { headers: { 'X-Appwrite-Project': project } - }); - const data = await response.json(); + }).then((response) => response.json() as { version?: string }); + + const variablesPromise = sdk.forConsole.console.variables(); + + const [data, variables] = await Promise.all([versionPromise, variablesPromise]); return { - consoleVariables: sdk.forConsole.console.variables(), + consoleVariables: variables, version: data?.version ?? null }; }; 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 e29904e78..40060a009 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 @@ -49,9 +49,10 @@ import InputSelectSearch from '$lib/elements/forms/inputSelectSearch.svelte'; import { installations } from '$lib/wizards/functions/store'; import { isSelfHosted } from '$lib/system'; - import { consoleVariables, isVcsEnabled } from '$routes/console/store'; + import { consoleVariables } from '$routes/console/store'; const functionId = $page.params.function; + const isVcsEnabled = $consoleVariables?._APP_VCS_ENABLED === true; let entrypoint: string; let commands: string; @@ -271,7 +272,7 @@ {:else} - {#if isSelfHosted && !isVcsEnabled($consoleVariables)} + {#if isSelfHosted && !isVcsEnabled} Installing Git to a self-hosted instance 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 7a8809820..f76bbf6c3 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 @@ -6,8 +6,10 @@ import { Container } from '$lib/layout'; import { isSelfHosted } from '$lib/system'; import { connectTemplate } from '$lib/wizards/functions/cover.svelte'; - import { consoleVariables, isVcsEnabled } from '$routes/console/store'; + import { consoleVariables } from '$routes/console/store'; import { template } from './store'; + + const isVcsEnabled = $consoleVariables?._APP_VCS_ENABLED === true; @@ -60,7 +62,7 @@

{$template.tagline}

- {#if isSelfHosted && !isVcsEnabled($consoleVariables)} + {#if isSelfHosted && !isVcsEnabled} Cloning templates to a self-hosted instance diff --git a/src/routes/console/project-[project]/settings/updateInstallations.svelte b/src/routes/console/project-[project]/settings/updateInstallations.svelte index a61bd158b..a3c6d5273 100644 --- a/src/routes/console/project-[project]/settings/updateInstallations.svelte +++ b/src/routes/console/project-[project]/settings/updateInstallations.svelte @@ -29,7 +29,7 @@ import GitDisconnectModal from './GitDisconnectModal.svelte'; import dayjs from 'dayjs'; import { isSelfHosted } from '$lib/system'; - import { consoleVariables, isVcsEnabled } from '$routes/console/store'; + import { consoleVariables } from '$routes/console/store'; export let total: number; export let limit: number; @@ -40,6 +40,7 @@ let showGitDisconnect = false; let showInstallationDropdown: boolean[] = []; let selectedInstallation: Models.Installation; + const isVcsEnabled = $consoleVariables?._APP_VCS_ENABLED === true; function getInstallationLink(installation: Models.Installation) { switch (installation.provider) { @@ -180,7 +181,7 @@ bind:offset /> {:else} - {#if isSelfHosted && !isVcsEnabled($consoleVariables)} + {#if isSelfHosted && !isVcsEnabled} Installing Git to a self-hosted instance @@ -203,7 +204,7 @@