From 6d9722e2f7b78b298878e713d88e4f0427adabd2 Mon Sep 17 00:00:00 2001 From: Darshan Date: Mon, 30 Dec 2024 16:45:03 +0530 Subject: [PATCH 01/13] fix: buttons not working due to a crash. update: cleaner and better logs for now. --- .../sites/(components)/logs.svelte | 13 ++++++++----- .../sites/create-site/deploying/+page.svelte | 2 -- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/routes/(console)/project-[project]/sites/(components)/logs.svelte b/src/routes/(console)/project-[project]/sites/(components)/logs.svelte index 869e3c77a0..9d36ec555c 100644 --- a/src/routes/(console)/project-[project]/sites/(components)/logs.svelte +++ b/src/routes/(console)/project-[project]/sites/(components)/logs.svelte @@ -81,13 +81,14 @@ lightCyan: [133, 219, 216] }; - function formatLogs(logs: { timestamp: string; content: string }[]) { + // TODO: Fix the buildLogs to return object, currently its a string. + function formatLogs(logs: { timestamp: string; content: string }[] = []) { let output = ''; - const sum = logs.map((n) => n.content).join(''); + const sum = logs.map((n) => `${n.timestamp} ${n.content}`).join('\n'); const iterator = ansicolor.parse(sum); - for (const element of iterator) { + for (const element of iterator.spans) { if (element.color && !element.color.name) output += `${element.text}`; - else output += `${element.text}`; + else output += `${element.text}`; } return output; } @@ -133,7 +134,9 @@ -
{@html formatLogs(buildLogs)}
+
+        {formatLogs(buildLogs)}
+    
diff --git a/src/routes/(console)/project-[project]/sites/create-site/deploying/+page.svelte b/src/routes/(console)/project-[project]/sites/create-site/deploying/+page.svelte index 0d141f98bf..27ee5db1d9 100644 --- a/src/routes/(console)/project-[project]/sites/create-site/deploying/+page.svelte +++ b/src/routes/(console)/project-[project]/sites/create-site/deploying/+page.svelte @@ -8,8 +8,6 @@ import Logs from '../../(components)/logs.svelte'; export let data; - - $: console.log(data.deployment); Date: Mon, 30 Dec 2024 16:51:41 +0530 Subject: [PATCH 02/13] ran: formatter. --- CONTRIBUTING.md | 46 +++++++++---------- README.md | 4 +- .../sites/site-[site]/logs/+page.ts | 18 +++++--- 3 files changed, 36 insertions(+), 32 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8fcb73389c..3d78e77a4c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -108,9 +108,9 @@ pnpm run lint Diagnostic tool that checks for the following: -- Unused CSS -- Svelte A11y hints -- TypeScript compiler errors +- Unused CSS +- Svelte A11y hints +- TypeScript compiler errors ```bash pnpm run check @@ -130,11 +130,11 @@ doc-548-submit-a-pull-request-section-to-contribution-guide When `TYPE` can be: -- **feat** - is a new feature -- **doc** - documentation only changes -- **cicd** - changes related to CI/CD system -- **fix** - a bug fix -- **refactor** - code change that neither fixes a bug nor adds a feature +- **feat** - is a new feature +- **doc** - documentation only changes +- **cicd** - changes related to CI/CD system +- **fix** - a bug fix +- **refactor** - code change that neither fixes a bug nor adds a feature **All PRs must include a commit message with a description of the changes made!** @@ -175,12 +175,12 @@ $ git push origin [name_of_your_new_branch] Before committing always make sure to run all available tools to improve the codebase: -- Formatter - - `pnpm run format` -- Tests - - `pnpm test` -- Diagnostics - - `pnpm run check` +- Formatter + - `pnpm run format` +- Tests + - `pnpm test` +- Diagnostics + - `pnpm run check` ### Performance @@ -188,9 +188,9 @@ Page load times are a key consideration for users of all browsers and device typ There are some general things we can do in front-end development: -- Minimize HTTP requests -- Minimize blocking – content should be readable before client-side processing -- Lazy load "supplementary" content, especially images +- Minimize HTTP requests +- Minimize blocking – content should be readable before client-side processing +- Lazy load "supplementary" content, especially images ### Don't Repeat Yourself (DRY) @@ -202,12 +202,12 @@ If you stick to this principle, you will ensure that you will only ever need to Separate _structure_ from _presentation_ from _behavior_ to aid maintainability and understanding. -- Keep CSS (presentation), JS (behavior) and HTML (structure) in the same respective Svelte component -- Avoid writing inline CSS or Javascript in HTML -- Avoid writing CSS or HTML in Javascript -- Don't choose HTML elements to imply style -- Where appropriate, use CSS or Svelte rather than Javascript for animations and transitions -- Try to use templates when defining markup in Javascript +- Keep CSS (presentation), JS (behavior) and HTML (structure) in the same respective Svelte component +- Avoid writing inline CSS or Javascript in HTML +- Avoid writing CSS or HTML in Javascript +- Don't choose HTML elements to imply style +- Where appropriate, use CSS or Svelte rather than Javascript for animations and transitions +- Try to use templates when defining markup in Javascript ### Write code to be read diff --git a/README.md b/README.md index e37369791b..9e113f1215 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ Appwrite Console has been built with the following frameworks: -- [Svelte](https://svelte.dev/) -- [Svelte Kit](https://kit.svelte.dev/) +- [Svelte](https://svelte.dev/) +- [Svelte Kit](https://kit.svelte.dev/) ## Developer Experience diff --git a/src/routes/(console)/project-[project]/sites/site-[site]/logs/+page.ts b/src/routes/(console)/project-[project]/sites/site-[site]/logs/+page.ts index a5f726fd7f..1975c8ddba 100644 --- a/src/routes/(console)/project-[project]/sites/site-[site]/logs/+page.ts +++ b/src/routes/(console)/project-[project]/sites/site-[site]/logs/+page.ts @@ -21,12 +21,16 @@ export const load = async ({ params, depends, url, route, parent }) => { limit, query, search, - logs: await sdk.forProject.sites.listLogs(params.site, [ - Query.limit(limit), - Query.offset(offset), - Query.orderDesc(''), - ...parsedQueries.values() - ], search), - site, + logs: await sdk.forProject.sites.listLogs( + params.site, + [ + Query.limit(limit), + Query.offset(offset), + Query.orderDesc(''), + ...parsedQueries.values() + ], + search + ), + site }; }; From d5b50f2c49a36405ac5605bba08adcd408a40a6c Mon Sep 17 00:00:00 2001 From: Darshan Date: Mon, 30 Dec 2024 16:56:19 +0530 Subject: [PATCH 03/13] fix: cancel shown on completed or failed builds. --- .../(console)/project-[project]/sites/(components)/logs.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/(console)/project-[project]/sites/(components)/logs.svelte b/src/routes/(console)/project-[project]/sites/(components)/logs.svelte index 869e3c77a0..717f6cc4a2 100644 --- a/src/routes/(console)/project-[project]/sites/(components)/logs.svelte +++ b/src/routes/(console)/project-[project]/sites/(components)/logs.svelte @@ -138,7 +138,7 @@ --> - {#if status !== 'ready'} + {#if ['processing', 'building'].includes(status)} {/if} From c026f1bb9e7897782f68685b819319526db3518e Mon Sep 17 00:00:00 2001 From: Darshan Date: Mon, 30 Dec 2024 17:24:25 +0530 Subject: [PATCH 04/13] fix: text case on button. --- .../project-[project]/sites/site-[site]/domains/+page.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/(console)/project-[project]/sites/site-[site]/domains/+page.svelte b/src/routes/(console)/project-[project]/sites/site-[site]/domains/+page.svelte index ad946681f0..146ee8c13d 100644 --- a/src/routes/(console)/project-[project]/sites/site-[site]/domains/+page.svelte +++ b/src/routes/(console)/project-[project]/sites/site-[site]/domains/+page.svelte @@ -35,7 +35,7 @@ From 8caab5d9743f068c48360bbdfef30b338d8f96db Mon Sep 17 00:00:00 2001 From: Darshan Date: Mon, 30 Dec 2024 17:54:50 +0530 Subject: [PATCH 05/13] fix: env var text for create, update or upload. --- .../(console)/project-[project]/createVariable.svelte | 6 +++--- .../(console)/project-[project]/updateVariables.svelte | 7 ++++--- .../project-[project]/uploadVariablesModal.svelte | 7 ++++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/routes/(console)/project-[project]/createVariable.svelte b/src/routes/(console)/project-[project]/createVariable.svelte index 3987af20ca..435dd8eb37 100644 --- a/src/routes/(console)/project-[project]/createVariable.svelte +++ b/src/routes/(console)/project-[project]/createVariable.svelte @@ -44,9 +44,9 @@ title={`${selectedVar ? 'Update' : 'Create'} ${isGlobal ? 'global' : 'environment'} variable`}> - Set the environment variables or secret keys that will be passed to {isGlobal - ? `all ${product}s within your project` - : `your ${product}s`}. + Set the environment variables or secret keys that will be passed to {!isGlobal + ? `your ${product}s` + : `all functions and sites within your project`}. diff --git a/src/routes/(console)/project-[project]/updateVariables.svelte b/src/routes/(console)/project-[project]/updateVariables.svelte index db30c01cec..9095e604ab 100644 --- a/src/routes/(console)/project-[project]/updateVariables.svelte +++ b/src/routes/(console)/project-[project]/updateVariables.svelte @@ -191,12 +191,12 @@ {#if isGlobal}

- Set the environment variables or secret keys that will be passed to all functions within - your project. + Set the environment variables or secret keys that will be passed to all functions and + sites within your project.

{:else}

- Set the environment variables or secret keys that will be passed to your function. + Set the environment variables or secret keys that will be passed to your {product}. Global variables can be found in project settings Import new {isGlobal ? 'global' : 'environment'} variables from .env - file that will be passed to {isGlobal - ? 'all functions within your project' - : 'your function'}. + file that will be passed to {!isGlobal + ? `your ${product}` + : 'all functions and sites within your project'}.

{#if variableList.total > 0} From 9a73fd2d5af2e34ce3af536229813e35d5491a9a Mon Sep 17 00:00:00 2001 From: Darshan Date: Mon, 30 Dec 2024 18:02:18 +0530 Subject: [PATCH 06/13] fix: copy. --- src/routes/(console)/project-[project]/createVariable.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/(console)/project-[project]/createVariable.svelte b/src/routes/(console)/project-[project]/createVariable.svelte index 435dd8eb37..e8c2bf9b7e 100644 --- a/src/routes/(console)/project-[project]/createVariable.svelte +++ b/src/routes/(console)/project-[project]/createVariable.svelte @@ -45,7 +45,7 @@ Set the environment variables or secret keys that will be passed to {!isGlobal - ? `your ${product}s` + ? `your ${product}` : `all functions and sites within your project`}. From 4f567a88b67abd5bf831f993a31c9e5dc1ef7474 Mon Sep 17 00:00:00 2001 From: Darshan Date: Mon, 30 Dec 2024 18:28:31 +0530 Subject: [PATCH 07/13] fix: update button on silent mode update. --- .../sites/site-[site]/settings/updateRepository.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e85915581f..3c26c9de75 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 @@ -82,7 +82,7 @@ silentMode || undefined, selectedDir || undefined ); - await invalidate(Dependencies.FUNCTION); + await invalidate(Dependencies.SITE); addNotification({ type: 'success', message: `${site.name} git configuration has been updated successfully` From bb64413317047b151c290758875a44c6afc2006b Mon Sep 17 00:00:00 2001 From: Darshan Date: Mon, 30 Dec 2024 19:49:41 +0530 Subject: [PATCH 08/13] fix: update call to sites sdk. --- .../(console)/project-[project]/sites/(components)/logs.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/(console)/project-[project]/sites/(components)/logs.svelte b/src/routes/(console)/project-[project]/sites/(components)/logs.svelte index 9d36ec555c..f9bba0e8a1 100644 --- a/src/routes/(console)/project-[project]/sites/(components)/logs.svelte +++ b/src/routes/(console)/project-[project]/sites/(components)/logs.svelte @@ -95,7 +95,7 @@ async function cancelDeployment() { try { - await sdk.forProject.functions.updateDeploymentBuild( + await sdk.forProject.sites.updateDeploymentBuild( deployment.resourceId, deployment.$id ); From 010e46cdd9f6aa9402a565a1933a8185487ac776 Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 31 Dec 2024 09:21:08 +0530 Subject: [PATCH 09/13] fix: modal not showing title. --- .../project-[project]/uploadVariablesModal.svelte | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/routes/(console)/project-[project]/uploadVariablesModal.svelte b/src/routes/(console)/project-[project]/uploadVariablesModal.svelte index f7943e4eb7..74b6e3f4e9 100644 --- a/src/routes/(console)/project-[project]/uploadVariablesModal.svelte +++ b/src/routes/(console)/project-[project]/uploadVariablesModal.svelte @@ -63,15 +63,14 @@ error = e.message; } } + + const title = `Import new ${isGlobal ? 'global' : 'environment'} variables`; - - - Import new {isGlobal ? 'global' : 'environment'} variables - +

- Import new {isGlobal ? 'global' : 'environment'} variables from + {title} from .env file that will be passed to {!isGlobal ? `your ${product}` From 617bda0ea45c980201f7ee23d205ef188b832ad8 Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 31 Dec 2024 10:00:59 +0530 Subject: [PATCH 10/13] fix: repo still connected on `connect later` behaviour. --- .../create-site/templates/template-[template]/+page.svelte | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/routes/(console)/project-[project]/sites/create-site/templates/template-[template]/+page.svelte b/src/routes/(console)/project-[project]/sites/create-site/templates/template-[template]/+page.svelte index 8cd3b45f45..0c1c12595b 100644 --- a/src/routes/(console)/project-[project]/sites/create-site/templates/template-[template]/+page.svelte +++ b/src/routes/(console)/project-[project]/sites/create-site/templates/template-[template]/+page.svelte @@ -158,6 +158,10 @@ selectedInstallationId = $installation?.$id; repositoryName = name.split(' ').join('-').toLowerCase(); } + + $: if (connectBehaviour === 'later') { + selectedRepository = null; + } From 5c223b61ceda077506312641a1f9b8346820d657 Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 31 Dec 2024 10:30:12 +0530 Subject: [PATCH 11/13] fix: deletion modal text. --- .../sites/site-[site]/settings/deleteModal.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/(console)/project-[project]/sites/site-[site]/settings/deleteModal.svelte b/src/routes/(console)/project-[project]/sites/site-[site]/settings/deleteModal.svelte index b37110436a..76dd3046be 100644 --- a/src/routes/(console)/project-[project]/sites/site-[site]/settings/deleteModal.svelte +++ b/src/routes/(console)/project-[project]/sites/site-[site]/settings/deleteModal.svelte @@ -38,7 +38,7 @@ icon="exclamation" state="warning">

- Are you sure you want to delete this function and all associated deployments from your + Are you sure you want to delete this site and all associated deployments from your project?

From 67f00ebf8bd5bb006c111381ad5c6bd56f06b0fd Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 31 Dec 2024 17:08:54 +0530 Subject: [PATCH 12/13] fix: remove checkboxes from domains tab. --- .../sites/site-[site]/domains/+page.svelte | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/routes/(console)/project-[project]/sites/site-[site]/domains/+page.svelte b/src/routes/(console)/project-[project]/sites/site-[site]/domains/+page.svelte index ad946681f0..4dd32b22fc 100644 --- a/src/routes/(console)/project-[project]/sites/site-[site]/domains/+page.svelte +++ b/src/routes/(console)/project-[project]/sites/site-[site]/domains/+page.svelte @@ -2,7 +2,7 @@ import { base } from '$app/paths'; import { page } from '$app/stores'; import { PaginationWithLimit } from '$lib/components/index.js'; - import { Button, InputCheckbox, InputSearch } from '$lib/elements/forms'; + import { Button, InputSearch } from '$lib/elements/forms'; import Link from '$lib/elements/link.svelte'; import { toLocaleDateTime } from '$lib/helpers/date'; import Container from '$lib/layout/container.svelte'; @@ -40,16 +40,12 @@ - Domain Updated {#each data.domains.rules as domain} - - - Date: Tue, 31 Dec 2024 18:13:14 +0530 Subject: [PATCH 13/13] fix: tooltip content. --- .../sites/(components)/deploymentSource.svelte | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/routes/(console)/project-[project]/sites/(components)/deploymentSource.svelte b/src/routes/(console)/project-[project]/sites/(components)/deploymentSource.svelte index c1bb30049e..caca20106e 100644 --- a/src/routes/(console)/project-[project]/sites/(components)/deploymentSource.svelte +++ b/src/routes/(console)/project-[project]/sites/(components)/deploymentSource.svelte @@ -12,8 +12,6 @@ import { ActionMenu, Layout, Popover, Icon } from '@appwrite.io/pink-svelte'; export let deployment: Models.Deployment; - - $: console.log(deployment); {#if deployment.type === 'vcs'} @@ -40,13 +38,14 @@ {deployment.providerBranch} {#if deployment?.providerCommitMessage && deployment?.providerCommitHash && deployment?.providerCommitUrl} + {deployment?.providerCommitHash?.substring(0, 7)} - {deployment.providerCommitMessage} + {deployment.providerCommitMessage.substring(0, 15)}... {/if}