Run Linter

This commit is contained in:
Bradley Schofield
2024-07-23 13:38:45 +09:00
parent 6b03e32c33
commit bd6d76936b
3 changed files with 87 additions and 68 deletions
+31 -11
View File
@@ -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<UsageProject> {
*/
async getUsage(
startDate: string,
endDate: string,
period?: ProjectUsageRange
): Promise<UsageProject> {
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<UsageFunction> {
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
);
}
}
}
@@ -50,35 +50,34 @@
</Card>
{/if}
{#if deploymentsStorage}
<Card>
<Heading tag="h6" size="6">{humanFileSize(deploymentsStorageTotal).value}{humanFileSize(deploymentsStorageTotal).unit}</Heading>
<p>Deployments Storage</p>
<div class="u-margin-block-start-16" />
<BarChart
options={{
yAxis: {
axisLabel: {
formatter: (value) =>
value
? `${humanFileSize(+value).value} ${
humanFileSize(+value).unit
}`
: '0'
<Card>
<Heading tag="h6" size="6"
>{humanFileSize(deploymentsStorageTotal).value}{humanFileSize(
deploymentsStorageTotal
).unit}</Heading>
<p>Deployments Storage</p>
<div class="u-margin-block-start-16" />
<BarChart
options={{
yAxis: {
axisLabel: {
formatter: (value) =>
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}`
}
}
}
]} />
</Card>
{/if}
</Container>
]} />
</Card>
{/if}
</Container>
@@ -328,33 +328,33 @@
</div>
</div>
{#if data.usage.deploymentsStorageBreakdown.length > 0}
<Table noMargin noStyles>
<TableHeader>
<TableCellHead width={285}>Function</TableCellHead>
<TableCellHead>Usage</TableCellHead>
<TableCellHead width={140} />
</TableHeader>
<TableBody>
{#each data.usage.deploymentsStorageBreakdown.sort((a, b) => b.value - a.value) as func}
{@const humanized = humanFileSize(func.value)}
<TableRow>
<TableCell title="Function">
{func.name ?? func.resourceId}
</TableCell>
<TableCell title="Usage">
{humanized.value}{humanized.unit}
</TableCell>
<TableCellLink
href={`${base}/functions/function-${func.resourceId}`}
title="View function">
View function
</TableCellLink>
</TableRow>
{/each}
</TableBody>
</Table>
{/if}
{:else}
<Table noMargin noStyles>
<TableHeader>
<TableCellHead width={285}>Function</TableCellHead>
<TableCellHead>Usage</TableCellHead>
<TableCellHead width={140} />
</TableHeader>
<TableBody>
{#each data.usage.deploymentsStorageBreakdown.sort((a, b) => b.value - a.value) as func}
{@const humanized = humanFileSize(func.value)}
<TableRow>
<TableCell title="Function">
{func.name ?? func.resourceId}
</TableCell>
<TableCell title="Usage">
{humanized.value}{humanized.unit}
</TableCell>
<TableCellLink
href={`${base}/functions/function-${func.resourceId}`}
title="View function">
View function
</TableCellLink>
</TableRow>
{/each}
</TableBody>
</Table>
{/if}
{:else}
<Card isDashed>
<div class="u-flex u-cross-center u-flex-vertical u-main-center u-flex">
<span