From d70ed55d3a71ca6cfd3f4ff4c10cc17785f01009 Mon Sep 17 00:00:00 2001 From: ernstmul Date: Thu, 27 Feb 2025 16:55:01 +0100 Subject: [PATCH 01/39] Fix: paddings of sub navigation --- .../collection-[collection]/subNavigation.svelte | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/subNavigation.svelte b/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/subNavigation.svelte index e09f7eba8..aab490865 100644 --- a/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/subNavigation.svelte +++ b/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/subNavigation.svelte @@ -35,15 +35,13 @@ {#if !$isTabletViewport}
-
+
{data.database.name}
{#if data?.allCollections?.total} -
-

- You can also create a function - or using the CLI. - Learn more. -

+

+ You can also create a function + or using the CLI. + Learn more. +

- + diff --git a/src/lib/components/filters/filters.svelte b/src/lib/components/filters/filters.svelte index 1a05210a0..509f283d3 100644 --- a/src/lib/components/filters/filters.svelte +++ b/src/lib/components/filters/filters.svelte @@ -225,24 +225,3 @@ - - diff --git a/src/lib/components/gridItem1.svelte b/src/lib/components/gridItem1.svelte index 502074db7..bcd096071 100644 --- a/src/lib/components/gridItem1.svelte +++ b/src/lib/components/gridItem1.svelte @@ -1,36 +1,30 @@ -
-
-
- -
-
- -
- -
- -
-
+ + + + + +
+ +
+
+ + + +
+ + -
-
-
-
    + + -
-
-
+ + +
- - diff --git a/src/lib/components/mfaChallengeFormList.svelte b/src/lib/components/mfaChallengeFormList.svelte index e04952d95..65b55acea 100644 --- a/src/lib/components/mfaChallengeFormList.svelte +++ b/src/lib/components/mfaChallengeFormList.svelte @@ -33,7 +33,6 @@ export let factors: Models.MfaFactors & { recoveryCode: boolean }; /** If true, the form will be submitted automatically when the code is entered. */ - export let autoSubmit: boolean = true; export let showVerifyButton: boolean = true; export let disabled: boolean = false; export let challenge: Models.MfaChallenge; diff --git a/src/lib/components/modal.svelte b/src/lib/components/modal.svelte index ad51b11c8..ebb4da472 100644 --- a/src/lib/components/modal.svelte +++ b/src/lib/components/modal.svelte @@ -8,7 +8,6 @@ export let show = false; export let error: string = null; - export let closable = true; export let dismissible = true; export let onSubmit: (e: SubmitEvent) => Promise | void = function () { return; diff --git a/src/lib/components/permissions/row.svelte b/src/lib/components/permissions/row.svelte index 631136098..9d28c0144 100644 --- a/src/lib/components/permissions/row.svelte +++ b/src/lib/components/permissions/row.svelte @@ -1,17 +1,24 @@ -
-
- {#if role === 'users'} -
Users
- {:else if role === 'guests'} -
Guests
- {:else if role === 'any'} -
Any
- {:else} -
{ - data = n; - }) - .finally(() => { - tick().then(() => { - instance.setContent(content); - }); - }); - } - }}> - {role} -
-
-
- {#if data} - {@const isUser = role.startsWith('user')} - {@const isTeam = role.startsWith('team')} - {@const isAnonymous = !data.email && !data.phone && isUser} - -
- {/if} -
-
- - - + {#if data?.phone} + Phone: {data?.phone} + {/if} +
+ + View user + + +
+ {:else if isTeam} + Members: {data?.total} +
+ + View team + + +
+ {/if} + + {/await} + {/key} +
+ +{/if} diff --git a/src/lib/components/permissions/team.svelte b/src/lib/components/permissions/team.svelte index b2efaf4d0..340d1961d 100644 --- a/src/lib/components/permissions/team.svelte +++ b/src/lib/components/permissions/team.svelte @@ -93,23 +93,14 @@ - Text + {team.name} - Secondary Text + {team.$id} - - - - {team.name} - - - {team.$id} - - {/each} diff --git a/src/lib/components/permissions/user.svelte b/src/lib/components/permissions/user.svelte index 12410e455..c31f58d9f 100644 --- a/src/lib/components/permissions/user.svelte +++ b/src/lib/components/permissions/user.svelte @@ -17,13 +17,7 @@ Table, Typography } from '@appwrite.io/pink-svelte'; - import { - IconAnonymous, - IconChartSquareBar, - IconCheck, - IconMinus, - IconMinusSm - } from '@appwrite.io/pink-icons-svelte'; + import { IconAnonymous, IconMinusSm } from '@appwrite.io/pink-icons-svelte'; export let show: boolean; export let groups: Writable>; diff --git a/src/lib/components/uploadBox.svelte b/src/lib/components/uploadBox.svelte index 9520cd3c7..721917ca1 100644 --- a/src/lib/components/uploadBox.svelte +++ b/src/lib/components/uploadBox.svelte @@ -4,5 +4,13 @@ {#if $uploader?.isOpen} - uploader.close()} /> + { + return { + name: file.name, + size: file.size, + status: file.status + }; + })} + on:close={() => uploader.close()} /> {/if} diff --git a/src/lib/components/viewSelector.svelte b/src/lib/components/viewSelector.svelte index 7a4727d56..564f2bff4 100644 --- a/src/lib/components/viewSelector.svelte +++ b/src/lib/components/viewSelector.svelte @@ -23,7 +23,6 @@ export let hideView = false; export let hideColumns = false; export let allowNoColumns = false; - export let fullWidthMobile = false; onMount(async () => { if (isCustomCollection) { diff --git a/src/lib/elements/forms/inputDigits.svelte b/src/lib/elements/forms/inputDigits.svelte index 6895d82a4..f6e20f6cd 100644 --- a/src/lib/elements/forms/inputDigits.svelte +++ b/src/lib/elements/forms/inputDigits.svelte @@ -6,11 +6,6 @@ export let required = false; export let disabled = false; export let readonly = false; - export let autofocus = false; - export let fullWidth = false; - export let autoSubmit = true; - - $: console.log(value); - + diff --git a/src/lib/elements/forms/inputSelectSearch.svelte b/src/lib/elements/forms/inputSelectSearch.svelte index 260e7ac02..0ca641f95 100644 --- a/src/lib/elements/forms/inputSelectSearch.svelte +++ b/src/lib/elements/forms/inputSelectSearch.svelte @@ -144,15 +144,3 @@ {error} {/if} --> - - diff --git a/src/lib/elements/selectSearchCheckbox.svelte b/src/lib/elements/selectSearchCheckbox.svelte index e54a4fd33..b7d854c88 100644 --- a/src/lib/elements/selectSearchCheckbox.svelte +++ b/src/lib/elements/selectSearchCheckbox.svelte @@ -3,7 +3,6 @@ import InputCheckbox from './forms/inputCheckbox.svelte'; export let value = false; - export let padding: number | null = null; diff --git a/src/lib/stores/uploader.ts b/src/lib/stores/uploader.ts index 45a9283fa..695c247c0 100644 --- a/src/lib/stores/uploader.ts +++ b/src/lib/stores/uploader.ts @@ -8,6 +8,7 @@ type UploaderFile = { resourceId: string; name: string; progress: number; + size: number; status: 'failed' | 'pending' | 'success'; error?: string; }; @@ -73,6 +74,7 @@ const createUploader = () => { $id: id, resourceId: bucketId, name: file.name, + size: file.size, progress: 0, status: 'pending' }; @@ -104,6 +106,7 @@ const createUploader = () => { $id: '', resourceId: siteId, name: code.name, + size: code.size, progress: 0, status: 'pending' }; diff --git a/src/routes/(console)/project-[project]/auth/templates/+page.svelte b/src/routes/(console)/project-[project]/auth/templates/+page.svelte index 6a5100fdb..d4c752db6 100644 --- a/src/routes/(console)/project-[project]/auth/templates/+page.svelte +++ b/src/routes/(console)/project-[project]/auth/templates/+page.svelte @@ -120,7 +120,7 @@ - + diff --git a/src/routes/(console)/project-[project]/auth/templates/email2FATemplate.svelte b/src/routes/(console)/project-[project]/auth/templates/email2FATemplate.svelte index 66b12f815..811cb15a1 100644 --- a/src/routes/(console)/project-[project]/auth/templates/email2FATemplate.svelte +++ b/src/routes/(console)/project-[project]/auth/templates/email2FATemplate.svelte @@ -7,6 +7,7 @@ import { addNotification } from '$lib/stores/notifications'; import { Id } from '$lib/components'; import { Submit, trackError, trackEvent } from '$lib/actions/analytics'; + import { Layout } from '@appwrite.io/pink-svelte'; const projectId = $page.params.project; let locale = 'en'; @@ -34,11 +35,11 @@ } -
+ {'{{user}}'} {'{{project}}'} {'{{otp}}'} -
+ diff --git a/src/routes/(console)/project-[project]/auth/templates/emailInviteTemplate.svelte b/src/routes/(console)/project-[project]/auth/templates/emailInviteTemplate.svelte index fb7a93500..2e4425eb0 100644 --- a/src/routes/(console)/project-[project]/auth/templates/emailInviteTemplate.svelte +++ b/src/routes/(console)/project-[project]/auth/templates/emailInviteTemplate.svelte @@ -7,6 +7,7 @@ import { addNotification } from '$lib/stores/notifications'; import { Id } from '$lib/components'; import { Submit, trackError, trackEvent } from '$lib/actions/analytics'; + import { Layout } from '@appwrite.io/pink-svelte'; const projectId = $page.params.project; let locale = 'en'; @@ -34,7 +35,7 @@ } -
+ {'{{team}}'} @@ -42,4 +43,4 @@ {'{{project}}'} {'{{redirect}}'} -
+ diff --git a/src/routes/(console)/project-[project]/auth/templates/emailMagicUrlTemplate.svelte b/src/routes/(console)/project-[project]/auth/templates/emailMagicUrlTemplate.svelte index e15372245..19e6c5eb9 100644 --- a/src/routes/(console)/project-[project]/auth/templates/emailMagicUrlTemplate.svelte +++ b/src/routes/(console)/project-[project]/auth/templates/emailMagicUrlTemplate.svelte @@ -7,6 +7,7 @@ import { addNotification } from '$lib/stores/notifications'; import { Id } from '$lib/components'; import { Submit, trackError, trackEvent } from '$lib/actions/analytics'; + import { Layout } from '@appwrite.io/pink-svelte'; const projectId = $page.params.project; @@ -36,11 +37,11 @@ } -
+ {'{{user}}'} {'{{project}}'} {'{{redirect}}'} -
+ diff --git a/src/routes/(console)/project-[project]/auth/templates/emailRecoveryTemplate.svelte b/src/routes/(console)/project-[project]/auth/templates/emailRecoveryTemplate.svelte index 56d028108..e6a9443f6 100644 --- a/src/routes/(console)/project-[project]/auth/templates/emailRecoveryTemplate.svelte +++ b/src/routes/(console)/project-[project]/auth/templates/emailRecoveryTemplate.svelte @@ -7,6 +7,7 @@ import { addNotification } from '$lib/stores/notifications'; import { Id } from '$lib/components'; import { Submit, trackError, trackEvent } from '$lib/actions/analytics'; + import { Layout } from '@appwrite.io/pink-svelte'; const projectId = $page.params.project; @@ -35,11 +36,11 @@ } -
+ {'{{user}}'} {'{{project}}'} {'{{redirect}}'} -
+ diff --git a/src/routes/(console)/project-[project]/auth/templates/emailSessionAlertTemplate.svelte b/src/routes/(console)/project-[project]/auth/templates/emailSessionAlertTemplate.svelte index 8dd83904b..438e8d2dd 100644 --- a/src/routes/(console)/project-[project]/auth/templates/emailSessionAlertTemplate.svelte +++ b/src/routes/(console)/project-[project]/auth/templates/emailSessionAlertTemplate.svelte @@ -7,6 +7,7 @@ import { addNotification } from '$lib/stores/notifications'; import { Id } from '$lib/components'; import { Submit, trackError, trackEvent } from '$lib/actions/analytics'; + import { Layout } from '@appwrite.io/pink-svelte'; const projectId = $page.params.project; let locale = 'en'; @@ -34,7 +35,7 @@ } -
+ {'{{user}}'} @@ -43,4 +44,4 @@ {'{{ipAddress}}'} {'{{country}}'} -
+ diff --git a/src/routes/(console)/project-[project]/auth/templates/emailVerificationTemplate.svelte b/src/routes/(console)/project-[project]/auth/templates/emailVerificationTemplate.svelte index fdef014a1..50466669c 100644 --- a/src/routes/(console)/project-[project]/auth/templates/emailVerificationTemplate.svelte +++ b/src/routes/(console)/project-[project]/auth/templates/emailVerificationTemplate.svelte @@ -38,7 +38,6 @@ - {'{{user}}'} {'{{project}}'} diff --git a/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/+page.svelte b/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/+page.svelte index 3edff9117..6a7deeacb 100644 --- a/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/+page.svelte +++ b/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/+page.svelte @@ -13,7 +13,7 @@ import { Dependencies } from '$lib/constants'; import { Submit, trackEvent, trackError } from '$lib/actions/analytics'; import { collection } from '../store'; - import { Alert } from '@appwrite.io/pink-svelte'; + import { Alert, Link } from '@appwrite.io/pink-svelte'; let showDelete = false; let permissions = $doc?.$permissions; @@ -71,12 +71,10 @@ A user requires appropriate permissions at either the collection level or document level to access a document. If no permissions are configured, no user can access the document - Learn more about database permissions. + rel="noopener noreferrer">Learn more {#if $collection.documentSecurity} {#if showPermissionAlert} diff --git a/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/delete.svelte b/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/delete.svelte index 179f10062..64a355ea7 100644 --- a/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/delete.svelte +++ b/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/delete.svelte @@ -3,19 +3,11 @@ import { base } from '$app/paths'; import { page } from '$app/stores'; import { Submit, trackEvent, trackError } from '$lib/actions/analytics'; - import { Alert, Modal, Trim } from '$lib/components'; + import { Modal, Trim } from '$lib/components'; import { Button, InputChoice } from '$lib/elements/forms'; - import { - TableBody, - TableCell, - TableCellHead, - TableCellText, - TableHeader, - TableRow, - TableScroll - } from '$lib/elements/table'; import { addNotification } from '$lib/stores/notifications'; import { sdk } from '$lib/stores/sdk'; + import { Alert, Selector, Table } from '@appwrite.io/pink-svelte'; import { attributes, collection } from '../store'; import { isRelationship } from './attributes/store'; import type { Models } from '@appwrite.io/console'; @@ -69,48 +61,45 @@ {#if relAttributes?.length}

This document contains the following relationships:

- - - Relation - Setting - - - - {#each relAttributes as attr} - - - - {#if attr.twoWay} - - {:else} - - {/if} - {attr.key} - - - - {attr.onDelete} - - - {Deletion[attr.onDelete]} - - - {/each} - - + + + Relation + Setting + + + {#each relAttributes as attr} + + + + {#if attr.twoWay} + + {:else} + + {/if} + {attr.key} + + + + {attr.onDelete} + + + {Deletion[attr.onDelete]} + + + {/each} +
- To change the selection edit the relationship settings. - -
    - - Delete document from {$collection.name} - -
+ +
{/if} - + diff --git a/src/routes/(console)/project-[project]/storage/bucket-[bucket]/+layout.svelte b/src/routes/(console)/project-[project]/storage/bucket-[bucket]/+layout.svelte index 2dba92726..f6bb5c944 100644 --- a/src/routes/(console)/project-[project]/storage/bucket-[bucket]/+layout.svelte +++ b/src/routes/(console)/project-[project]/storage/bucket-[bucket]/+layout.svelte @@ -19,9 +19,8 @@ label: 'Create file', async callback() { if (!$page.url.pathname.endsWith($bucket.$id)) { - goto(`${base}/project-${$project.$id}/storage/bucket-${$bucket.$id}`); + goto(`${base}/project-${$project.$id}/storage/bucket-${$bucket.$id}/create`); } - showCreateFile(); }, keys: $page.url.pathname.endsWith($bucket.$id) ? ['c'] : ['c', 'f'], group: 'files', diff --git a/src/routes/(console)/project-[project]/storage/bucket-[bucket]/+page.svelte b/src/routes/(console)/project-[project]/storage/bucket-[bucket]/+page.svelte index a351d2c29..1d2d66c63 100644 --- a/src/routes/(console)/project-[project]/storage/bucket-[bucket]/+page.svelte +++ b/src/routes/(console)/project-[project]/storage/bucket-[bucket]/+page.svelte @@ -36,7 +36,6 @@ import { wizard } from '$lib/stores/wizard'; import { getServiceLimit } from '$lib/stores/billing'; import { sdk } from '$lib/stores/sdk.js'; - import Create from './create-file/create.svelte'; import DeleteFile from './deleteFile.svelte'; import { isCloud } from '$lib/system'; import { Layout, Table, Icon } from '@appwrite.io/pink-svelte'; @@ -56,7 +55,8 @@ ? bytesToSize(data.organizationUsage.storageTotal, 'GB') : null; const getPreview = (fileId: string) => - sdk.forProject.storage.getFilePreview(bucketId, fileId, 64, 64).toString() + '&mode=admin'; + sdk.forProject.storage.getFilePreview(bucketId, fileId, 128, 128).toString() + + '&mode=admin'; async function fileDeleted(event: CustomEvent) { showDelete = false; @@ -113,7 +113,10 @@
- @@ -166,7 +169,7 @@ href={`${base}/project-${projectId}/storage/bucket-${bucketId}/file-${file.$id}`}>
- + {file.name}
@@ -242,7 +245,7 @@ single href="https://appwrite.io/docs/products/storage/upload-download" target="file" - on:click={() => wizard.start(Create)} /> + on:click={() => void 0} /> {/if} diff --git a/src/routes/(console)/project-[project]/storage/bucket-[bucket]/create-file/create.svelte b/src/routes/(console)/project-[project]/storage/bucket-[bucket]/create-file/create.svelte deleted file mode 100644 index 2def560a1..000000000 --- a/src/routes/(console)/project-[project]/storage/bucket-[bucket]/create-file/create.svelte +++ /dev/null @@ -1,66 +0,0 @@ - - - diff --git a/src/routes/(console)/project-[project]/storage/bucket-[bucket]/create-file/step1.svelte b/src/routes/(console)/project-[project]/storage/bucket-[bucket]/create-file/step1.svelte deleted file mode 100644 index 137a69381..000000000 --- a/src/routes/(console)/project-[project]/storage/bucket-[bucket]/create-file/step1.svelte +++ /dev/null @@ -1,70 +0,0 @@ - - - - File - Upload a file to add it to your bucket. - - {#if isCloud && fileError === 'File size exceeds the limit'} - {@const size = humanFileSize($bucket.maximumFileSize ?? sizeToBytes(service, 'MB', 1000))} - -

- The maximum file upload size for this bucket is {parseInt(size.value)}{size.unit}. - You can adjust it in your - bucket settings. -

-
- {/if} - - -
- -
- - {#if !showCustomId} -
- (showCustomId = !showCustomId)}> - -
- {:else} -
- -
- {/if} -
-
- - diff --git a/src/routes/(console)/project-[project]/storage/bucket-[bucket]/create-file/step2.svelte b/src/routes/(console)/project-[project]/storage/bucket-[bucket]/create-file/step2.svelte deleted file mode 100644 index 58363e57d..000000000 --- a/src/routes/(console)/project-[project]/storage/bucket-[bucket]/create-file/step2.svelte +++ /dev/null @@ -1,39 +0,0 @@ - - - - Permissions - - Choose who can access your buckets and files. For more information, check out the - - Permissions Guide - . - - {#if $bucket.fileSecurity} -
- - File security enabled - Users will be able to access this file if they have been granted - either File or Bucket permissions. - -
-
- -
- {:else} - - File security disabled - If you want to assign file permissions, navigate to Bucket settings and enable file security. - Otherwise, only Bucket permissions will be used. - - {/if} -
diff --git a/src/routes/(console)/project-[project]/storage/bucket-[bucket]/create-file/store.ts b/src/routes/(console)/project-[project]/storage/bucket-[bucket]/create-file/store.ts deleted file mode 100644 index 6a6eb9248..000000000 --- a/src/routes/(console)/project-[project]/storage/bucket-[bucket]/create-file/store.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { writable } from 'svelte/store'; - -type CreateFile = { - files: FileList | null; - id: string | null; - permissions: string[]; -}; - -const initialState: CreateFile = { - files: null, - id: null, - permissions: [] -}; - -export const createFile = (function initialize() { - const store = writable({ ...initialState }); - - return { - ...store, - reset() { - store.set({ ...initialState }); - } - }; -})(); diff --git a/src/routes/(console)/project-[project]/storage/bucket-[bucket]/create/+page.svelte b/src/routes/(console)/project-[project]/storage/bucket-[bucket]/create/+page.svelte new file mode 100644 index 000000000..6ea327f41 --- /dev/null +++ b/src/routes/(console)/project-[project]/storage/bucket-[bucket]/create/+page.svelte @@ -0,0 +1,168 @@ + + + +
+ +
+ + {#if isCloud && fileError === 'File size exceeds the limit'} + {@const size = humanFileSize( + data.bucket.maximumFileSize ?? sizeToBytes(service, 'MB', 1000) + )} + + The maximum file upload size for this bucket is {parseInt( + size.value + )}{size.unit}. You can adjust it in your + bucket settings. + + {/if} + + Drag and drop files here or click to upload + + {#if files} + { + return { + name: b.name, + size: b.size, + extension: b.type, + removable: true + }; + })} /> + {/if} + + {#if !showCustomId} +
+ (showCustomId = !showCustomId)}> + + File ID + +
+ {:else} + + {/if} +
+
+ +
+ + + Choose who can access your buckets and files. For more information, check + out the + + Permissions Guide + . + + + {#if data.bucket.fileSecurity} + + Users will be able to access this file if they have been granted + either File or Bucket permissions. + + + {:else} + + If you want to assign file permissions, navigate to Bucket settings and + enable file security. Otherwise, only Bucket permissions will be used. + + {/if} + +
+
+
+ + + + + +
diff --git a/src/routes/(console)/project-[project]/storage/create.svelte b/src/routes/(console)/project-[project]/storage/create.svelte index d4043ee25..4af12b893 100644 --- a/src/routes/(console)/project-[project]/storage/create.svelte +++ b/src/routes/(console)/project-[project]/storage/create.svelte @@ -6,6 +6,8 @@ import { addNotification } from '$lib/stores/notifications'; import { sdk } from '$lib/stores/sdk'; import { ID } from '@appwrite.io/console'; + import { IconPencil } from '@appwrite.io/pink-icons-svelte'; + import { Icon, Tag } from '@appwrite.io/pink-svelte'; import { createEventDispatcher } from 'svelte'; export let showCreate = false; @@ -46,26 +48,25 @@ - - + - {#if !showCustomId} -
- (showCustomId = !showCustomId)}> - -
- {:else} - - {/if} -
+ {#if !showCustomId} +
+ { + showCustomId = true; + }}> Bucket ID +
+ {:else} + + {/if} diff --git a/src/routes/(console)/project-[project]/storage/grid.svelte b/src/routes/(console)/project-[project]/storage/grid.svelte index 1714c61c9..4ff674aeb 100644 --- a/src/routes/(console)/project-[project]/storage/grid.svelte +++ b/src/routes/(console)/project-[project]/storage/grid.svelte @@ -4,7 +4,7 @@ import { CardContainer, GridItem1, Id } from '$lib/components'; import Pill from '$lib/elements/pill.svelte'; import { canWriteBuckets } from '$lib/stores/roles'; - import { Tooltip } from '@appwrite.io/pink-svelte'; + import { Badge, Tooltip } from '@appwrite.io/pink-svelte'; import type { PageData } from './$types'; export let data: PageData; @@ -25,35 +25,24 @@ {bucket.name} {#if !bucket.enabled} - Disabled +
+ +
{/if}
{bucket.$id} -
  • - - -
  • -
  • - - -
  • + +
    {/each} From 735de2bdd2b8ee30a70e6a5251183f99ef5ce711 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 4 Mar 2025 15:18:53 +0100 Subject: [PATCH 35/39] fix: repository name too reactive --- .../templates/template-[template]/+page.svelte | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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 0e1bcf140..4a52ac04a 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 @@ -54,7 +54,7 @@ let rootDir = './'; let connectBehaviour: 'now' | 'later' = 'now'; let repositoryBehaviour: 'new' | 'existing' = 'new'; - let repositoryName = ''; + let repositoryName = undefined; let repositoryPrivate = true; let selectedInstallationId = ''; let selectedRepository = ''; @@ -202,13 +202,15 @@ $: if (repositoryBehaviour === 'new') { selectedInstallationId = $installation?.$id; - repositoryName = name.split(' ').join('-').toLowerCase(); + repositoryName ??= name.split(' ').join('-').toLowerCase(); } $: if (connectBehaviour === 'later') { selectedRepository = null; } + $: console.log(repositoryName); + $: console.log(data.template); $: console.log(variables); @@ -330,11 +332,8 @@ {/if} - {:else} - {#if data.template.variables?.length} - - {/if} - + {:else if data.template.variables?.length} + {/if} {/if}
    From 63de27b81a731b19e3752a32b7bbf38e2144ea09 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 4 Mar 2025 15:22:45 +0100 Subject: [PATCH 36/39] chore: clean commented out stuff --- .../repository-[repository]/+page.svelte | 14 +------------- .../templates/template-[template]/+page.svelte | 3 +-- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/routes/(console)/project-[project]/sites/create-site/repositories/repository-[repository]/+page.svelte b/src/routes/(console)/project-[project]/sites/create-site/repositories/repository-[repository]/+page.svelte index 3ba558312..bf0704816 100644 --- a/src/routes/(console)/project-[project]/sites/create-site/repositories/repository-[repository]/+page.svelte +++ b/src/routes/(console)/project-[project]/sites/create-site/repositories/repository-[repository]/+page.svelte @@ -13,13 +13,12 @@ import { IconGithub } from '@appwrite.io/pink-icons-svelte'; import { writable } from 'svelte/store'; import Details from '../../details.svelte'; - import ProductionBranch from '../../../../../../../lib/components/git/productionBranchFieldset.svelte'; + import ProductionBranch from '$lib/components/git/productionBranchFieldset.svelte'; import Aside from '../../aside.svelte'; import { BuildRuntime, Framework, ID, Type } from '@appwrite.io/console'; import type { Models } from '@appwrite.io/console'; import { onMount } from 'svelte'; import Configuration from '../../configuration.svelte'; - // import Domain from '../../domain.svelte'; import { consoleVariables } from '$routes/(console)/store'; import { buildVerboseDomain } from '../../store'; import { project } from '$routes/(console)/project-[project]/store'; @@ -42,7 +41,6 @@ let variables: Partial[] = []; let silentMode = false; let domain = id; - // let domainIsValid = true; onMount(async () => { installation.set(data.installation); @@ -66,14 +64,6 @@ } async function create() { - // if (!domainIsValid) { - // addNotification({ - // type: 'error', - // message: 'Please enter a valid domain' - // }); - // return; - // } else {} - try { domain = await buildVerboseDomain( data.repository.name, @@ -204,8 +194,6 @@ bind:selectedFramework={framework} bind:variables frameworks={data.frameworks.frameworks} /> - - 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 4a52ac04a..fec535f81 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 @@ -23,11 +23,10 @@ import { writable } from 'svelte/store'; import Details from '../../details.svelte'; import ConnectBehaviour from './connectBehaviour.svelte'; - import ProductionBranch from '../../../../../../../lib/components/git/productionBranchFieldset.svelte'; + import ProductionBranch from '$lib/components/git/productionBranchFieldset.svelte'; import Configuration from './configuration.svelte'; import Aside from '../../aside.svelte'; import { Adapter, BuildRuntime, Framework, ID } from '@appwrite.io/console'; - // import Domain from '../../domain.svelte'; import { NewRepository, Repositories, RepositoryBehaviour } from '$lib/components/git'; import { getFrameworkIcon } from '../../../store'; import { app, iconPath } from '$lib/stores/app'; From 3a4e4340f812dc1b63a076d6e769c93916ede6d3 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 4 Mar 2025 16:03:28 +0100 Subject: [PATCH 37/39] feat: function creation fixes for pink 2 --- src/lib/components/git/repositories.svelte | 20 ++- .../(components)/details.svelte | 2 +- .../functions/create-function/+page.svelte | 116 ++++++++++-------- .../repository-[repository]/+page.svelte | 5 +- .../configuration.svelte | 7 +- 5 files changed, 84 insertions(+), 66 deletions(-) diff --git a/src/lib/components/git/repositories.svelte b/src/lib/components/git/repositories.svelte index 993040b9c..53f1fafc9 100644 --- a/src/lib/components/git/repositories.svelte +++ b/src/lib/components/git/repositories.svelte @@ -1,9 +1,7 @@ - -{#if hasInstallations} - {#await loadInstallations()} -
    -
      - -
    -
      - -
    -
    - {:then installations} - - { - return { - label: entry.organization, - value: entry.$id - }; - })} - on:change={() => { - search = ''; - installation.set( - installations.find((entry) => entry.$id === selectedInstallation) - ); - }} - bind:value={selectedInstallation} /> - - - {/await} -

    - Manage organization configuration in your project settings. -

    - {#if selectedInstallation} - {#await loadRepositories(selectedInstallation, search)} -
    -
    -
    - {:then response} - {#if response?.length} -
      - {#each response as repo, i} -
    • -
      -
      - {#if action === 'select'} - repository.set(repo)} - value={repo.id} /> - {/if} -
      - {#if repo.runtime} - {repo.name} - {/if} -
      -
      - {repo.name} - {#if repo.private} -
      - {#if action === 'button'} -
      - -
      - {/if} -
      -
      -
    • - {/each} -
    - {:else if search} - -
    -
    - Sorry we couldn't find "{search}" -

    There are no repositories that match your search.

    -
    -
    - -
    -
    -
    - {:else} - - {/if} - {/await} - {/if} -{:else} -
    - - - - -
    -{/if} - - diff --git a/src/lib/wizards/functions/components/specificationsTooltip.svelte b/src/lib/wizards/functions/components/specificationsTooltip.svelte deleted file mode 100644 index 279f5a0f1..000000000 --- a/src/lib/wizards/functions/components/specificationsTooltip.svelte +++ /dev/null @@ -1,24 +0,0 @@ - - -
    -

    Additional CPU and RAM are available for Pro and Scale teams.

    -
    - Learn more - -
    -
    - - diff --git a/src/lib/wizards/functions/connectExisting.svelte b/src/lib/wizards/functions/connectExisting.svelte deleted file mode 100644 index a619870d2..000000000 --- a/src/lib/wizards/functions/connectExisting.svelte +++ /dev/null @@ -1,81 +0,0 @@ - - - diff --git a/src/lib/wizards/functions/cover.svelte b/src/lib/wizards/functions/cover.svelte deleted file mode 100644 index d31eaae83..000000000 --- a/src/lib/wizards/functions/cover.svelte +++ /dev/null @@ -1,317 +0,0 @@ - - - - - - Create function -
    -
    -
    -
    - Connect Git repository -

    - Create and deploy a function with a connected git repository. -

    -
    - -
    - {#if isSelfHosted && !isVcsEnabled} -
    -
    - - Connect your self-hosted instance to Git - -

    - Configure your self-hosted instance to connect your function to - a Git repository. - Learn more. -

    -
    -
    - {/if} -
    - -
    -
    - Quick start -

    Use a starter template.

    -
      - {#await Promise.all([$baseRuntimesList, $starterTemplate])} - {#each Array(6) as _i} -
    • - -
    • - {/each} - {:then [response, quickStart]} - {@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 templates.length < 6} - -
    • - - - -
    • - More runtimes coming soon -
      - {/if} - {/await} -
    -
    - - -
    -
    - Templates -

    - Find the right template for your use case. -

    - -
      - {#await $featuredTemplatesList} - {#each Array(3) as _i} -
    • - -
    • - {/each} - {:then templatesListWithoutStarter} - {#each templatesListWithoutStarter.templates as template} -
    • - -
    • - {/each} - {/await} -
    -
    - -
    -
    -

    - You can also create a function - or using the CLI. - Learn more. -

    -
    -
    - - - diff --git a/src/lib/wizards/functions/createGit.svelte b/src/lib/wizards/functions/createGit.svelte deleted file mode 100644 index 751487c0e..000000000 --- a/src/lib/wizards/functions/createGit.svelte +++ /dev/null @@ -1,91 +0,0 @@ - - - diff --git a/src/lib/wizards/functions/createManual.svelte b/src/lib/wizards/functions/createManual.svelte deleted file mode 100644 index 586b580c6..000000000 --- a/src/lib/wizards/functions/createManual.svelte +++ /dev/null @@ -1,109 +0,0 @@ - - - diff --git a/src/lib/wizards/functions/createTemplate.svelte b/src/lib/wizards/functions/createTemplate.svelte deleted file mode 100644 index ae703bc45..000000000 --- a/src/lib/wizards/functions/createTemplate.svelte +++ /dev/null @@ -1,128 +0,0 @@ - - - diff --git a/src/lib/wizards/functions/steps/createRepository.svelte b/src/lib/wizards/functions/steps/createRepository.svelte deleted file mode 100644 index aecb74761..000000000 --- a/src/lib/wizards/functions/steps/createRepository.svelte +++ /dev/null @@ -1,179 +0,0 @@ - - - - Repository - - Select a Git repository that will trigger your function deployments when updated. - - - {#if $templateConfig.repositoryBehaviour === 'existing'} - - {:else} - {#await loadInstallations()} -
    -
    -
    - {:then installations} - {#if hasInstallations} - - { - return { - label: entry.organization, - value: entry.$id - }; - })} - on:change={() => { - $installation = installations.find( - (entry) => entry.$id === selectedInstallationId - ); - }} - bind:value={selectedInstallationId} /> - - {:else} -
    - - - - -
    - {/if} - {#if $installation} - -
    -
    - -
    -
    -
    - {$installation.organization}/{$templateConfig.repositoryName} -
    -
    -
    -
    - - - - -
    -
    - {/if} - {/await} - {/if} - diff --git a/src/lib/wizards/functions/steps/executeAccess.svelte b/src/lib/wizards/functions/steps/executeAccess.svelte deleted file mode 100644 index 64f2ec6d9..000000000 --- a/src/lib/wizards/functions/steps/executeAccess.svelte +++ /dev/null @@ -1,21 +0,0 @@ - - - - Permissions - - Choose who can execute this function using the client API. For more information, visit our - - Permissions guide. - - - - diff --git a/src/lib/wizards/functions/steps/functionConfiguration.svelte b/src/lib/wizards/functions/steps/functionConfiguration.svelte deleted file mode 100644 index cafa196af..000000000 --- a/src/lib/wizards/functions/steps/functionConfiguration.svelte +++ /dev/null @@ -1,120 +0,0 @@ - - - - Configuration - - Set your deployment configuration and any build commands here. - - - - {#if !showCustomId} -
    - (showCustomId = !showCustomId)}> - -
    - {:else} - - {/if} - - {#if detectingRuntime} - - {:else} - - {/if} - - - - - Build commands - (optional) - - - - - -
    -
    diff --git a/src/lib/wizards/functions/steps/gitConfiguration.svelte b/src/lib/wizards/functions/steps/gitConfiguration.svelte deleted file mode 100644 index 8788b50cc..000000000 --- a/src/lib/wizards/functions/steps/gitConfiguration.svelte +++ /dev/null @@ -1,94 +0,0 @@ - - - - Branch - - Choose the Git branch that will trigger your function deployments when updated. - - - -
    - -
    {$installation.organization}/{$repository.name}
    -
    - {#await loadBranches()} -
    -
    -
    - {:then branches} - {@const options = - branches - ?.map((branch) => { - return { - value: branch.name, - label: branch.name - }; - }) - ?.sort((a, b) => { - return a.label > b.label ? 1 : -1; - }) ?? []} -
    - - { - $choices.branch = event.detail.value; - }} - interactiveOutput - name="branches" - {options} /> - - - -
    - {/await} - -

    - Visit your repository on GitHub. -

    - diff --git a/src/lib/wizards/functions/steps/manualConfiguration.svelte b/src/lib/wizards/functions/steps/manualConfiguration.svelte deleted file mode 100644 index 11e86decb..000000000 --- a/src/lib/wizards/functions/steps/manualConfiguration.svelte +++ /dev/null @@ -1,42 +0,0 @@ - - - - Configuration - - Set your deployment configuration and any build commands here. - - - - - - - - Build commands - (optional) - - - - - - - diff --git a/src/lib/wizards/functions/steps/manualDetails.svelte b/src/lib/wizards/functions/steps/manualDetails.svelte deleted file mode 100644 index 9167474d0..000000000 --- a/src/lib/wizards/functions/steps/manualDetails.svelte +++ /dev/null @@ -1,84 +0,0 @@ - - - - Details - Create and deploy your function manually. - - - - - - - - {#if !showCustomId} -
    - (showCustomId = !showCustomId)}> - -
    - {:else} - - {/if} -
    -
    diff --git a/src/lib/wizards/functions/steps/selectRepository.svelte b/src/lib/wizards/functions/steps/selectRepository.svelte deleted file mode 100644 index 8ae8a1b14..000000000 --- a/src/lib/wizards/functions/steps/selectRepository.svelte +++ /dev/null @@ -1,23 +0,0 @@ - - - - Repository - - Select a Git repository that will trigger your function deployments when updated. - - - diff --git a/src/lib/wizards/functions/steps/templateConfiguration.svelte b/src/lib/wizards/functions/steps/templateConfiguration.svelte deleted file mode 100644 index 190e338e0..000000000 --- a/src/lib/wizards/functions/steps/templateConfiguration.svelte +++ /dev/null @@ -1,128 +0,0 @@ - - - - {$template.name} - - {$template.tagline} - - - - {#await loadRuntimes()} - - {:then options} - - {/await} - {#await loadSpecifications()} - - {:then specificationOptions} - - {/await} - - {#if !showCustomId} -
    - (showCustomId = !showCustomId)}> - -
    - {:else} - - {/if} -
    -
    diff --git a/src/lib/wizards/functions/steps/templateDeployment.svelte b/src/lib/wizards/functions/steps/templateDeployment.svelte deleted file mode 100644 index 524ce1272..000000000 --- a/src/lib/wizards/functions/steps/templateDeployment.svelte +++ /dev/null @@ -1,62 +0,0 @@ - - - - Deployment - - -

    Connect with Git Recommended

    - - Create a new repository - Clone the template to a newly created repository in your organization. - - - Add to existing repository - Clone the template to an existing repository in your organization. - - -

    Quick start

    - - Connect later - Deploy now and continue development via CLI, or connect Git from your function settings. - -
    -
    diff --git a/src/lib/wizards/functions/steps/templatePermissions.svelte b/src/lib/wizards/functions/steps/templatePermissions.svelte deleted file mode 100644 index 42a4474f1..000000000 --- a/src/lib/wizards/functions/steps/templatePermissions.svelte +++ /dev/null @@ -1,90 +0,0 @@ - - - - Permissions - - Enable recommended scopes and execute access for when your function is deployed. - -

    Execute permissions

    - - - - {#if templateScopes.length > 0} -

    Function scopes

    - - {#each templateScopes as scope, i} - - {#if i < templateScopes.length - 1} -
    - {/if} - {/each} -
    - {/if} -
    diff --git a/src/lib/wizards/functions/steps/templateVariables.svelte b/src/lib/wizards/functions/steps/templateVariables.svelte deleted file mode 100644 index c7db15bd4..000000000 --- a/src/lib/wizards/functions/steps/templateVariables.svelte +++ /dev/null @@ -1,124 +0,0 @@ - - - - Variables - - Edit the values of the environment variables that will be passed to your function at - runtime. - - {#if $template?.variables?.length} - {#if requiredVariables?.length} - - - Required variables - - {requiredVariables.length} - - - - {#each requiredVariables as variable} -
    - - - {@html variable.description} - -
    - {/each} -
    -
    -
    - {/if} - - {#if optionalVariables?.length} - - - Optional variables - - {optionalVariables.length} - - - - {#each optionalVariables as variable} -
    - - - - {@html variable.description} - -
    - {/each} -
    -
    -
    - {/if} - {:else} - -

    There are no environment variables to configure.

    -
    - {/if} -
    diff --git a/src/lib/wizards/functions/store.ts b/src/lib/wizards/functions/store.ts deleted file mode 100644 index 6613438a2..000000000 --- a/src/lib/wizards/functions/store.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { page } from '$app/stores'; -import type { WizardStepsType } from '$lib/layout/wizardWithSteps.svelte'; -import type { Models } from '@appwrite.io/console'; -import { derived, writable, type Writable } from 'svelte/store'; - -export const template = writable(); -export const templateConfig = writable<{ - $id: string; - name: string; - runtime: string; - variables: { [key: string]: unknown }; - repositoryBehaviour: 'new' | 'existing' | 'manual'; - repositoryName?: string; - repositoryPrivate?: boolean; - repositoryId: string; - execute?: boolean; - scopes?: string[]; - specification?: string; -}>(); -export const repository = writable(); -export const installation = writable(); -export const choices = writable<{ - branch: string; - rootDir: string; - silentMode: boolean; -}>({ - branch: null, - rootDir: null, - silentMode: null -}); - -export const installations = derived( - page, - ($page) => $page.data.installations as Models.InstallationList -); - -const initialCreateFunction: Partial = { - $id: null, - name: null, - entrypoint: null, - execute: [], - runtime: null, - commands: null -}; - -function createFunctionStore() { - const store = writable>({ - ...initialCreateFunction - }); - - const reset = () => { - store.set({ ...initialCreateFunction }); - }; - - return { - ...store, - reset - }; -} -export const createFunction = createFunctionStore(); - -export const createFunctionDeployment = writable(); - -export const templateStepsComponents: Writable = writable(new Map()); diff --git a/src/routes/(console)/project-[project]/functions/+page.svelte b/src/routes/(console)/project-[project]/functions/+page.svelte index a55213621..8fc84231b 100644 --- a/src/routes/(console)/project-[project]/functions/+page.svelte +++ b/src/routes/(console)/project-[project]/functions/+page.svelte @@ -13,7 +13,6 @@ import { toLocaleDateTime } from '$lib/helpers/date'; import { Container, ContainerHeader } from '$lib/layout'; import { isServiceLimited } from '$lib/stores/billing'; - import { templatesList } from '$lib/stores/templates'; import { organization } from '$lib/stores/organization'; import { wizard } from '$lib/stores/wizard'; import Initial from '$lib/wizards/functions/cover.svelte'; @@ -46,7 +45,7 @@ const template = $page.url.searchParams.get('template'); const templateConfig = $page.url.searchParams.get('templateConfig'); templateStore.set( - (await $templatesList).templates.find((item) => item.id === template) + data.templatesList.templates.find((item) => item.id === template) ); templateConfigStore.set(JSON.parse(templateConfig)); wizard.start(CreateTemplate); diff --git a/src/routes/(console)/project-[project]/functions/+page.ts b/src/routes/(console)/project-[project]/functions/+page.ts index e12234637..96f2b6489 100644 --- a/src/routes/(console)/project-[project]/functions/+page.ts +++ b/src/routes/(console)/project-[project]/functions/+page.ts @@ -2,10 +2,10 @@ import { Query } from '@appwrite.io/console'; import { sdk } from '$lib/stores/sdk'; import { getLimit, getPage, pageToOffset } from '$lib/helpers/load'; import { CARD_LIMIT, Dependencies } from '$lib/constants'; -import type { PageLoad } from './$types'; -export const load: PageLoad = async ({ url, depends, route }) => { +export const load = async ({ url, depends, route, parent }) => { depends(Dependencies.FUNCTIONS); + const { templatesList } = await parent(); const page = getPage(url); const limit = getLimit(url, route, CARD_LIMIT); @@ -18,6 +18,7 @@ export const load: PageLoad = async ({ url, depends, route }) => { Query.limit(limit), Query.offset(offset), Query.orderDesc('') - ]) + ]), + templatesList }; }; diff --git a/src/routes/(console)/project-[project]/functions/create-function/+page.svelte b/src/routes/(console)/project-[project]/functions/create-function/+page.svelte index 75cf1a0a8..6bea578fb 100644 --- a/src/routes/(console)/project-[project]/functions/create-function/+page.svelte +++ b/src/routes/(console)/project-[project]/functions/create-function/+page.svelte @@ -27,8 +27,7 @@
    - - + + - + Connect Git repository - + @@ -100,30 +118,20 @@ - + -
    -
    + + Quick start -

    Use a starter template.

    -
      - {#await Promise.all([$baseRuntimesList, $starterTemplate])} + + {#await Promise.all([$baseRuntimesList, starterTemplate])} {#each Array(6) as _i} -
    • - -
    • + + + + + + {/each} {:then [response, quickStart]} {@const runtimes = new Map(response.runtimes.map((r) => [r.$id, r]))} @@ -132,131 +140,91 @@ )} {#each templates.slice(0, 6) as template} {@const runtimeDetail = runtimes.get(template.name)} -
    • - -
    • + + + {/each} {#if templates.length < 6} -
    • - - - -
    • + + + More runtimes coming soon
      {/if} {/await} -
    -
    + - -
    -
    - Templates -

    - Find the right template for your use case. -

    +
      - {#await $featuredTemplatesList} - {#each Array(3) as _i} -
    • - -
    • - {/each} - {:then templatesListWithoutStarter} - {#each templatesListWithoutStarter.templates as template} -
    • - -
    • - {/each} - {/await} + {#each featuredTemplatesList as template} + { + trackEvent('click_connect_template', { + from: 'cover', + template: template.id + }); + }}> + + + + {template.name} + + + + + {template.tagline} + + + + {/each}
    -
    - -
    + + +

    @@ -277,7 +245,7 @@ >.

    - + {/if}