mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
Update to use functionsTotalStorage
This commit is contained in:
1 parent
bd6d76936b
commit
2db2794b98
3 files changed
+24
-35
No files matched your search
@@ -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[];
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
+2
-5
@@ -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;
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
@@ -49,7 +46,7 @@
|
||||
]} />
|
||||
</Card>
|
||||
{/if}
|
||||
{#if deploymentsStorage}
|
||||
<!-- {#if deploymentsStorage}
|
||||
<Card>
|
||||
<Heading tag="h6" size="6"
|
||||
>{humanFileSize(deploymentsStorageTotal).value}{humanFileSize(
|
||||
@@ -79,5 +76,5 @@
|
||||
}
|
||||
]} />
|
||||
</Card>
|
||||
{/if}
|
||||
{/if} -->
|
||||
</Container>
|
||||
@@ -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 @@
|
||||
</p>
|
||||
|
||||
<svelte:fragment slot="aside">
|
||||
{#if !storage && !functionsTotal}
|
||||
<Card isDashed>
|
||||
<div class="u-flex u-cross-center u-flex-vertical u-main-center u-flex">
|
||||
<span
|
||||
class="icon-chart-square-bar text-large"
|
||||
aria-hidden="true"
|
||||
style="font-size: 32px;" />
|
||||
<p class="u-bold">No data to show for storage</p>
|
||||
</div>
|
||||
</Card>
|
||||
{/if}
|
||||
|
||||
{#if storage}
|
||||
{@const humanized = humanFileSize(storage)}
|
||||
<div class="u-flex u-flex-vertical">
|
||||
@@ -306,28 +318,18 @@
|
||||
</TableBody>
|
||||
</Table>
|
||||
{/if}
|
||||
{:else}
|
||||
<Card isDashed>
|
||||
<div class="u-flex u-cross-center u-flex-vertical u-main-center u-flex">
|
||||
<span
|
||||
class="icon-chart-square-bar text-large"
|
||||
aria-hidden="true"
|
||||
style="font-size: 32px;" />
|
||||
<p class="u-bold">No data to show for files</p>
|
||||
</div>
|
||||
</Card>
|
||||
{/if}
|
||||
{#if deploymentsTotal}
|
||||
{@const humanized = humanFileSize(deploymentsTotal)}
|
||||
{#if functionsTotal}
|
||||
{@const humanized = humanFileSize(functionsTotal)}
|
||||
<div class="u-flex u-flex-vertical">
|
||||
<div class="u-flex u-main-space-between">
|
||||
<p>
|
||||
<span class="heading-level-4">Deployments - {humanized.value}</span>
|
||||
<span class="heading-level-4">Functions - {humanized.value}</span>
|
||||
<span class="body-text-1 u-bold">{humanized.unit}</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{#if data.usage.deploymentsStorageBreakdown.length > 0}
|
||||
{#if data.usage.functionsStorageBreakdown.length > 0}
|
||||
<Table noMargin noStyles>
|
||||
<TableHeader>
|
||||
<TableCellHead width={285}>Function</TableCellHead>
|
||||
@@ -335,7 +337,7 @@
|
||||
<TableCellHead width={140} />
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{#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)}
|
||||
<TableRow>
|
||||
<TableCell title="Function">
|
||||
@@ -354,16 +356,6 @@
|
||||
</TableBody>
|
||||
</Table>
|
||||
{/if}
|
||||
{:else}
|
||||
<Card isDashed>
|
||||
<div class="u-flex u-cross-center u-flex-vertical u-main-center u-flex">
|
||||
<span
|
||||
class="icon-chart-square-bar text-large"
|
||||
aria-hidden="true"
|
||||
style="font-size: 32px;" />
|
||||
<p class="u-bold">No data to show for deployments</p>
|
||||
</div>
|
||||
</Card>
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
</CardGrid>
|
||||
|
||||
Reference in new issue
Block a user