From 2db2794b98020f98910a5cc04f7f899e9964fed1 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Mon, 29 Jul 2024 12:48:24 +0900 Subject: [PATCH] Update to use functionsTotalStorage --- src/lib/sdk/tempFunctions.ts | 8 ++-- .../usage/[[period]]/+page.svelte | 7 +-- .../settings/usage/[[invoice]]/+page.svelte | 44 ++++++++----------- 3 files changed, 24 insertions(+), 35 deletions(-) diff --git a/src/lib/sdk/tempFunctions.ts b/src/lib/sdk/tempFunctions.ts index 6440f62d0..2dc45aca8 100644 --- a/src/lib/sdk/tempFunctions.ts +++ b/src/lib/sdk/tempFunctions.ts @@ -63,9 +63,9 @@ type UsageProject = { */ filesStorageTotal: number; /** - * Total aggregated sum of deployments storage size (in bytes). + * Total aggregated sum of functions storage size (in bytes). */ - deploymentsStorageTotal: number; + functionsStorageTotal: number; /** * Total aggregated number of buckets. */ @@ -95,9 +95,9 @@ type UsageProject = { */ bucketsBreakdown: MetricBreakdown[]; /** - * Aggregated breakdown in totals of usage by deployments. + * Aggregated breakdown in totals of usage by functions. */ - deploymentsStorageBreakdown: MetricBreakdown[]; + functionsStorageBreakdown: MetricBreakdown[]; }; /** diff --git a/src/routes/console/project-[project]/functions/function-[function]/usage/[[period]]/+page.svelte b/src/routes/console/project-[project]/functions/function-[function]/usage/[[period]]/+page.svelte index 1c800fd5f..b678e6f16 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/usage/[[period]]/+page.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/usage/[[period]]/+page.svelte @@ -5,13 +5,10 @@ import { page } from '$app/stores'; import type { PageData } from './$types'; import { formatNumberWithCommas } from '$lib/helpers/numbers'; - import { humanFileSize } from '$lib/helpers/sizeConvertion'; export let data: PageData; $: total = data.executionsTotal; $: count = data.executions; - $: deploymentsStorageTotal = data.deploymentsStorageTotal; - $: deploymentsStorage = data.deploymentsStorage; @@ -49,7 +46,7 @@ ]} /> {/if} - {#if deploymentsStorage} + 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 f89f96a5f..778b985b5 100644 --- a/src/routes/console/project-[project]/settings/usage/[[invoice]]/+page.svelte +++ b/src/routes/console/project-[project]/settings/usage/[[invoice]]/+page.svelte @@ -28,7 +28,7 @@ $: executions = data.usage.executions; $: executionsTotal = data.usage.executionsTotal; $: storage = data.usage.filesStorageTotal; - $: deploymentsTotal = data.usage.deploymentsStorageTotal; + $: functionsTotal = data.usage.functionsStorageTotal; const tier = data?.currentInvoice?.tier ?? $organization?.billingPlan; const plan = tierToPlan(tier).name; @@ -269,6 +269,18 @@

+ {#if !storage && !functionsTotal} + +
+
+
+ {/if} + {#if storage} {@const humanized = humanFileSize(storage)}
@@ -306,28 +318,18 @@ {/if} - {:else} - -
-
-
{/if} - {#if deploymentsTotal} - {@const humanized = humanFileSize(deploymentsTotal)} + {#if functionsTotal} + {@const humanized = humanFileSize(functionsTotal)}

- Deployments - {humanized.value} + Functions - {humanized.value} {humanized.unit}

- {#if data.usage.deploymentsStorageBreakdown.length > 0} + {#if data.usage.functionsStorageBreakdown.length > 0} Function @@ -335,7 +337,7 @@ - {#each data.usage.deploymentsStorageBreakdown.sort((a, b) => b.value - a.value) as func} + {#each data.usage.functionsStorageBreakdown.sort((a, b) => b.value - a.value) as func} {@const humanized = humanFileSize(func.value)} @@ -354,16 +356,6 @@
{/if} - {:else} - -
-
-
{/if}