From 869813ed3ebd256b2ecfeb6e27fd935246f70905 Mon Sep 17 00:00:00 2001 From: Darshan Date: Mon, 2 Dec 2024 14:56:43 +0530 Subject: [PATCH 01/87] remove: `icon-x` button in a read-only view. --- src/lib/components/collapsibleItem.svelte | 7 +- .../billing/+page.svelte | 4 +- .../billing/availableCredit.svelte | 4 +- .../billing/budgetAlert.svelte | 126 ++++--- .../billing/budgetCap.svelte | 12 +- .../billing/paymentHistory.svelte | 246 +++++++------- .../billing/paymentMethods.svelte | 198 +++++------ .../billing/planSummary.svelte | 316 ++++++++++-------- 8 files changed, 497 insertions(+), 416 deletions(-) diff --git a/src/lib/components/collapsibleItem.svelte b/src/lib/components/collapsibleItem.svelte index a16b63460..f98c8845e 100644 --- a/src/lib/components/collapsibleItem.svelte +++ b/src/lib/components/collapsibleItem.svelte @@ -7,12 +7,15 @@ export let noContent = false; export let isInfo = false; export let gap = 16; + + export let style = null; + export let wrapperStyle = null;
  • {#if noContent} -
    -
    +
    +
    diff --git a/src/routes/(console)/organization-[organization]/billing/+page.svelte b/src/routes/(console)/organization-[organization]/billing/+page.svelte index d3d6b7fd1..23802e081 100644 --- a/src/routes/(console)/organization-[organization]/billing/+page.svelte +++ b/src/routes/(console)/organization-[organization]/billing/+page.svelte @@ -130,9 +130,7 @@ - {#if $organization?.billingPlan !== BillingPlan.FREE && !!$organization?.billingBudget} - - {/if} + diff --git a/src/routes/(console)/organization-[organization]/billing/availableCredit.svelte b/src/routes/(console)/organization-[organization]/billing/availableCredit.svelte index b0a1efd7f..6efbb5434 100644 --- a/src/routes/(console)/organization-[organization]/billing/availableCredit.svelte +++ b/src/routes/(console)/organization-[organization]/billing/availableCredit.svelte @@ -90,7 +90,9 @@ - Available credit + + {$organization?.billingPlan === BillingPlan.FREE ? 'Credit' : 'Available credit'} +

    Appwrite credit will automatically be applied to your next invoice.

    diff --git a/src/routes/(console)/organization-[organization]/billing/budgetAlert.svelte b/src/routes/(console)/organization-[organization]/billing/budgetAlert.svelte index a75439aac..9c391398b 100644 --- a/src/routes/(console)/organization-[organization]/billing/budgetAlert.svelte +++ b/src/routes/(console)/organization-[organization]/billing/budgetAlert.svelte @@ -1,8 +1,9 @@ - - Payment history +{#if $organization?.billingPlan === BillingPlan.FREE && invoiceList.total > 0} + + Payment history -

    - Transaction history for this organization. Download invoices for more details about your - payments. -

    - - {#if invoiceList.total > 0} - - - Due Date - Status - Amount Due - - - - {#each invoiceList?.invoices as invoice, i} - {@const status = invoice.status} - - - {toLocaleDate(invoice.dueAt)} - - - {#if invoice?.lastError} - +

    + Transaction history for this organization. Download invoices for more details about your + payments. +

    + + {#if invoiceList.total > 0} + + + Due Date + Status + Amount Due + + + + {#each invoiceList?.invoices as invoice, i} + {@const status = invoice.status} + + + {toLocaleDate(invoice.dueAt)} + + + {#if invoice?.lastError} + + (showFailedError = true)} + button> + {status === 'requires_authentication' + ? 'failed' + : status} + + +
  • + The scheduled payment has failed. + + . +
  • + + + {:else} (showFailedError = true)} - button> + warning={status === 'pending'}> {status === 'requires_authentication' ? 'failed' : status} - -
  • - The scheduled payment has failed. . -
  • -
    - - {:else} - - {status === 'requires_authentication' ? 'failed' : status} - - {/if} - - - {formatCurrency(invoice.grossAmount)} - - - - - - (showDropdown[i] = !showDropdown[i])} - event="view_invoice"> - View invoice - - + + {formatCurrency(invoice.grossAmount)} + + + + + + + (showDropdown[i] = !showDropdown[i])} + event="view_invoice"> + View invoice + + { - retryPayment(invoice); showDropdown[i] = !showDropdown[i]; - trackEvent(`click_retry_payment`, { - from: 'button', - source: 'billing_invoice_menu' - }); - }}> - Retry payment - - {/if} - - - - - {/each} - - -
    -

    Total results: {invoiceList?.total ?? 0}

    - -
    - {:else} - -

    - You have no payment history. After you receive your first invoice, you'll see it - here. -

    -
    - {/if} -
    - + }} + event="download_invoice"> + Download PDF + + {#if status === 'overdue' || status === 'failed'} + { + retryPayment(invoice); + showDropdown[i] = !showDropdown[i]; + trackEvent(`click_retry_payment`, { + from: 'button', + source: 'billing_invoice_menu' + }); + }}> + Retry payment + + {/if} + +
    +
    + + {/each} + + +
    +

    Total results: {invoiceList?.total ?? 0}

    + +
    + {:else} + +

    + You have no payment history. After you receive your first invoice, you'll + see it here. +

    +
    + {/if} + + +{/if} diff --git a/src/routes/(console)/organization-[organization]/billing/paymentMethods.svelte b/src/routes/(console)/organization-[organization]/billing/paymentMethods.svelte index 4e7bdbcdc..1a7938d24 100644 --- a/src/routes/(console)/organization-[organization]/billing/paymentMethods.svelte +++ b/src/routes/(console)/organization-[organization]/billing/paymentMethods.svelte @@ -99,7 +99,6 @@

    View or update your organization payment methods here.

    -

    Default

    {#if $organization?.paymentMethodId} @@ -196,112 +195,115 @@ {/if}
    -
    -

    Backup

    - {#if $organization?.backupPaymentMethodId} - - - - - {#if backupPaymentMethod.userId === $user.$id} + {#if $organization?.billingPlan !== BillingPlan.FREE} + +
    +

    Backup

    + {#if $organization?.backupPaymentMethodId} + + + + + {#if backupPaymentMethod.userId === $user.$id} + { + showEdit = true; + isSelectedBackup = true; + showDropdownBackup = false; + }}> + Edit + + {/if} { - showEdit = true; + showReplace = true; isSelectedBackup = true; showDropdownBackup = false; }}> - Edit + Replace - {/if} - { - showReplace = true; - isSelectedBackup = true; - showDropdownBackup = false; - }}> - Replace - - { - showDelete = true; - isSelectedBackup = true; - showDropdownBackup = false; - }}> - Delete - - - - - {:else} - {@const filteredPaymentMethods = $paymentMethods.paymentMethods.filter( - (o) => !!o.last4 && o.$id !== $organization?.paymentMethodId - )} -
    -
    -
    - - - - {#if $paymentMethods.total} - {#each filteredPaymentMethods as paymentMethod} - { - showDropdownBackup = true; - addBackupPaymentMethod(paymentMethod?.$id); - }}> - -

    - Card ending in {paymentMethod.last4} -

    - -
    -
    - {/each} - {/if} - (showPayment = true)}> - Add new payment method - -
    -
    + Delete + + + + + {:else} + {@const filteredPaymentMethods = $paymentMethods.paymentMethods.filter( + (o) => !!o.last4 && o.$id !== $organization?.paymentMethodId + )} +
    +
    +
    + + + + {#if $paymentMethods.total} + {#each filteredPaymentMethods as paymentMethod} + { + showDropdownBackup = true; + addBackupPaymentMethod(paymentMethod?.$id); + }}> + +

    + Card ending in {paymentMethod.last4} +

    + +
    +
    + {/each} + {/if} + (showPayment = true)}> + Add new payment method + +
    +
    +
    +
    + Add a backup payment method + +
    -
    - Add a backup payment method - -
    -
    -
    - {/if} -
    + + {/if} +
    + {/if}
    diff --git a/src/routes/(console)/organization-[organization]/billing/planSummary.svelte b/src/routes/(console)/organization-[organization]/billing/planSummary.svelte index c84356b75..f356741ad 100644 --- a/src/routes/(console)/organization-[organization]/billing/planSummary.svelte +++ b/src/routes/(console)/organization-[organization]/billing/planSummary.svelte @@ -1,6 +1,6 @@ -{#if isCloud} -
    -
    -

    Premium support

    - {#if isPaid} +
    +

    Support

    + + {#each supportOptions as option} + +
    +

    {option.label}

    +

    - Get personalized support from the Appwrite team from {supportTimings} + {option.description}

    +
    + + {#if option.showSupport} +
    + {#if !isPaid} + + {:else} + + {/if} + +
    + {#if isSupportOnline()} +
    +
    + {:else} + {/if} -
    - {#if $organization?.billingPlan === BillingPlan.FREE} - - {:else} - - {/if} -
    -{/if} -
    -
    -

    Troubleshooting

    + + {/each} -
    - {#key $app.themeInUse} - - {/key} -
    -
    - -
    - - - - +
    + {#key $app.themeInUse} + + {/key}
    -
    -
    -

    Community support

    -

    Get help from our community

    -
    -
      -
    • - -
    • -
    • - -
    • -
    -
    + + diff --git a/src/lib/helpers/date.ts b/src/lib/helpers/date.ts index f8275753b..87bc7dc5f 100644 --- a/src/lib/helpers/date.ts +++ b/src/lib/helpers/date.ts @@ -128,6 +128,11 @@ export const localeTimezoneName = () => { return dateWithTimezone.split(', ')[1]; }; +export const localeShortTimezoneName = () => { + const timezone = localeTimezoneName(); + return timezone.match(/[A-Z]/g)?.join('') || timezone; +}; + export const isSameDay = (date1: Date, date2: Date) => { return ( date1.getFullYear() === date2.getFullYear() && diff --git a/src/lib/layout/header.svelte b/src/lib/layout/header.svelte index 390cad41b..124cbba96 100644 --- a/src/lib/layout/header.svelte +++ b/src/lib/layout/header.svelte @@ -127,7 +127,7 @@ {#if isCloud} - + From b097c06656fe3dcab50ed6886e9963620449e065 Mon Sep 17 00:00:00 2001 From: Darshan Date: Mon, 16 Dec 2024 12:01:22 +0530 Subject: [PATCH 07/87] fix: simplify draft checks. --- .../message-[message]/emailMessage.svelte | 18 +++++++----------- .../message-[message]/updateTargets.svelte | 12 +++++++----- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/routes/(console)/project-[project]/messaging/message-[message]/emailMessage.svelte b/src/routes/(console)/project-[project]/messaging/message-[message]/emailMessage.svelte index 6fcaad6d4..36c479683 100644 --- a/src/routes/(console)/project-[project]/messaging/message-[message]/emailMessage.svelte +++ b/src/routes/(console)/project-[project]/messaging/message-[message]/emailMessage.svelte @@ -60,25 +60,21 @@ subject === message.data.subject && content === message.data.content && html === ((message.data['html'] ?? false) as boolean); + + $: isDraft = message.status === 'draft';
    - +
    Message
    - - + + Enable the HTML mode if your message contains HTML tags. diff --git a/src/routes/(console)/project-[project]/messaging/message-[message]/updateTargets.svelte b/src/routes/(console)/project-[project]/messaging/message-[message]/updateTargets.svelte index 8c112fba9..c05bdce61 100644 --- a/src/routes/(console)/project-[project]/messaging/message-[message]/updateTargets.svelte +++ b/src/routes/(console)/project-[project]/messaging/message-[message]/updateTargets.svelte @@ -93,11 +93,13 @@ } } + $: isDraft = message.status === 'draft'; + $: disabled = symmetricDifference(targetIds, Object.keys(selectedTargetsById)).length === 0; - + Targets {@const sum = targetIds.length} @@ -106,7 +108,7 @@
    Target
    - {#if message.status == 'draft'} + {#if isDraft} + . +

    + + + {/if} +
    +
    From e1fa344d3972a7d681ac9dde2548013d849f028d Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 17 Dec 2024 11:09:18 +0530 Subject: [PATCH 09/87] address comments, fix colors. --- src/lib/components/support.svelte | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lib/components/support.svelte b/src/lib/components/support.svelte index 8ed77f6ec..08e96dbbb 100644 --- a/src/lib/components/support.svelte +++ b/src/lib/components/support.svelte @@ -61,7 +61,7 @@ {#each supportOptions as option}

    {option.label}

    @@ -142,18 +142,21 @@
    - From 25f5bd036ac13bd9d2a16d6cde710b6660c4d08f Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 17 Dec 2024 14:08:03 +0530 Subject: [PATCH 10/87] ci: empty commit From 9896068ca651cf2f401060e316004059bbe5ce08 Mon Sep 17 00:00:00 2001 From: Darshan Date: Thu, 2 Jan 2025 13:36:25 +0530 Subject: [PATCH 11/87] address comments. --- .../billing/budgetAlert.svelte | 7 +- .../billing/planSummary.svelte | 322 ++++++++++-------- 2 files changed, 177 insertions(+), 152 deletions(-) diff --git a/src/routes/(console)/organization-[organization]/billing/budgetAlert.svelte b/src/routes/(console)/organization-[organization]/billing/budgetAlert.svelte index 02632fad9..cd3e6a4cb 100644 --- a/src/routes/(console)/organization-[organization]/billing/budgetAlert.svelte +++ b/src/routes/(console)/organization-[organization]/billing/budgetAlert.svelte @@ -40,7 +40,7 @@ if (alerts.some((alert) => alert === selectedAlert)) { return; } - if (alerts.length <= 2) { + if (alerts.length <= 3) { alerts = [...alerts, selectedAlert ? selectedAlert : parseInt(search)]; search = ''; selectedAlert = null; @@ -60,7 +60,7 @@ addNotification({ type: 'success', isHtml: true, - message: `A budget alert has been added to ${$organization.name}` + message: ` ${alerts.length === 0 ? 'Budget alerts removed from' : alerts.length > 1 ? `Budget alerts added to` : 'A budget alert has been added to'} ${$organization.name} ` }); trackEvent(Submit.BudgetAlertsUpdate, { alerts @@ -112,12 +112,13 @@ id="alerts" {options} bind:search + interactiveOutput bind:value={selectedAlert} on:select={() => (search = selectedAlert.toString())} />
    diff --git a/src/routes/(console)/organization-[organization]/billing/planSummary.svelte b/src/routes/(console)/organization-[organization]/billing/planSummary.svelte index 668a110d5..f5c219bd3 100644 --- a/src/routes/(console)/organization-[organization]/billing/planSummary.svelte +++ b/src/routes/(console)/organization-[organization]/billing/planSummary.svelte @@ -45,153 +45,168 @@

    -
    - - {tierToPlan($organization?.billingPlan)?.name} plan -
    - {isTrial || $organization?.billingPlan === BillingPlan.GITHUB_EDUCATION - ? formatCurrency(0) - : currentPlan - ? formatCurrency(currentPlan?.price) - : ''} -
    -
    - {#if $organization?.billingPlan !== BillingPlan.FREE && $organization?.billingPlan !== BillingPlan.GITHUB_EDUCATION && extraUsage > 0} - - - Add-ons{extraMembers ? extraAddons + 1 : extraAddons} -
    - -
    -
    - -
    - - {formatCurrency(extraUsage >= 0 ? extraUsage : 0)} - -
    -
    - -
      - {#if extraMembers} -
    • -
      -
      - Additional members -
      -
      - {formatCurrency( - extraMembers * - (currentPlan?.addons?.member?.price ?? 0) - )} -
      -
      -
      -
      - {extraMembers} -
      -
      -
    • - {/if} - {#if currentInvoice?.usage} - {#each currentInvoice.usage as excess, i} -
    • 0 || extraMembers}> - {#if ['storage', 'bandwidth'].includes(excess.name)} - {@const excessValue = humanFileSize(excess.value)} -
      -
      - {excess.name} -
      - {formatCurrency(excess.amount)} -
      -
      - {excessValue.value ?? 0}{excessValue.unit} -
      - {/if} - {#if ['users', 'executions'].includes(excess.name)} -
      -
      - {excess.name} -
      - {formatCurrency(excess.amount)} -
      -
      - {abbreviateNumber(excess.value)} -
      - {/if} -
    • - {/each} - {/if} -
    -
    - {/if} - - {#if $organization?.billingPlan !== BillingPlan.FREE && availableCredit > 0} - - - - - Credits to be applied - -
    - -{formatCurrency( - Math.min(availableCredit, currentInvoice?.amount ?? 0) - )} -
    -
    - {/if} - - {#if $organization?.billingPlan !== BillingPlan.FREE && $organization?.billingPlan !== BillingPlan.GITHUB_EDUCATION} - - Current total (USD) - - - +
    +
    + + {tierToPlan($organization?.billingPlan)?.name} plan
    - {formatCurrency( - Math.max( - (currentInvoice?.amount ?? 0) - - Math.min(availableCredit, currentInvoice?.amount ?? 0), - 0 - ) - )} + {isTrial || + $organization?.billingPlan === BillingPlan.GITHUB_EDUCATION + ? formatCurrency(0) + : currentPlan + ? formatCurrency(currentPlan?.price) + : ''}
    - - {/if} +
    + + {#if $organization?.billingPlan !== BillingPlan.FREE && $organization?.billingPlan !== BillingPlan.GITHUB_EDUCATION && extraUsage > 0} + + + Add-ons{extraMembers ? extraAddons + 1 : extraAddons} +
    + +
    +
    + +
    + + {formatCurrency(extraUsage >= 0 ? extraUsage : 0)} + +
    +
    + +
      + {#if extraMembers} +
    • +
      +
      + Additional members +
      +
      + {formatCurrency( + extraMembers * + (currentPlan?.addons?.member?.price ?? + 0) + )} +
      +
      +
      +
      + {extraMembers} +
      +
      +
    • + {/if} + {#if currentInvoice?.usage} + {#each currentInvoice.usage as excess, i} +
    • 0 || extraMembers}> + {#if ['storage', 'bandwidth'].includes(excess.name)} + {@const excessValue = humanFileSize( + excess.value + )} +
      +
      + {excess.name} +
      + {formatCurrency(excess.amount)} +
      +
      + {excessValue.value ?? 0}{excessValue.unit} +
      + {/if} + {#if ['users', 'executions'].includes(excess.name)} +
      +
      + {excess.name} +
      + {formatCurrency(excess.amount)} +
      +
      + {abbreviateNumber(excess.value)} +
      + {/if} +
    • + {/each} + {/if} +
    +
    + {/if} + + {#if $organization?.billingPlan !== BillingPlan.FREE && availableCredit > 0} + + + + + Credits to be applied + +
    + -{formatCurrency( + Math.min(availableCredit, currentInvoice?.amount ?? 0) + )} +
    +
    + {/if} + + {#if $organization?.billingPlan !== BillingPlan.FREE && $organization?.billingPlan !== BillingPlan.GITHUB_EDUCATION} + + Current total (USD) + + + +
    + {formatCurrency( + Math.max( + (currentInvoice?.amount ?? 0) - + Math.min( + availableCredit, + currentInvoice?.amount ?? 0 + ), + 0 + ) + )} +
    +
    + {/if} +
    @@ -239,24 +254,33 @@ {/if} diff --git a/src/lib/layout/header.svelte b/src/lib/layout/header.svelte index 124cbba96..4818efd2e 100644 --- a/src/lib/layout/header.svelte +++ b/src/lib/layout/header.svelte @@ -125,17 +125,14 @@ - - {#if isCloud} - - - - - - - {/if} + + + + + + -
    - {/if} -
    {/if} @@ -47,6 +41,7 @@ required bind:files={$createFile.files} allowedFileExtensions={$bucket.allowedFileExtensions} + bind:error={fileError} maxSize={isCloud ? $bucket.maximumFileSize : ($bucket.maximumFileSize ?? sizeToBytes(service, 'MB', 1000))} /> From 6e249cdd72979b51f8a749a27206da3e61eace86 Mon Sep 17 00:00:00 2001 From: ernstmul Date: Mon, 20 Jan 2025 15:51:07 +0100 Subject: [PATCH 56/87] Set limit to 100 --- .../collection-[collection]/attributes/relationship.svelte | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/attributes/relationship.svelte b/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/attributes/relationship.svelte index 1af15500b..600c3fbb8 100644 --- a/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/attributes/relationship.svelte +++ b/src/routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/attributes/relationship.svelte @@ -92,7 +92,9 @@ ); return collections; } else { - const collections = await sdk.forProject.databases.listCollections(databaseId); + const collections = await sdk.forProject.databases.listCollections(databaseId, [ + Query.limit(100) + ]); return collections; } } From d898d916a27050289bbc8443528ded2a654b80b7 Mon Sep 17 00:00:00 2001 From: ernstmul Date: Tue, 21 Jan 2025 10:14:40 +0100 Subject: [PATCH 57/87] new copy --- .../storage/bucket-[bucket]/create-file/step1.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 90a49a46e..f0e5a595f 100644 --- 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 @@ -26,7 +26,7 @@

    The maximum file upload size for this bucket is {parseInt(size.value)}{size.unit}. - Edit this number in your + You can adjust it in your  bucket settings Date: Tue, 21 Jan 2025 10:18:00 +0100 Subject: [PATCH 58/87] new copy --- .../storage/bucket-[bucket]/create-file/step1.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index f0e5a595f..43454a461 100644 --- 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 @@ -26,7 +26,7 @@

    The maximum file upload size for this bucket is {parseInt(size.value)}{size.unit}. - You can adjust it in your  + You can adjust it in your bucket settings Date: Wed, 22 Jan 2025 14:12:00 +0900 Subject: [PATCH 59/87] Update Console SDK Version --- package.json | 2 +- pnpm-lock.yaml | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 8a2056de8..428927dc5 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "e2e:ui": "playwright test tests/e2e --ui" }, "dependencies": { - "@appwrite.io/console": "1.4.6", + "@appwrite.io/console": "1.4.7", "@appwrite.io/pink": "0.25.0", "@appwrite.io/pink-icons": "0.25.0", "@popperjs/core": "^2.11.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 399c26707..a31a13a9e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@appwrite.io/console': - specifier: 1.4.6 - version: 1.4.6 + specifier: 1.4.7 + version: 1.4.7 '@appwrite.io/pink': specifier: 0.25.0 version: 0.25.0 @@ -95,7 +95,7 @@ importers: version: 6.6.3 '@testing-library/svelte': specifier: ^5.2.4 - version: 5.2.4(svelte@4.2.19)(vite@5.4.11(@types/node@22.9.0)(sass@1.81.0))(vitest@1.6.0) + version: 5.2.4(svelte@4.2.19)(vite@5.4.11(@types/node@22.9.0)(sass@1.81.0))(vitest@1.6.0(@types/node@22.9.0)(@vitest/ui@1.6.0)(jsdom@22.1.0)(sass@1.81.0)) '@testing-library/user-event': specifier: ^14.5.2 version: 14.5.2(@testing-library/dom@10.4.0) @@ -199,8 +199,8 @@ packages: '@analytics/type-utils@0.6.2': resolution: {integrity: sha512-TD+xbmsBLyYy/IxFimW/YL/9L2IEnM7/EoV9Aeh56U64Ify8o27HJcKjo38XY9Tcn0uOq1AX3thkKgvtWvwFQg==} - '@appwrite.io/console@1.4.6': - resolution: {integrity: sha512-oGA5gkecpy9E/fKJkaGn26JP9mgknc2Vn8hS6xhRBhmUPg8Vqlz0vgPpx1EQbPB2C5HWIf4yToSicOH31XGx6Q==} + '@appwrite.io/console@1.4.7': + resolution: {integrity: sha512-5zx+c5nWRm/UJNxgtOi4vj1pYW+wusfnOX2hqEGDLLuNZRc1rViYRefNuezosp5SPtjClCIYn9TGuFlz/XLwhw==} '@appwrite.io/pink-icons@0.25.0': resolution: {integrity: sha512-0O3i2oEuh5mWvjO80i+X6rbzrWLJ1m5wmv2/M3a1p2PyBJsFxN8xQMTEmTn3Wl/D26SsM7SpzbdW6gmfgoVU9Q==} @@ -3834,7 +3834,7 @@ snapshots: '@analytics/type-utils@0.6.2': {} - '@appwrite.io/console@1.4.6': {} + '@appwrite.io/console@1.4.7': {} '@appwrite.io/pink-icons@0.25.0': {} @@ -5075,7 +5075,7 @@ snapshots: lodash: 4.17.21 redent: 3.0.0 - '@testing-library/svelte@5.2.4(svelte@4.2.19)(vite@5.4.11(@types/node@22.9.0)(sass@1.81.0))(vitest@1.6.0)': + '@testing-library/svelte@5.2.4(svelte@4.2.19)(vite@5.4.11(@types/node@22.9.0)(sass@1.81.0))(vitest@1.6.0(@types/node@22.9.0)(@vitest/ui@1.6.0)(jsdom@22.1.0)(sass@1.81.0))': dependencies: '@testing-library/dom': 10.4.0 svelte: 4.2.19 From 19e52351d45823fdb662d2cd52e801c4435c110e Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Wed, 22 Jan 2025 17:36:04 +0900 Subject: [PATCH 60/87] Fix github secrets --- .github/workflows/publish.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index efb347fd2..66fe72d42 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,8 +17,8 @@ jobs: - name: Log in to Docker Hub uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v5 @@ -54,8 +54,8 @@ jobs: - name: Log in to Docker Hub uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v5 @@ -90,8 +90,8 @@ jobs: - name: Log in to Docker Hub uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v5 From 403744e9bbf72bfb2721ec9944498bfce57088c7 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Wed, 22 Jan 2025 17:39:21 +0900 Subject: [PATCH 61/87] Use vars for username instead of secret --- .github/workflows/publish.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 66fe72d42..ab33a8f37 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,7 +17,7 @@ jobs: - name: Log in to Docker Hub uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} + username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta @@ -54,7 +54,7 @@ jobs: - name: Log in to Docker Hub uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} + username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta @@ -90,7 +90,7 @@ jobs: - name: Log in to Docker Hub uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} + username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta From 5a1e391752c70b0048787e4266be83cd41251cb0 Mon Sep 17 00:00:00 2001 From: Arman Date: Wed, 22 Jan 2025 15:30:09 +0100 Subject: [PATCH 62/87] chore: enable scale plan --- .../billing/planComparisonBox.svelte | 6 +-- .../components/billing/planSelection.svelte | 46 ++++++++----------- src/routes/(console)/onboarding/+page.svelte | 8 ++-- 3 files changed, 27 insertions(+), 33 deletions(-) diff --git a/src/lib/components/billing/planComparisonBox.svelte b/src/lib/components/billing/planComparisonBox.svelte index c48dabfc3..e297d8e75 100644 --- a/src/lib/components/billing/planComparisonBox.svelte +++ b/src/lib/components/billing/planComparisonBox.svelte @@ -1,7 +1,7 @@ + + + + diff --git a/src/routes/(console)/project-[project]/databases/usage/[[period]]/+page.svelte b/src/routes/(console)/project-[project]/databases/usage/[[period]]/+page.svelte index d261dd5f9..a313f3d56 100644 --- a/src/routes/(console)/project-[project]/databases/usage/[[period]]/+page.svelte +++ b/src/routes/(console)/project-[project]/databases/usage/[[period]]/+page.svelte @@ -7,6 +7,13 @@ export let data: PageData; $: total = data.databasesTotal; $: count = data.databases; + + // types need to be added to console sdk. + $: reads = data.databasesReads; + $: readsTotal = data.databasesReadsTotal; + + $: writes = data.databasesWrites; + $: writesTotal = data.databasesWritesTotal; + + + + diff --git a/src/routes/(console)/project-[project]/settings/usage/[[invoice]]/+page.svelte b/src/routes/(console)/project-[project]/settings/usage/[[invoice]]/+page.svelte index 49a621528..8fe58f0c7 100644 --- a/src/routes/(console)/project-[project]/settings/usage/[[invoice]]/+page.svelte +++ b/src/routes/(console)/project-[project]/settings/usage/[[invoice]]/+page.svelte @@ -37,6 +37,12 @@ data.usage.deploymentsStorageTotal + data.usage.buildsStorageTotal; + // types need to be added to console sdk. + $: dbReads = data.usage.databasesReads; + $: dbReadsTotal = data.usage.databasesReadsTotal; + $: dbWrites = data.usage.databasesWrites; + $: dbWritesTotal = data.usage.databasesWritesTotal; + const tier = data?.currentInvoice?.plan ?? $organization?.billingPlan; const plan = tierToPlan(tier).name; @@ -196,6 +202,55 @@ {/if} + + Database reads and writes + +

    Total database reads and writes in your project.

    + + + {#if dbReads || dbWrites} + {@const currentReads = formatNum(dbReadsTotal)} + {@const currentWrites = formatNum(dbWritesTotal)} + +
    +
    +

    + {currentReads}/{currentWrites} + Reads/Writes +

    +
    +
    + [e.date, e.value])] + }, + { + name: 'Writes', + data: [...dbWrites.map((e) => [e.date, e.value])] + } + ]} /> + {:else} + +
    +
    +
    + {/if} +
    +
    Executions From cb7650e5259062d797d9b20d6afe1a704da00f7a Mon Sep 17 00:00:00 2001 From: Arman Date: Thu, 23 Jan 2025 15:43:39 +0100 Subject: [PATCH 68/87] update: improve descriptions for billing tiers --- src/lib/stores/billing.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/stores/billing.ts b/src/lib/stores/billing.ts index 9b42358d1..a5b00f43e 100644 --- a/src/lib/stores/billing.ts +++ b/src/lib/stores/billing.ts @@ -175,7 +175,7 @@ export type TierData = { export const tierFree: TierData = { name: 'Free', - description: 'For personal hobby projects of small scale and students.' + description: 'A great fit for passion projects and small applications.' }; export const tierGitHubEducation: TierData = { @@ -185,11 +185,13 @@ export const tierGitHubEducation: TierData = { export const tierPro: TierData = { name: 'Pro', - description: 'For pro developers and production projects that need the ability to scale.' + description: + 'For production applications that need powerful functionality and resources to scale.' }; export const tierScale: TierData = { name: 'Scale', - description: 'For scaling teams and agencies that need dedicated support.' + description: + 'For teams that handle more complex and large projects and need more control and support.' }; export const tierCustom: TierData = { From e048f6bdd99bab8e5dbfa5a3ef3d2ec30dadf844 Mon Sep 17 00:00:00 2001 From: Darshan Date: Fri, 24 Jan 2025 09:54:44 +0530 Subject: [PATCH 69/87] fix: payment history not visible. --- .../billing/paymentHistory.svelte | 262 +++++++++--------- 1 file changed, 135 insertions(+), 127 deletions(-) diff --git a/src/routes/(console)/organization-[organization]/billing/paymentHistory.svelte b/src/routes/(console)/organization-[organization]/billing/paymentHistory.svelte index ea6265f7c..dd3b9ecf7 100644 --- a/src/routes/(console)/organization-[organization]/billing/paymentHistory.svelte +++ b/src/routes/(console)/organization-[organization]/billing/paymentHistory.svelte @@ -29,10 +29,10 @@ import { trackEvent } from '$lib/actions/analytics'; import { selectedInvoice, showRetryModal } from './store'; import { organization } from '$lib/stores/organization'; - import { BillingPlan } from '$lib/constants'; let showDropdown = []; let showFailedError = false; + let isLoadingInvoices = true; let offset = 0; let invoiceList: InvoiceList = { @@ -46,6 +46,7 @@ onMount(request); async function request() { + isLoadingInvoices = true; invoiceList = await sdk.forConsole.billing.listInvoices($page.params.organization, [ Query.limit(limit), Query.offset(offset), @@ -53,6 +54,7 @@ Query.notEqual('status', 'pending'), Query.orderDesc('$createdAt') ]); + isLoadingInvoices = false; } function retryPayment(invoice: Invoice) { @@ -65,144 +67,150 @@ } -{#if $organization?.billingPlan === BillingPlan.FREE && invoiceList.total > 0} - - Payment history + + Payment history -

    - Transaction history for this organization. Download invoices for more details about your - payments. -

    - - {#if invoiceList.total > 0} - - - Due Date - Status - Amount Due - - - - {#each invoiceList?.invoices as invoice, i} - {@const status = invoice.status} - - - {toLocaleDate(invoice.dueAt)} - - - {#if invoice?.lastError} - - (showFailedError = true)} - button> - {status === 'requires_authentication' - ? 'failed' - : status} - - -
  • - The scheduled payment has failed. - - . -
  • -
    -
    - {:else} +

    + Transaction history for this organization. Download invoices for more details about your + payments. +

    + + {#if invoiceList.total > 0} + + + Due Date + Status + Amount Due + + + + {#each invoiceList?.invoices as invoice, i} + {@const status = invoice.status} + + + {toLocaleDate(invoice.dueAt)} + + + {#if invoice?.lastError} + + warning={status === 'pending'} + on:click={() => (showFailedError = true)} + button> {status === 'requires_authentication' ? 'failed' : status} - {/if} - - - {formatCurrency(invoice.grossAmount)} - - - - - - (showDropdown[i] = !showDropdown[i])} - event="view_invoice"> - View invoice - - { - showDropdown[i] = !showDropdown[i]; - }} - event="download_invoice"> - Download PDF - - {#if status === 'overdue' || status === 'failed'} - + The scheduled payment has failed. + + . + - - - {/each} - - -
    -

    Total results: {invoiceList?.total ?? 0}

    - -
    - {:else} - -

    - You have no payment history. After you receive your first invoice, you'll - see it here. -

    -
    - {/if} -
    -
    -{/if} + {:else} + + {status === 'requires_authentication' ? 'failed' : status} + + {/if} + + + {formatCurrency(invoice.grossAmount)} + + + + + + (showDropdown[i] = !showDropdown[i])} + event="view_invoice"> + View invoice + + { + showDropdown[i] = !showDropdown[i]; + }} + event="download_invoice"> + Download PDF + + {#if status === 'overdue' || status === 'failed'} + { + retryPayment(invoice); + showDropdown[i] = !showDropdown[i]; + trackEvent(`click_retry_payment`, { + from: 'button', + source: 'billing_invoice_menu' + }); + }}> + Retry payment + + {/if} + + + + + {/each} + + +
    +

    Total results: {invoiceList.total}

    + +
    + {:else if isLoadingInvoices} +
    +
    +
    + {:else} + +

    + You have no payment history. After you receive your first invoice, you'll see it + here. +

    +
    + {/if} + + + + From 884c454c55c72dcbbcba6c6982bc81dca40a7e2c Mon Sep 17 00:00:00 2001 From: Darshan Date: Fri, 24 Jan 2025 13:01:08 +0530 Subject: [PATCH 70/87] add: database read, writes in org. usage screen. --- .../usage/[[invoice]]/+page.svelte | 62 +++++++++ .../usage/[[invoice]]/ProjectBreakdown.svelte | 121 ++++++++++++++---- 2 files changed, 160 insertions(+), 23 deletions(-) diff --git a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte index 3cebea75e..77096eb10 100644 --- a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte +++ b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte @@ -193,6 +193,65 @@ + + Databases reads and writes + +

    + The total number of database reads and writes across all projects in your organization. +

    + + + {#if data.organizationUsage.databasesReadsTotal || data.organizationUsage.databasesWritesTotal} +
    + [ + e.date, + e.value + ]) + ] + }, + { + name: 'Writes', + data: [ + ...data.organizationUsage.databasesWrites.map((e) => [ + e.date, + e.value + ]) + ] + } + ]} /> +
    + {#if project?.length > 0} + + {/if} + {:else} + +
    +
    +
    + {/if} +
    +
    + Executions @@ -318,6 +377,7 @@ {/if} + GB hours @@ -378,6 +438,7 @@ {/if} + Phone OTP

    @@ -430,6 +491,7 @@ {/if} +

    diff --git a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/ProjectBreakdown.svelte b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/ProjectBreakdown.svelte index 8542fe75c..7bd50227c 100644 --- a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/ProjectBreakdown.svelte +++ b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/ProjectBreakdown.svelte @@ -15,14 +15,26 @@ import type { OrganizationUsage } from '$lib/sdk/billing'; import { base } from '$app/paths'; import { canSeeProjects } from '$lib/stores/roles'; + import { onMount } from 'svelte'; + + type Metric = + | 'users' + | 'storage' + | 'bandwidth' + | 'executions' + | 'authPhoneTotal' + | 'databasesReads' + | 'databasesWrites'; - type Metric = 'users' | 'storage' | 'bandwidth' | 'executions' | 'authPhoneTotal'; type Estimate = 'authPhoneEstimate'; + type DatabaseOperationMetric = Extract; + export let data: PageData; export let projects: OrganizationUsage['projects']; - export let metric: Metric; + export let metric: Metric | undefined = undefined; export let estimate: Estimate | undefined = undefined; + export let databaseOperationMetric: DatabaseOperationMetric[] | undefined = undefined; function getMetricTitle(metric: Metric): string { switch (metric) { @@ -38,25 +50,48 @@ } function groupByProject( - metric: Metric, - estimate?: Estimate - ): Array<{ projectId: string; usage: number; estimate?: number }> { + metric: Metric | undefined, + estimate?: Estimate, + databaseOps?: DatabaseOperationMetric[] + ): Array<{ + projectId: string; + databasesReads?: number; + databasesWrites?: number; + usage?: number; + estimate?: number; + }> { const data = []; for (const project of projects) { - const usage = project[metric]; - if (!usage) { - continue; + if (metric) { + const usage = project[metric]; + if (!usage) continue; + + data.push({ + projectId: project.projectId, + usage: usage ?? 0, + estimate: estimate ? project[estimate] : undefined + }); + } else if (databaseOps) { + const reads = project['databasesReads'] ?? 0; + const writes = project['databasesWrites'] ?? 0; + + if (reads || writes) { + data.push({ + projectId: project.projectId, + databasesReads: reads, + databasesWrites: writes + }); + } } - data.push({ - projectId: project.projectId, - usage: usage ?? 0, - estimate: estimate ? project[estimate] : undefined - }); } return data; } function format(value: number): string { + if (databaseOperationMetric) { + return abbreviateNumber(value); + } + switch (metric) { case 'authPhoneTotal': return formatNumberWithCommas(value); @@ -68,6 +103,12 @@ return humanFileSize(value).value + humanFileSize(value).unit; } } + + onMount(() => { + if (metric === undefined && databaseOperationMetric === undefined) { + throw new Error(`metric or database operations must be defined`); + } + }); @@ -76,7 +117,13 @@ Project - {getMetricTitle(metric)} + {#if databaseOperationMetric} + Reads + Writes + {:else} + {getMetricTitle(metric)} + {/if} + {#if estimate} Estimated cost {/if} @@ -85,17 +132,33 @@ {/if} - {#each groupByProject(metric, estimate).sort((a, b) => b.usage - a.usage) as project} + {#each groupByProject(metric, estimate, databaseOperationMetric).sort((a, b) => { + const aValue = a.usage ?? a.databasesReads ?? 0; + const bValue = b.usage ?? b.databasesReads ?? 0; + return bValue - aValue; + }) as project} {#if !$canSeeProjects} {data.projectNames[project.projectId]?.name ?? 'Unknown'} - {format(project.usage)} + {#if databaseOperationMetric} + + {format(project.databasesReads ?? 0)} + + + {format(project.databasesWrites ?? 0)} + + {:else} + + {format(project.usage)} + + {/if} + {#if project.estimate} - {formatCurrency(project.estimate)} + + {formatCurrency(project.estimate)} + {/if} {:else} @@ -103,11 +166,23 @@ {data.projectNames[project.projectId]?.name ?? 'Unknown'} - {format(project.usage)} + {#if databaseOperationMetric} + + {format(project.databasesReads ?? 0)} + + + {format(project.databasesWrites ?? 0)} + + {:else} + + {format(project.usage)} + + {/if} + {#if project.estimate} - {formatCurrency(project.estimate)} + + {formatCurrency(project.estimate)} + {/if} Date: Fri, 24 Jan 2025 13:12:06 +0530 Subject: [PATCH 71/87] remove: leftovers. --- .../usage/[[invoice]]/+page.svelte | 6 +++--- .../database-[database]/usage/[[period]]/+page.svelte | 5 ----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte index 77096eb10..bcd97f80d 100644 --- a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte +++ b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte @@ -201,7 +201,7 @@

    - {#if data.organizationUsage.databasesReadsTotal || data.organizationUsage.databasesWritesTotal} + {#if data.organizationUsage.databasesReads || data.organizationUsage.databasesWrites}
    [ + ...(data.organizationUsage.databasesReads ?? []).map((e) => [ e.date, e.value ]) @@ -224,7 +224,7 @@ { name: 'Writes', data: [ - ...data.organizationUsage.databasesWrites.map((e) => [ + ...(data.organizationUsage.databasesWrites ?? []).map((e) => [ e.date, e.value ]) diff --git a/src/routes/(console)/project-[project]/databases/database-[database]/usage/[[period]]/+page.svelte b/src/routes/(console)/project-[project]/databases/database-[database]/usage/[[period]]/+page.svelte index 23e2ba530..68297576c 100644 --- a/src/routes/(console)/project-[project]/databases/database-[database]/usage/[[period]]/+page.svelte +++ b/src/routes/(console)/project-[project]/databases/database-[database]/usage/[[period]]/+page.svelte @@ -3,7 +3,6 @@ import { page } from '$app/stores'; import { Usage } from '$lib/layout'; import type { PageData } from './$types'; - import { onMount } from 'svelte'; export let data: PageData; @@ -16,10 +15,6 @@ $: writes = data.databaseWrites; $: writesTotal = data.databaseWritesTotal; - - onMount(() => { - console.log([readsTotal, writesTotal]); - }); Date: Fri, 24 Jan 2025 13:38:05 +0530 Subject: [PATCH 72/87] add: types for org-usage modal. --- src/lib/sdk/billing.ts | 4 ++++ .../organization-[organization]/usage/[[invoice]]/+page.ts | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib/sdk/billing.ts b/src/lib/sdk/billing.ts index 95c9f5c77..32e65b6a1 100644 --- a/src/lib/sdk/billing.ts +++ b/src/lib/sdk/billing.ts @@ -179,9 +179,13 @@ export type Aggregation = { export type OrganizationUsage = { bandwidth: Array; executions: Array; + databasesReads: Array; + databasesWrites: Array; executionsTotal: number; filesStorageTotal: number; buildsStorageTotal: number; + databasesReadsTotal: number; + databasesWritesTotal: number; deploymentsStorageTotal: number; executionsMBSecondsTotal: number; buildsMBSecondsTotal: number; diff --git a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.ts b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.ts index 4138acfa1..967ee6d50 100644 --- a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.ts +++ b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.ts @@ -29,7 +29,11 @@ export const load: PageLoad = async ({ params, parent }) => { executionsMBSecondsTotal: null, buildsMBSecondsTotal: null, authPhoneTotal: null, - authPhoneEstimate: null + authPhoneEstimate: null, + databasesReads: null, + databasesWrites: null, + databasesReadsTotal: null, + databasesWritesTotal: null, } }; } From df94359c8eabbe460c1e8ad84650c29073ca4a9c Mon Sep 17 00:00:00 2001 From: Darshan Date: Fri, 24 Jan 2025 14:00:25 +0530 Subject: [PATCH 73/87] skip: loader for now. --- .../billing/paymentHistory.svelte | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/routes/(console)/organization-[organization]/billing/paymentHistory.svelte b/src/routes/(console)/organization-[organization]/billing/paymentHistory.svelte index dd3b9ecf7..baee0abfe 100644 --- a/src/routes/(console)/organization-[organization]/billing/paymentHistory.svelte +++ b/src/routes/(console)/organization-[organization]/billing/paymentHistory.svelte @@ -32,7 +32,7 @@ let showDropdown = []; let showFailedError = false; - let isLoadingInvoices = true; + // let isLoadingInvoices = true; let offset = 0; let invoiceList: InvoiceList = { @@ -46,7 +46,7 @@ onMount(request); async function request() { - isLoadingInvoices = true; + // isLoadingInvoices = true; invoiceList = await sdk.forConsole.billing.listInvoices($page.params.organization, [ Query.limit(limit), Query.offset(offset), @@ -54,7 +54,7 @@ Query.notEqual('status', 'pending'), Query.orderDesc('$createdAt') ]); - isLoadingInvoices = false; + // isLoadingInvoices = false; } function retryPayment(invoice: Invoice) { @@ -192,10 +192,10 @@

    Total results: {invoiceList.total}

    - {:else if isLoadingInvoices} -
    -
    -
    + + + + {:else}

    @@ -207,10 +207,10 @@ - + + + + + + + From f143d34365787e52cb3cf3c6896d7da4b88a09f8 Mon Sep 17 00:00:00 2001 From: Darshan Date: Sat, 25 Jan 2025 19:34:35 +0530 Subject: [PATCH 74/87] new: custom legend and usage component. --- src/lib/charts/index.ts | 1 + src/lib/charts/legend.svelte | 23 +++++++++++ src/lib/layout/index.ts | 1 + src/lib/layout/usageMultiple.svelte | 63 +++++++++++++++++++++++++++++ 4 files changed, 88 insertions(+) create mode 100644 src/lib/charts/legend.svelte create mode 100644 src/lib/layout/usageMultiple.svelte diff --git a/src/lib/charts/index.ts b/src/lib/charts/index.ts index c73108a13..488756ecb 100644 --- a/src/lib/charts/index.ts +++ b/src/lib/charts/index.ts @@ -1,2 +1,3 @@ export { default as BarChart } from './bar.svelte'; export { default as LineChart } from './line.svelte'; +export { default as Legend, type LegendData } from './legend.svelte'; diff --git a/src/lib/charts/legend.svelte b/src/lib/charts/legend.svelte new file mode 100644 index 000000000..671f4cce3 --- /dev/null +++ b/src/lib/charts/legend.svelte @@ -0,0 +1,23 @@ + + + + +

    + {#each legendData as { name, value }, index} +
    + + {name} ({value}) +
    + {/each} +
    diff --git a/src/lib/layout/index.ts b/src/lib/layout/index.ts index e45069dd1..fa8289f73 100644 --- a/src/lib/layout/index.ts +++ b/src/lib/layout/index.ts @@ -13,6 +13,7 @@ export { default as WizardStep } from './wizardStep.svelte'; export { default as Breadcrumbs } from './breadcrumbs.svelte'; export { default as Unauthenticated } from './unauthenticated.svelte'; export { default as Usage, type UsagePeriods } from './usage.svelte'; +export { default as UsageMultiple } from './usageMultiple.svelte'; export { default as Activity } from './activity.svelte'; export { default as Progress } from './progress.svelte'; export { default as GridHeader } from './gridHeader.svelte'; diff --git a/src/lib/layout/usageMultiple.svelte b/src/lib/layout/usageMultiple.svelte new file mode 100644 index 000000000..6e3d3be43 --- /dev/null +++ b/src/lib/layout/usageMultiple.svelte @@ -0,0 +1,63 @@ + + + +
    + {title} + {#if path} + + + 24h + + + 30d + + + 90d + + + {/if} +
    + + {#if count} +
    +
    + ({ + name: legendData[index].name, + data: accumulateFromEndingTotal(c, total[index]) + }))} /> +
    + + {#if legendData} + + {/if} +
    + {/if} +
    +
    + + From e3774be0aa323e24f43d4a0d68aed92f8d2a1de1 Mon Sep 17 00:00:00 2001 From: Darshan Date: Sat, 25 Jan 2025 19:37:10 +0530 Subject: [PATCH 75/87] update: use new usageMultiple component for database r&w metrics. --- .../usage/[[invoice]]/+page.svelte | 11 +++- .../usage/[[invoice]]/+page.ts | 2 +- .../usage/[[period]]/+page.svelte | 27 +++------ .../databases/usage/[[period]]/+page.svelte | 27 +++------ .../settings/usage/[[invoice]]/+page.svelte | 57 +++++++++---------- 5 files changed, 56 insertions(+), 68 deletions(-) diff --git a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte index bcd97f80d..b002e59f3 100644 --- a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte +++ b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte @@ -10,7 +10,7 @@ import { organization } from '$lib/stores/organization'; import { Button } from '$lib/elements/forms'; import { bytesToSize, humanFileSize, mbSecondsToGBHours } from '$lib/helpers/sizeConvertion'; - import { BarChart } from '$lib/charts'; + import { BarChart, Legend } from '$lib/charts'; import ProjectBreakdown from './ProjectBreakdown.svelte'; import { formatNum } from '$lib/helpers/string'; import { accumulateFromEndingTotal, total } from '$lib/layout/usage.svelte'; @@ -29,6 +29,11 @@ const plan = data?.plan ?? undefined; $: project = (data.organizationUsage as OrganizationUsage).projects; + + $: legendData = [ + { name: 'Reads', value: data.organizationUsage.databasesReadsTotal }, + { name: 'Writes', value: data.organizationUsage.databasesWritesTotal } + ]; @@ -200,7 +205,6 @@ The total number of database reads and writes across all projects in your organization.

    - {#if data.organizationUsage.databasesReads || data.organizationUsage.databasesWrites}
    + + + {#if project?.length > 0} { databasesReads: null, databasesWrites: null, databasesReadsTotal: null, - databasesWritesTotal: null, + databasesWritesTotal: null } }; } diff --git a/src/routes/(console)/project-[project]/databases/database-[database]/usage/[[period]]/+page.svelte b/src/routes/(console)/project-[project]/databases/database-[database]/usage/[[period]]/+page.svelte index 68297576c..fd5fd5875 100644 --- a/src/routes/(console)/project-[project]/databases/database-[database]/usage/[[period]]/+page.svelte +++ b/src/routes/(console)/project-[project]/databases/database-[database]/usage/[[period]]/+page.svelte @@ -1,7 +1,7 @@
    {#if status} - + {/if}
    + + diff --git a/src/lib/layout/usageMultiple.svelte b/src/lib/layout/usageMultiple.svelte index 6e3d3be43..b12b0bc1e 100644 --- a/src/lib/layout/usageMultiple.svelte +++ b/src/lib/layout/usageMultiple.svelte @@ -34,15 +34,13 @@
    {#if count} -
    -
    - ({ - name: legendData[index].name, - data: accumulateFromEndingTotal(c, total[index]) - }))} /> -
    +
    + ({ + name: legendData[index].name, + data: accumulateFromEndingTotal(c, total[index]) + }))} /> {#if legendData} @@ -53,11 +51,12 @@ diff --git a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte index b002e59f3..a140f27b2 100644 --- a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte +++ b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte @@ -206,7 +206,7 @@

    {#if data.organizationUsage.databasesReads || data.organizationUsage.databasesWrites} -
    +
    {#if dbReads || dbWrites} -
    +
    Date: Mon, 27 Jan 2025 14:44:21 +0530 Subject: [PATCH 78/87] update: confirm leaving page if file upload in progress. --- .../storage/bucket-[bucket]/+page.svelte | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) 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 e9a7fc50b..c25acc929 100644 --- a/src/routes/(console)/project-[project]/storage/bucket-[bucket]/+page.svelte +++ b/src/routes/(console)/project-[project]/storage/bucket-[bucket]/+page.svelte @@ -50,6 +50,7 @@ import Create from './create-file/create.svelte'; import DeleteFile from './deleteFile.svelte'; import { isCloud } from '$lib/system'; + import { onMount } from 'svelte'; export let data; @@ -90,8 +91,31 @@ $: maxFileSize = isCloud ? humanFileSize(sizeToBytes(getServiceLimit('fileSize'), 'MB', 1000)) : null; + + let isUploading = false; + + const beforeunload = (event: BeforeUnloadEvent) => { + // legacy browser **may** support showing a custom message. + const message = 'An upload is in progress. Are you sure you want to leave?'; + + if (isUploading) { + event.preventDefault(); + event.returnValue = message; + return message; + } + }; + + onMount(() => { + return uploader.subscribe(() => { + isUploading = $uploader.files.some( + (file) => !file.completed && file.progress < 100 && !file.failed + ); + }); + }); + + From e358afc2fcb0a65443c625f1b472a1228bd2e3e3 Mon Sep 17 00:00:00 2001 From: Darshan Date: Mon, 27 Jan 2025 15:54:28 +0530 Subject: [PATCH 79/87] address comments: update copies, specs of the graphs. --- src/lib/layout/usageMultiple.svelte | 16 +++++++- .../usage/[[invoice]]/+page.svelte | 2 +- .../usage/[[period]]/+page.svelte | 38 ++++++++++--------- .../databases/usage/[[period]]/+page.svelte | 38 ++++++++++--------- 4 files changed, 57 insertions(+), 37 deletions(-) diff --git a/src/lib/layout/usageMultiple.svelte b/src/lib/layout/usageMultiple.svelte index b12b0bc1e..aa9292c9c 100644 --- a/src/lib/layout/usageMultiple.svelte +++ b/src/lib/layout/usageMultiple.svelte @@ -5,17 +5,23 @@ import { Card, Heading, SecondaryTabs, SecondaryTabsItem } from '$lib/components'; import { page } from '$app/stores'; import { type Models } from '@appwrite.io/console'; + import { formatNumberWithCommas } from '$lib/helpers/numbers'; export let title: string; export let total: number[]; export let path: string = null; export let count: Models.Metric[][]; export let legendData: LegendData[]; + export let showHeader: boolean = true; + export let overlapContainerCover = false; - +
    - {title} + {#if showHeader} + {title} + {/if} + {#if path} @@ -34,6 +40,12 @@
    {#if count} + {@const totalCount = total.reduce((a, b) => a + b, 0)} + + {formatNumberWithCommas(totalCount)} +

    Total {title.toLocaleLowerCase()}

    +
    +
    - Databases reads and writes + Database reads and writes

    The total number of database reads and writes across all projects in your organization. diff --git a/src/routes/(console)/project-[project]/databases/database-[database]/usage/[[period]]/+page.svelte b/src/routes/(console)/project-[project]/databases/database-[database]/usage/[[period]]/+page.svelte index fd5fd5875..56e0eb722 100644 --- a/src/routes/(console)/project-[project]/databases/database-[database]/usage/[[period]]/+page.svelte +++ b/src/routes/(console)/project-[project]/databases/database-[database]/usage/[[period]]/+page.svelte @@ -17,21 +17,25 @@ $: writesTotal = data.databaseWritesTotal; - +

    + - + +
    diff --git a/src/routes/(console)/project-[project]/databases/usage/[[period]]/+page.svelte b/src/routes/(console)/project-[project]/databases/usage/[[period]]/+page.svelte index 334403f69..b4fbc25e7 100644 --- a/src/routes/(console)/project-[project]/databases/usage/[[period]]/+page.svelte +++ b/src/routes/(console)/project-[project]/databases/usage/[[period]]/+page.svelte @@ -16,21 +16,25 @@ $: writesTotal = data.databasesWritesTotal; - +
    + - + +
    From 303139dc56d08120520e30f2ef4a336aa6416e68 Mon Sep 17 00:00:00 2001 From: Darshan Date: Mon, 27 Jan 2025 19:18:41 +0530 Subject: [PATCH 80/87] address comments. --- src/lib/components/status.svelte | 1 - src/lib/layout/usageMultiple.svelte | 2 +- .../usage/[[invoice]]/+page.svelte | 2 +- .../database-[database]/usage/[[period]]/+page.svelte | 1 - .../project-[project]/databases/usage/[[period]]/+page.svelte | 1 - .../project-[project]/settings/usage/[[invoice]]/+page.svelte | 4 ---- 6 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/lib/components/status.svelte b/src/lib/components/status.svelte index 75fa4ad10..71ddbde69 100644 --- a/src/lib/components/status.svelte +++ b/src/lib/components/status.svelte @@ -36,6 +36,5 @@ .text { line-height: 140%; - letter-spacing: -0.063px; } diff --git a/src/lib/layout/usageMultiple.svelte b/src/lib/layout/usageMultiple.svelte index aa9292c9c..81e9710b8 100644 --- a/src/lib/layout/usageMultiple.svelte +++ b/src/lib/layout/usageMultiple.svelte @@ -68,7 +68,7 @@ } :global(.multiple-chart-container .echart) { - margin-top: -1rem; + margin-top: -1em; margin-bottom: -1em; } diff --git a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte index 46fdce2a9..d4b23112a 100644 --- a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte +++ b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte @@ -138,7 +138,7 @@
    diff --git a/src/routes/(console)/project-[project]/databases/database-[database]/usage/[[period]]/+page.svelte b/src/routes/(console)/project-[project]/databases/database-[database]/usage/[[period]]/+page.svelte index 56e0eb722..b094257ac 100644 --- a/src/routes/(console)/project-[project]/databases/database-[database]/usage/[[period]]/+page.svelte +++ b/src/routes/(console)/project-[project]/databases/database-[database]/usage/[[period]]/+page.svelte @@ -9,7 +9,6 @@ $: total = data.collectionsTotal; $: count = data.collections; - // types need to be added to console sdk. $: reads = data.databaseReads; $: readsTotal = data.databaseReadsTotal; diff --git a/src/routes/(console)/project-[project]/databases/usage/[[period]]/+page.svelte b/src/routes/(console)/project-[project]/databases/usage/[[period]]/+page.svelte index b4fbc25e7..8c41fdc75 100644 --- a/src/routes/(console)/project-[project]/databases/usage/[[period]]/+page.svelte +++ b/src/routes/(console)/project-[project]/databases/usage/[[period]]/+page.svelte @@ -8,7 +8,6 @@ $: total = data.databasesTotal; $: count = data.databases; - // types need to be added to console sdk. $: reads = data.databasesReads; $: readsTotal = data.databasesReadsTotal; diff --git a/src/routes/(console)/project-[project]/settings/usage/[[invoice]]/+page.svelte b/src/routes/(console)/project-[project]/settings/usage/[[invoice]]/+page.svelte index 4412f6f92..a0d8c2410 100644 --- a/src/routes/(console)/project-[project]/settings/usage/[[invoice]]/+page.svelte +++ b/src/routes/(console)/project-[project]/settings/usage/[[invoice]]/+page.svelte @@ -37,12 +37,8 @@ data.usage.deploymentsStorageTotal + data.usage.buildsStorageTotal; - // types need to be added to console sdk. $: dbReads = data.usage.databasesReads; - $: dbReadsTotal = data.usage.databasesReadsTotal; - $: dbWrites = data.usage.databasesWrites; - $: dbWritesTotal = data.usage.databasesWritesTotal; $: legendData = [ { name: 'Reads', value: data.usage.databasesReadsTotal }, From d3865e8e10de2e01c1a5025c316ab97b7f76e06a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Tue, 28 Jan 2025 10:16:14 +0100 Subject: [PATCH 81/87] Fix copy --- .../storage/bucket-[bucket]/settings/+page.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/(console)/project-[project]/storage/bucket-[bucket]/settings/+page.svelte b/src/routes/(console)/project-[project]/storage/bucket-[bucket]/settings/+page.svelte index 572cd88e6..33646a8f6 100644 --- a/src/routes/(console)/project-[project]/storage/bucket-[bucket]/settings/+page.svelte +++ b/src/routes/(console)/project-[project]/storage/bucket-[bucket]/settings/+page.svelte @@ -404,7 +404,7 @@ - Allowed file Extensions + Allowed file extensions

    Allowed file extensions. A maximum of 100 file extensions can be added. Leave blank to allow all file types. From 11f15b1d4487a638b32517ca2d38ed5802cbffce Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 28 Jan 2025 17:53:05 +0530 Subject: [PATCH 82/87] address comments: ui changes as per designs. --- .../messaging/message-[message]/+layout.ts | 11 +- .../messaging/message-[message]/+page.svelte | 7 +- .../message-[message]/recipients.svelte | 91 ---------------- .../message-[message]/updateTargets.svelte | 102 ++++++++++++++++-- 4 files changed, 103 insertions(+), 108 deletions(-) delete mode 100644 src/routes/(console)/project-[project]/messaging/message-[message]/recipients.svelte diff --git a/src/routes/(console)/project-[project]/messaging/message-[message]/+layout.ts b/src/routes/(console)/project-[project]/messaging/message-[message]/+layout.ts index 637631dd9..2d2cdb624 100644 --- a/src/routes/(console)/project-[project]/messaging/message-[message]/+layout.ts +++ b/src/routes/(console)/project-[project]/messaging/message-[message]/+layout.ts @@ -43,9 +43,14 @@ export const load: LayoutLoad = async ({ params, depends }) => { const messageRecipients: Record> = {}; const messageRecipientsPromise = Object.values(message.users).map((userId) => - sdk.forProject.users.get(userId).then((user) => { - messageRecipients[user.$id] = user; - }) + sdk.forProject.users + .get(userId) + .then((user) => { + messageRecipients[user.$id] = user; + }) + .catch(() => { + messageRecipients[userId] = null; + }) ); await Promise.allSettled([usersPromise, messageRecipientsPromise]); diff --git a/src/routes/(console)/project-[project]/messaging/message-[message]/+page.svelte b/src/routes/(console)/project-[project]/messaging/message-[message]/+page.svelte index 6e299cc84..26cfca0fd 100644 --- a/src/routes/(console)/project-[project]/messaging/message-[message]/+page.svelte +++ b/src/routes/(console)/project-[project]/messaging/message-[message]/+page.svelte @@ -12,7 +12,6 @@ import { MessagingProviderType } from '@appwrite.io/console'; import UpdateTopics from './updateTopics.svelte'; import UpdateTargets from './updateTargets.svelte'; - import Recipients from './recipients.svelte'; import { onMount } from 'svelte'; export let data: PageData; @@ -34,8 +33,10 @@ {/if} - - + {#if $message.status !== 'processing'} {/if} diff --git a/src/routes/(console)/project-[project]/messaging/message-[message]/recipients.svelte b/src/routes/(console)/project-[project]/messaging/message-[message]/recipients.svelte deleted file mode 100644 index fcce2439d..000000000 --- a/src/routes/(console)/project-[project]/messaging/message-[message]/recipients.svelte +++ /dev/null @@ -1,91 +0,0 @@ - - - - Users - - {@const sum = messageRecipients.length} - {#if sum} -

    - - - Name - Identifier - - - {#each messageRecipients.slice(offset, offset + limit) as recipient (recipient.$id)} - - -
    - - {recipient.name} - -
    -
    - - - {getIdentifier(recipient)} - - -
    - {/each} -
    -
    -
    -

    Total users: {messageRecipients.length}

    - -
    -
    - {:else} - -
    - No users have been selected. -

    - Need a hand? Check out our - - . -

    -
    -
    - {/if} - -
    diff --git a/src/routes/(console)/project-[project]/messaging/message-[message]/updateTargets.svelte b/src/routes/(console)/project-[project]/messaging/message-[message]/updateTargets.svelte index c05bdce61..a4ef93009 100644 --- a/src/routes/(console)/project-[project]/messaging/message-[message]/updateTargets.svelte +++ b/src/routes/(console)/project-[project]/messaging/message-[message]/updateTargets.svelte @@ -8,7 +8,14 @@ TableHeader, TableRow } from '$lib/elements/table'; - import { CardGrid, Heading, Empty, PaginationInline, EmptySearch } from '$lib/components'; + import { + CardGrid, + Heading, + Empty, + PaginationInline, + EmptySearch, + Alert + } from '$lib/components'; import { onMount } from 'svelte'; import { sdk } from '$lib/stores/sdk'; import { invalidate } from '$app/navigation'; @@ -22,6 +29,7 @@ export let message: Models.Message & { data: Record }; export let selectedTargetsById: Record; + export let selectedRecipients: Record>; let providerType: MessagingProviderType; let offset = 0; @@ -96,17 +104,74 @@ $: isDraft = message.status === 'draft'; $: disabled = symmetricDifference(targetIds, Object.keys(selectedTargetsById)).length === 0; + + $: recipients = message.users.reduce((acc, userId) => { + const recipient = selectedRecipients[userId]; + if (recipient) { + const target = recipient.targets.find((t) => t.providerType === message.providerType); + + if (target) { + acc[userId] = { + $id: recipient.$id, + name: recipient.name, + identifier: target.identifier, + providerType: message.providerType + }; + } + } else { + // user id exists but the user is null means the user account was deleted. + acc[userId] = null; + } + return acc; + }, {}); + + $: recipientsAvailable = recipientsCount > 0; + $: recipientsCount = Object.keys(recipients).filter((user) => user !== null).length; + $: hasDeletedUsers = Object.values(recipients).some((source) => source == null); Targets - {@const sum = targetIds.length} - {#if sum} + {@const sum = targetIds.length || Object.values(recipients).length} + {@const dataSource = + targets.length > 0 + ? targets + : Object.values(recipients).filter((user) => user !== null)} + + {#if hasDeletedUsers} +
    + {#if hasDeletedUsers && !dataSource.length} + + There are no targets to show + This message was sent to users who are no longer available, so their information + cannot be displayed. + + {:else} + 0} + on:dismiss={() => (hasDeletedUsers = false)}> + This message was sent to users who are no longer available, so their + information cannot be displayed. + + {/if} +
    + {/if} + + {#if sum && dataSource.length}
    -
    +
    Target + + {#if recipientsAvailable} + Identifier + + + + {/if}
    {#if isDraft}
    +
    - + + {#if recipientsAvailable} + + {/if} + + - {#each targets.slice(offset, offset + limit) as target (target.$id)} + + {#each dataSource.slice(offset, offset + limit) as source (source['$id'])}
    - {#if target.providerType === MessagingProviderType.Push} - {target.name} + {#if source['providerType'] === MessagingProviderType.Push} + {source['name']} {:else} - {target.identifier} + {source['identifier']} {/if}
    + {#if recipientsAvailable} + + + {source['name']} + + + {/if} + {#if isDraft}
    removeTarget(target.$id)}> + on:click={() => removeTarget(source['$id'])}>
    {:else if isDraft} (showTargets = true)}>Add a target - {:else} + {:else if !sum && !hasDeletedUsers}
    No targets have been selected. From f3c903a3085e083e737bd2b854bb21c2074b9977 Mon Sep 17 00:00:00 2001 From: Darshan Date: Wed, 29 Jan 2025 10:47:02 +0530 Subject: [PATCH 83/87] bump: console sdk for db read/writes. --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 428927dc5..348f13dbe 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "e2e:ui": "playwright test tests/e2e --ui" }, "dependencies": { - "@appwrite.io/console": "1.4.7", + "@appwrite.io/console": "1.5.1", "@appwrite.io/pink": "0.25.0", "@appwrite.io/pink-icons": "0.25.0", "@popperjs/core": "^2.11.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a31a13a9e..911bb0c01 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@appwrite.io/console': - specifier: 1.4.7 - version: 1.4.7 + specifier: 1.5.1 + version: 1.5.1 '@appwrite.io/pink': specifier: 0.25.0 version: 0.25.0 @@ -199,8 +199,8 @@ packages: '@analytics/type-utils@0.6.2': resolution: {integrity: sha512-TD+xbmsBLyYy/IxFimW/YL/9L2IEnM7/EoV9Aeh56U64Ify8o27HJcKjo38XY9Tcn0uOq1AX3thkKgvtWvwFQg==} - '@appwrite.io/console@1.4.7': - resolution: {integrity: sha512-5zx+c5nWRm/UJNxgtOi4vj1pYW+wusfnOX2hqEGDLLuNZRc1rViYRefNuezosp5SPtjClCIYn9TGuFlz/XLwhw==} + '@appwrite.io/console@1.5.1': + resolution: {integrity: sha512-H0fkBprsxXjOhbrE+MqXt1e4Gx4QeRdHuvMs7UxqGr2fAVEqh4ez2yk40A0ZSQvvN+rqLduoItMHQFl+sCPbtQ==} '@appwrite.io/pink-icons@0.25.0': resolution: {integrity: sha512-0O3i2oEuh5mWvjO80i+X6rbzrWLJ1m5wmv2/M3a1p2PyBJsFxN8xQMTEmTn3Wl/D26SsM7SpzbdW6gmfgoVU9Q==} @@ -3834,7 +3834,7 @@ snapshots: '@analytics/type-utils@0.6.2': {} - '@appwrite.io/console@1.4.7': {} + '@appwrite.io/console@1.5.1': {} '@appwrite.io/pink-icons@0.25.0': {} From bb04620771eee3fcb232b1887b5727c654b83f29 Mon Sep 17 00:00:00 2001 From: Darshan Date: Wed, 29 Jan 2025 10:48:41 +0530 Subject: [PATCH 84/87] fix: svelte check. --- src/lib/components/status.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/components/status.svelte b/src/lib/components/status.svelte index 71ddbde69..7dc78c84e 100644 --- a/src/lib/components/status.svelte +++ b/src/lib/components/status.svelte @@ -9,7 +9,7 @@ | 'building' | 'none'; - export let statusIconStyle: string; + export let statusIconStyle: string | undefined = undefined;
    Date: Wed, 29 Jan 2025 12:29:08 +0530 Subject: [PATCH 85/87] update: safeguard when the backend may not yet support the metrics for db read/writes. --- src/lib/layout/usage.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/layout/usage.svelte b/src/lib/layout/usage.svelte index 8f392847f..d9f31bc11 100644 --- a/src/lib/layout/usage.svelte +++ b/src/lib/layout/usage.svelte @@ -43,7 +43,7 @@ metrics: Models.Metric[], endingTotal: number ): Array<[string, number]> { - return metrics.reduceRight( + return (metrics ?? []).reduceRight( (acc, curr) => { acc.data.unshift([curr.date, acc.total]); acc.total -= curr.value; From 562ef2387cc2840816cc48878419c7d21ed371a2 Mon Sep 17 00:00:00 2001 From: Darshan Date: Wed, 29 Jan 2025 18:05:11 +0530 Subject: [PATCH 86/87] fix: count format. --- src/lib/charts/legend.svelte | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/charts/legend.svelte b/src/lib/charts/legend.svelte index f8ddc6355..2e72c1410 100644 --- a/src/lib/charts/legend.svelte +++ b/src/lib/charts/legend.svelte @@ -8,6 +8,7 @@ - - - Project breakdown - - - Project - {#if databaseOperationMetric} - Reads - Writes - {:else} - {getMetricTitle(metric)} - {/if} - - {#if estimate} - Estimated cost - {/if} - {#if $canSeeProjects} - - {/if} - - - {#each groupByProject(metric, estimate, databaseOperationMetric).sort((a, b) => { - const aValue = a.usage ?? a.databasesReads ?? 0; - const bValue = b.usage ?? b.databasesReads ?? 0; - return bValue - aValue; - }) as project} - {#if !$canSeeProjects} - - - {data.projectNames[project.projectId]?.name ?? 'Unknown'} - - {#if databaseOperationMetric} - - {format(project.databasesReads ?? 0)} - - - {format(project.databasesWrites ?? 0)} - - {:else} - - {format(project.usage)} - - {/if} - - {#if project.estimate} - - {formatCurrency(project.estimate)} - - {/if} - +{#if projects.some((project) => project[metric]) || projects.some( (project) => databaseOperationMetric?.some((metric) => project[metric]) )} + + + Project breakdown + + + Project + {#if databaseOperationMetric} + Reads + Writes {:else} - - - {data.projectNames[project.projectId]?.name ?? 'Unknown'} - - {#if databaseOperationMetric} - - {format(project.databasesReads ?? 0)} - - - {format(project.databasesWrites ?? 0)} - - {:else} - - {format(project.usage)} - - {/if} - - {#if project.estimate} - - {formatCurrency(project.estimate)} - - {/if} - - - - + {getMetricTitle(metric)} {/if} - {/each} - - - - + + {#if estimate} + Estimated cost + {/if} + {#if $canSeeProjects} + + {/if} + + + {#each groupByProject(metric, estimate, databaseOperationMetric).sort( (a, b) => { + const aValue = a.usage ?? a.databasesReads ?? 0; + const bValue = b.usage ?? b.databasesReads ?? 0; + return bValue - aValue; + } ) as project} + {#if !$canSeeProjects} + + + {data.projectNames[project.projectId]?.name ?? 'Unknown'} + + {#if databaseOperationMetric} + + {format(project.databasesReads ?? 0)} + + + {format(project.databasesWrites ?? 0)} + + {:else} + + {format(project.usage)} + + {/if} + + {#if project.estimate} + + {formatCurrency(project.estimate)} + + {/if} + + {:else} + + + {data.projectNames[project.projectId]?.name ?? 'Unknown'} + + {#if databaseOperationMetric} + + {format(project.databasesReads ?? 0)} + + + {format(project.databasesWrites ?? 0)} + + {:else} + + {format(project.usage)} + + {/if} + + {#if project.estimate} + + {formatCurrency(project.estimate)} + + {/if} + + + + + {/if} + {/each} + + + + +{/if}