From 2b5d6eab2d8b928e23690c039c0e65da9db9dc8e Mon Sep 17 00:00:00 2001 From: ChiragAgg5k Date: Fri, 28 Feb 2025 11:55:30 +0530 Subject: [PATCH] chore: updated usage to project level --- src/lib/sdk/billing.ts | 1 + src/lib/sdk/usage.ts | 7 +- .../usage/[[invoice]]/ProjectBreakdown.svelte | 2 + .../settings/usage/[[invoice]]/+page.svelte | 67 ++++++++++++++----- 4 files changed, 61 insertions(+), 16 deletions(-) diff --git a/src/lib/sdk/billing.ts b/src/lib/sdk/billing.ts index e1fe75c89..a1db18b62 100644 --- a/src/lib/sdk/billing.ts +++ b/src/lib/sdk/billing.ts @@ -237,6 +237,7 @@ export type OrganizationUsage = { users: number; authPhoneTotal: number; authPhoneEstimate: number; + imageTransformations: number; }>; authPhoneTotal: number; authPhoneEstimate: number; diff --git a/src/lib/sdk/usage.ts b/src/lib/sdk/usage.ts index f0bf1dc40..948f13b12 100644 --- a/src/lib/sdk/usage.ts +++ b/src/lib/sdk/usage.ts @@ -319,7 +319,12 @@ export type UsageProject = { authPhoneEstimate: number; /** - * Aggregated statistics of total number SMS by country + * Aggregated statistics of total number SMS by country. */ authPhoneCountriesBreakdown: Models.MetricBreakdown[]; + + /** + * Aggregated statistics of total number of image transformations. + */ + imageTransformations: number; }; diff --git a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/ProjectBreakdown.svelte b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/ProjectBreakdown.svelte index 5eea3c4a7..64e9ffd74 100644 --- a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/ProjectBreakdown.svelte +++ b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/ProjectBreakdown.svelte @@ -94,6 +94,7 @@ } switch (metric) { + case 'imageTransformations': case 'authPhoneTotal': return formatNumberWithCommas(value); case 'executions': @@ -106,6 +107,7 @@ } onMount(() => { + console.log(JSON.stringify(projects, null, 2)); if (metric === undefined && databaseOperationMetric === undefined) { throw new Error(`metric or database operations must be defined`); } 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 a0d8c2410..91ce093af 100644 --- a/src/routes/(console)/project-[project]/settings/usage/[[invoice]]/+page.svelte +++ b/src/routes/(console)/project-[project]/settings/usage/[[invoice]]/+page.svelte @@ -1,28 +1,28 @@