diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1f4ef8396..aaac70173 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,11 +22,11 @@ jobs: # run: npm audit --audit-level low - name: Install dependencies run: npm ci - - name: Build Console - run: npm run build - name: Svelte Diagnostics run: npm run check - name: Linter run: npm run lint - name: Unit Tests run: npm test + - name: Build Console + run: npm run build diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ad67fbd68..60baa93de 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,25 +10,30 @@ If you are worried about or don’t know where to start, check out the next sect ``` ├── src -│ ├── lib // All non-route components, accessible over "import ... from '$lib'" -│ │ ├── components // Re-usable components -│ │ ├── elements // Re-usable elements -│ │ ├── layout // Global components for the layout (Nav/Content/Container) -│ │ └── stores // Global stores (state management) -│ └─── routes -│ ├── console // Routes that need authentication -│ │ ├──[project] -│ │ │ ├── database // Database Service -│ │ │ │ ├── [collection] // Nested Route for the collection "/console/[PROJECT_ID]/database/[COLLECTION_ID]" -│ │ │ │ ├── _create.svelte // Component to Create collections -│ │ │ │ └── index.svelte // Entrypoint for "/console/[PROJECT_ID]/database" -│ │ │ ├── storage // Storage Service "/console/[PROJECT]/storage" -│ │ │ └── auth // Users Service "/console/[PROJECT]/auth" -│ │ └──... -│ ├── login.svelte // Component for Login "/console/login" -│ └── register.svelte // Component for Register "/console/register" -├── build // Compiled application -└── static // Static assets +│ ├── lib // Reusable logic (accessible with '$lib') +│ │ ├── actions // Svelte actions +│ │ ├── charts // Chart components +│ │ ├── components // Re-usable components +│ │ ├── elements // Re-usable elements +│ │ ├── helpers // Small functions used through out the console +│ │ ├── images // Images used in the console +│ │ ├── layout // Global components for the layout (Nav/Content/Container) +│ │ ├── mock // Mock components used for testing +│ │ └── stores // Global stores (state management) +│ └── routes +│ └── console // Routes that need authentication +│ │ └── project-[project] +│ │ │ └── database // Database Service +│ │ │ │ ├── +layout.svelte // Layout head and other logic like realtime events is set here +│ │ │ │ ├── +layout.ts // Layout data is set here (Header, Breadcrumbs, ...) +│ │ │ │ ├── +page.svelte // Page displayed on "/console/project-[PROJECT_ID]/database" +│ │ │ │ ├── +page.ts // Necessary data for the page is fetched here +│ │ │ │ └── create.svelte // Component to create databases +│ │ │ └── ... // Other services +│ │ └── ... +│ └── ... // Routes that don't need authentication +├── build // Compiled application +└── static // Static assets ``` ## Development diff --git a/src/lib/components/id.svelte b/src/lib/components/id.svelte index e7fc8754b..1ffaab81a 100644 --- a/src/lib/components/id.svelte +++ b/src/lib/components/id.svelte @@ -3,6 +3,7 @@ export let value: string; export let event: string = null; + export let isCentered = true; function truncateText(node: HTMLElement) { const MAX_TRIES = 100; @@ -46,22 +47,23 @@ } -
- - - -
- + +
+ + + +
- +
-
+ diff --git a/src/lib/elements/table/tableScroll.svelte b/src/lib/elements/table/tableScroll.svelte index 814fe00e5..6d30f8aff 100644 --- a/src/lib/elements/table/tableScroll.svelte +++ b/src/lib/elements/table/tableScroll.svelte @@ -2,11 +2,28 @@ import type { Action } from 'svelte/action'; export let isSticky = false; + let isOverflowing = false; - const hasOverflow: Action void> = (node, callback) => { + const hasOverflow: Action = (node) => { const observer = new ResizeObserver((entries) => { for (const entry of entries) { - callback(entry.contentRect.width < entry.target.scrollWidth); + let overflowing = false; + if (entry.contentRect.width < entry.target.scrollWidth) { + overflowing = true; + } + + const cols = entry.target.querySelectorAll('.table-thead-col'); + for (let i = 0; i < cols.length; i++) { + const col = cols[i]; + const cs = getComputedStyle(col); + const innerWidth = + col.clientWidth - parseFloat(cs.paddingLeft) - parseFloat(cs.paddingRight); + if (innerWidth < 32) { + overflowing = true; + } + } + + isOverflowing = overflowing; } }); @@ -18,12 +35,10 @@ } }; }; - - let isOverflowing = false;
-
(isOverflowing = v)}> +
diff --git a/src/routes/console/project-[project]/auth/gitlabOAuth.svelte b/src/routes/console/project-[project]/auth/gitlabOAuth.svelte index 2b5aea8a6..934d73801 100644 --- a/src/routes/console/project-[project]/auth/gitlabOAuth.svelte +++ b/src/routes/console/project-[project]/auth/gitlabOAuth.svelte @@ -81,7 +81,7 @@ disabled={(secret === provider.secret && enabled === provider.enabled && appId === provider.appId) || - !(appId && clientSecret && endpoint)} + !(appId && clientSecret)} submit>Update diff --git a/src/routes/console/project-[project]/auth/user-[user]/deleteSession.svelte b/src/routes/console/project-[project]/auth/user-[user]/deleteSession.svelte index 29a8a09dc..d30ccd96d 100644 --- a/src/routes/console/project-[project]/auth/user-[user]/deleteSession.svelte +++ b/src/routes/console/project-[project]/auth/user-[user]/deleteSession.svelte @@ -15,6 +15,7 @@ try { await sdk.forProject.users.deleteSession($page.params.user, selectedSessionId); await invalidate(Dependencies.SESSIONS); + showDelete = false; addNotification({ type: 'success', message: 'Session has been deleted' diff --git a/src/routes/console/project-[project]/auth/user-[user]/updateStatus.svelte b/src/routes/console/project-[project]/auth/user-[user]/updateStatus.svelte index 34f4c81b0..60a2189d1 100644 --- a/src/routes/console/project-[project]/auth/user-[user]/updateStatus.svelte +++ b/src/routes/console/project-[project]/auth/user-[user]/updateStatus.svelte @@ -19,7 +19,7 @@ await invalidate(Dependencies.USER); addNotification({ message: `${$user.name || $user.email || $user.phone || 'The account'} has been ${ - $user.emailVerification ? 'unverified' : 'verified' + !$user.emailVerification ? 'unverified' : 'verified' }`, type: 'success' }); diff --git a/src/routes/console/project-[project]/databases/database-[database]/table.svelte b/src/routes/console/project-[project]/databases/database-[database]/table.svelte index 317956ae7..458baaa62 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/table.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/table.svelte @@ -3,13 +3,13 @@ import { page } from '$app/stores'; import { Id } from '$lib/components'; import { - Table, TableBody, TableCell, TableCellHead, TableCellText, TableHeader, - TableRowLink + TableRowLink, + TableScroll } from '$lib/elements/table'; import { toLocaleDateTime } from '$lib/helpers/date'; import type { PageData } from './$types'; @@ -20,7 +20,7 @@ const databaseId = $page.params.database; - + {#each $columns as column} {#if column.show} @@ -54,4 +54,4 @@ {/each} -
+ diff --git a/src/routes/console/project-[project]/databases/table.svelte b/src/routes/console/project-[project]/databases/table.svelte index 401364401..ac63aa184 100644 --- a/src/routes/console/project-[project]/databases/table.svelte +++ b/src/routes/console/project-[project]/databases/table.svelte @@ -3,13 +3,13 @@ import { page } from '$app/stores'; import { Id } from '$lib/components'; import { - Table, TableBody, TableCell, TableCellHead, TableCellText, TableHeader, - TableRowLink + TableRowLink, + TableScroll } from '$lib/elements/table'; import { toLocaleDateTime } from '$lib/helpers/date'; import type { PageData } from './$types'; @@ -19,7 +19,7 @@ const projectId = $page.params.project; - + {#each $columns as column} {#if column.show} @@ -55,4 +55,4 @@ {/each} -
+ diff --git a/src/routes/console/project-[project]/functions/function-[function]/create.svelte b/src/routes/console/project-[project]/functions/function-[function]/create.svelte index 806ff23ca..4d65e044b 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/create.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/create.svelte @@ -62,10 +62,10 @@ function setCodeSnippets(lang: string) { return { Unix: { - code: `appwrite functions createDeployment \\ - --functionId=${functionId} \\ - --entrypoint='index.${lang}' \\ - --code="." \\ + code: `appwrite functions createDeployment \\ + --functionId=${functionId} \\ + --entrypoint='index.${lang}' \\ + --code="." \\ --activate=true`, language: 'bash' }, diff --git a/src/routes/console/project-[project]/functions/function-[function]/header.svelte b/src/routes/console/project-[project]/functions/function-[function]/header.svelte index c878a4b00..f48bc5324 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/header.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/header.svelte @@ -40,7 +40,9 @@ {$func?.name} - Function ID + {#if $func?.$id} + {$func.$id} + {/if} 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 94aadbc6c..85f8265db 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,520 +1,25 @@ - -
-
- technology -
-
- {$func.name} - -

{$func.runtime}

-
-
- -
-
-

Function ID: {$func.$id}

-

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

-

Updated at: {toLocaleDateTime($func.$updatedAt)}

-
-
-
- - - - -
- -
- - Name - - -
    - -
-
- - - - -
-
- -
- - Execute Access -

- Choose who can execute this function using the client API. For more information, - check out the - Permissions Guide - . -

- - - - - - - -
-
- + + + - -
- - Schedule -

- Set a Cron schedule to trigger your function. Leave blank for no schedule. - More details on Cron syntax here. -

- - - - - - - - - -
-
- - - Variables -

Set the variables (or secret keys) that will be passed to your function at runtime.

- -
- - -
- {@const limit = 10} - {@const sum = data.variables.total} - {#if sum} -
- - - Key - Value - - - - {#each data.variables.variables.slice(offset, offset + limit) as variable, i} - - - - {variable.key} - - - - - - - - - - - { - selectedVar = variable; - showVariablesDropdown[i] = false; - showVariablesModal = true; - }}> - Edit - - { - handleVariableDeleted(variable); - showVariablesDropdown[i] = false; - }}> - Delete - - - - - - {/each} - -
- -
-

Total variables: {sum}

- -
-
- {:else} - (showVariablesModal = !showVariablesModal)}> - Create a variable to get started - - {/if} -
-
- -
- - Timeout -

- Limit the execution time of your function. Maximum value is 900 seconds (15 - minutes). -

- - - - - - - - - -
-
- - - Delete Function -

- The function will be permanently deleted, including all deployments associated with it. - This action is irreversible. -

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

Last Updated: {toLocaleDateTime($func.$updatedAt)}

-
-
- - - - -
+ + + +
- - -{#if showVariablesModal} - -{/if} -{#if showVariablesUpload} - -{/if} 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 new file mode 100644 index 000000000..d5ec9fbf4 --- /dev/null +++ b/src/routes/console/project-[project]/functions/function-[function]/settings/dangerZone.svelte @@ -0,0 +1,33 @@ + + + + Delete Function +

+ The function will be permanently deleted, including all deployments associated with it. This + action is irreversible. +

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

Last Updated: {toLocaleDateTime($func.$updatedAt)}

+
+
+ + + + +
+ + diff --git a/src/routes/console/project-[project]/functions/function-[function]/settings/delete.svelte b/src/routes/console/project-[project]/functions/function-[function]/settings/deleteModal.svelte similarity index 100% rename from src/routes/console/project-[project]/functions/function-[function]/settings/delete.svelte rename to src/routes/console/project-[project]/functions/function-[function]/settings/deleteModal.svelte 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 new file mode 100644 index 000000000..194b18bed --- /dev/null +++ b/src/routes/console/project-[project]/functions/function-[function]/settings/executeFunction.svelte @@ -0,0 +1,36 @@ + + + +
+
+ technology +
+
+ {$func.name} + +

{$func.runtime}

+
+
+ +
+
+

Function ID: {$func.$id}

+

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

+

Updated at: {toLocaleDateTime($func.$updatedAt)}

+
+
+
+ + + + +
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 new file mode 100644 index 000000000..431d12e5f --- /dev/null +++ b/src/routes/console/project-[project]/functions/function-[function]/settings/updateName.svelte @@ -0,0 +1,66 @@ + + +
+ + Name + + +
    + +
+
+ + + + +
+
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 new file mode 100644 index 000000000..369f936a9 --- /dev/null +++ b/src/routes/console/project-[project]/functions/function-[function]/settings/updatePermissions.svelte @@ -0,0 +1,78 @@ + + +
+ + Execute Access +

+ Choose who can execute this function using the client API. For more information, check + out the + Permissions Guide + . +

+ + + + + + + +
+
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 new file mode 100644 index 000000000..e60ba6e99 --- /dev/null +++ b/src/routes/console/project-[project]/functions/function-[function]/settings/updateSchedule.svelte @@ -0,0 +1,71 @@ + + +
+ + Schedule +

+ Set a Cron schedule to trigger your function. Leave blank for no schedule. + More details on Cron syntax here. +

+ + + + + + + + + +
+
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 new file mode 100644 index 000000000..94489f929 --- /dev/null +++ b/src/routes/console/project-[project]/functions/function-[function]/settings/updateTimeout.svelte @@ -0,0 +1,66 @@ + + +
+ + Timeout +

Limit the execution time of your function. Maximum value is 900 seconds (15 minutes).

+ + + + + + + + + +
+
diff --git a/src/routes/console/project-[project]/functions/function-[function]/settings/updateVariables.svelte b/src/routes/console/project-[project]/functions/function-[function]/settings/updateVariables.svelte new file mode 100644 index 000000000..c3915babc --- /dev/null +++ b/src/routes/console/project-[project]/functions/function-[function]/settings/updateVariables.svelte @@ -0,0 +1,233 @@ + + + + Variables +

Set the variables (or secret keys) that will be passed to your function at runtime.

+ +
+ + +
+ {@const limit = 10} + {@const sum = variableList.total} + {#if sum} +
+ + + Key + Value + + + + {#each variableList.variables.slice(offset, offset + limit) as variable, i} + + + + {variable.key} + + + + + + + + + + + { + selectedVar = variable; + showVariablesDropdown[i] = false; + showVariablesModal = true; + }}> + Edit + + { + handleVariableDeleted(variable); + showVariablesDropdown[i] = false; + }}> + Delete + + + + + + {/each} + +
+ +
+

Total variables: {sum}

+ +
+
+ {:else} + (showVariablesModal = !showVariablesModal)}> + Create a variable to get started + + {/if} +
+
+ +{#if showVariablesModal} + +{/if} +{#if showVariablesUpload} + +{/if} diff --git a/src/routes/console/project-[project]/functions/function-[function]/settings/uploadVariables.svelte b/src/routes/console/project-[project]/functions/function-[function]/settings/uploadVariablesModal.svelte similarity index 100% rename from src/routes/console/project-[project]/functions/function-[function]/settings/uploadVariables.svelte rename to src/routes/console/project-[project]/functions/function-[function]/settings/uploadVariablesModal.svelte diff --git a/src/routes/console/project-[project]/overview/platforms/wizard/web/step2.svelte b/src/routes/console/project-[project]/overview/platforms/wizard/web/step2.svelte index 9699669ff..bff1c05dc 100644 --- a/src/routes/console/project-[project]/overview/platforms/wizard/web/step2.svelte +++ b/src/routes/console/project-[project]/overview/platforms/wizard/web/step2.svelte @@ -35,8 +35,12 @@ {#if method === Method.NPM}

- Use NPM (node package manager) from your command line to add Appwrite SDK to your project. + Use NPM (node package manager) from your command line to add Appwrite SDK + to your project.

diff --git a/src/routes/console/project-[project]/settings/+page.svelte b/src/routes/console/project-[project]/settings/+page.svelte index ccce2b50b..cf8659329 100644 --- a/src/routes/console/project-[project]/settings/+page.svelte +++ b/src/routes/console/project-[project]/settings/+page.svelte @@ -115,7 +115,10 @@ Services -

Choose services you wish to enable or disable.

+

+ Choose services you wish to enable or disable for the client API. When disabled, the + services are not accessible to client SDKs but remain accessible to server SDKs. +

diff --git a/src/routes/console/project-[project]/settings/webhooks/+page.svelte b/src/routes/console/project-[project]/settings/webhooks/+page.svelte index fde1c291e..1e22b243a 100644 --- a/src/routes/console/project-[project]/settings/webhooks/+page.svelte +++ b/src/routes/console/project-[project]/settings/webhooks/+page.svelte @@ -6,13 +6,13 @@ import { Button } from '$lib/elements/forms'; import { Pill } from '$lib/elements'; import { - Table, TableBody, TableRowLink, TableCellHead, TableCell, TableCellText, - TableHeader + TableHeader, + TableScroll } from '$lib/elements/table'; import { Container } from '$lib/layout'; import { wizard } from '$lib/stores/wizard'; @@ -46,10 +46,10 @@
{#if data.webhooks.total} - + - Name - POST URL + Name + POST URL Events @@ -57,7 +57,7 @@ -
+
{webhook.name} {#if webhook.security === false} SLL/TLS disabled @@ -69,7 +69,7 @@ {/each} -
+ {:else} {$bucket?.name} - Bucket ID + {#if $bucket?.$id} + {$bucket.$id} + {/if}