diff --git a/src/lib/sdk/tempFunctions.ts b/src/lib/sdk/tempFunctions.ts index 9df8775fa..6440f62d0 100644 --- a/src/lib/sdk/tempFunctions.ts +++ b/src/lib/sdk/tempFunctions.ts @@ -1,4 +1,10 @@ -import { AppwriteException, FunctionUsageRange, type Client, type Payload, type ProjectUsageRange } from '@appwrite.io/console'; +import { + AppwriteException, + FunctionUsageRange, + type Client, + type Payload, + type ProjectUsageRange +} from '@appwrite.io/console'; /** * Metric @@ -176,8 +182,12 @@ export class TempFunctions { * @param {ProjectUsageRange} period * @throws {AppwriteException} * @returns {Promise} - */ - async getUsage(startDate: string, endDate: string, period?: ProjectUsageRange): Promise { + */ + async getUsage( + startDate: string, + endDate: string, + period?: ProjectUsageRange + ): Promise { if (typeof startDate === 'undefined') { throw new AppwriteException('Missing required parameter: "startDate"'); } @@ -202,9 +212,14 @@ export class TempFunctions { } const uri = new URL(this.client.config.endpoint + apiPath); - return await this.client.call('get', uri, { - 'content-type': 'application/json', - }, payload); + return await this.client.call( + 'get', + uri, + { + 'content-type': 'application/json' + }, + payload + ); } /** @@ -215,7 +230,7 @@ export class TempFunctions { * @param {FunctionUsageRange} range * @throws {AppwriteException} * @returns {Promise} - */ + */ async getFunctionUsage(functionId: string, range?: FunctionUsageRange): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); @@ -229,8 +244,13 @@ export class TempFunctions { } const uri = new URL(this.client.config.endpoint + apiPath); - return await this.client.call('get', uri, { - 'content-type': 'application/json', - }, payload); + return await this.client.call( + 'get', + uri, + { + 'content-type': 'application/json' + }, + payload + ); } -} \ No newline at end of file +} 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 fc264912d..1c800fd5f 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 @@ -50,35 +50,34 @@ {/if} {#if deploymentsStorage} - - {humanFileSize(deploymentsStorageTotal).value}{humanFileSize(deploymentsStorageTotal).unit} -

Deployments Storage

-
- - value - ? `${humanFileSize(+value).value} ${ - humanFileSize(+value).unit - }` - : '0' + + {humanFileSize(deploymentsStorageTotal).value}{humanFileSize( + deploymentsStorageTotal + ).unit} +

Deployments Storage

+
+ + value + ? `${humanFileSize(+value).value} ${humanFileSize(+value).unit}` + : '0' + } } - } - }} - series={[ - { - name: 'Bandwidth', - data: [ - ...deploymentsStorage.map((e) => [e.date, e.value]) - ], - tooltip: { - valueFormatter: (value) => - `${humanFileSize(+value).value} ${humanFileSize(+value).unit}` + }} + series={[ + { + name: 'Bandwidth', + data: [...deploymentsStorage.map((e) => [e.date, e.value])], + tooltip: { + valueFormatter: (value) => + `${humanFileSize(+value).value} ${humanFileSize(+value).unit}` + } } - } - ]} /> - -{/if} - \ No newline at end of file + ]} /> + + {/if} + 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 4a98567c5..f89f96a5f 100644 --- a/src/routes/console/project-[project]/settings/usage/[[invoice]]/+page.svelte +++ b/src/routes/console/project-[project]/settings/usage/[[invoice]]/+page.svelte @@ -328,33 +328,33 @@
{#if data.usage.deploymentsStorageBreakdown.length > 0} - - - Function - Usage - - - - {#each data.usage.deploymentsStorageBreakdown.sort((a, b) => b.value - a.value) as func} - {@const humanized = humanFileSize(func.value)} - - - {func.name ?? func.resourceId} - - - {humanized.value}{humanized.unit} - - - View function - - - {/each} - -
- {/if} - {:else} + + + Function + Usage + + + + {#each data.usage.deploymentsStorageBreakdown.sort((a, b) => b.value - a.value) as func} + {@const humanized = humanFileSize(func.value)} + + + {func.name ?? func.resourceId} + + + {humanized.value}{humanized.unit} + + + View function + + + {/each} + +
+ {/if} + {:else}