From d7d29bf4596afdeb00eb535e3b294175c8131f08 Mon Sep 17 00:00:00 2001 From: Darshan Date: Thu, 26 Jun 2025 19:59:52 +0530 Subject: [PATCH] fix: usage calc on function. --- .../function-[function]/usage/[[period]]/+page.svelte | 8 +++++++- .../function-[function]/usage/[[period]]/+page.ts | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/usage/[[period]]/+page.svelte b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/usage/[[period]]/+page.svelte index 30c05dd10..705478db7 100644 --- a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/usage/[[period]]/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/usage/[[period]]/+page.svelte @@ -9,6 +9,12 @@ $: count = data.executions; $: gbHoursTotal = data.executionsMbSecondsTotal / 1000 / 3600; $: mbSecondsCount = data.executionsMbSeconds; + $: gbHoursCount = data.executionsMbSeconds + ?.map((metric) => ({ + ...metric, + value: metric.value / 1000 / 3600 + })) + .filter(({ value }) => value); @@ -33,7 +39,7 @@ title: 'Total GB hours' }} total={gbHoursTotal} - count={mbSecondsCount} /> + count={gbHoursCount} /> {/if} diff --git a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/usage/[[period]]/+page.ts b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/usage/[[period]]/+page.ts index a802c1c30..041a37dbd 100644 --- a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/usage/[[period]]/+page.ts +++ b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/usage/[[period]]/+page.ts @@ -7,6 +7,7 @@ export const load: PageLoad = async ({ params }) => { const period = isValueOfStringEnum(FunctionUsageRange, params.period) ? params.period : FunctionUsageRange.ThirtyDays; + return sdk .forProject(params.region, params.project) .functions.getUsage(params.function, period);