address comments: update copies, specs of the graphs.

This commit is contained in:
Darshan
2025-01-27 15:54:28 +05:30
parent 55d822b0f4
commit e358afc2fc
4 changed files with 57 additions and 37 deletions
+14 -2
View File
@@ -5,17 +5,23 @@
import { Card, Heading, SecondaryTabs, SecondaryTabsItem } from '$lib/components';
import { page } from '$app/stores';
import { type Models } from '@appwrite.io/console';
import { formatNumberWithCommas } from '$lib/helpers/numbers';
export let title: string;
export let total: number[];
export let path: string = null;
export let count: Models.Metric[][];
export let legendData: LegendData[];
export let showHeader: boolean = true;
export let overlapContainerCover = false;
</script>
<Container>
<Container overlapCover={overlapContainerCover}>
<div class="u-flex u-main-space-between common-section">
<Heading tag="h2" size="5">{title}</Heading>
{#if showHeader}
<Heading tag="h2" size="5">{title}</Heading>
{/if}
{#if path}
<SecondaryTabs>
<SecondaryTabsItem href={`${path}/24h`} disabled={$page.params.period === '24h'}>
@@ -34,6 +40,12 @@
</div>
<Card>
{#if count}
{@const totalCount = total.reduce((a, b) => a + b, 0)}
<Heading tag="h6" size="6">{formatNumberWithCommas(totalCount)}</Heading>
<p>Total {title.toLocaleLowerCase()}</p>
<div class="u-margin-block-start-16" />
<div class="multiple-chart-container u-flex-vertical u-gap-16">
<BarChart
formatted={$page.params.period === '24h' ? 'hours' : 'days'}
@@ -199,7 +199,7 @@
</CardGrid>
<CardGrid>
<Heading tag="h6" size="7">Databases reads and writes</Heading>
<Heading tag="h6" size="7">Database reads and writes</Heading>
<p class="text">
The total number of database reads and writes across all projects in your organization.
@@ -17,21 +17,25 @@
$: writesTotal = data.databaseWritesTotal;
</script>
<Usage
title="Databases"
path={`${base}/project-${$page.params.project}/databases/database-${$page.params.database}/usage`}
{total}
{count}
countMetadata={{
legend: 'Collections',
title: 'Total collections'
}} />
<div class="u-flex u-flex-vertical u-gap-16">
<Usage
title="Usage"
path={`${base}/project-${$page.params.project}/databases/database-${$page.params.database}/usage`}
{total}
{count}
countMetadata={{
legend: 'Collections',
title: 'Total collections'
}} />
<UsageMultiple
title="Reads and writes"
total={[readsTotal, writesTotal]}
count={[reads, writes]}
legendData={[
{ name: 'Reads', value: readsTotal },
{ name: 'Writes', value: writesTotal }
]} />
<UsageMultiple
title="Reads and writes"
showHeader={false}
overlapContainerCover
total={[readsTotal, writesTotal]}
count={[reads, writes]}
legendData={[
{ name: 'Reads', value: readsTotal },
{ name: 'Writes', value: writesTotal }
]} />
</div>
@@ -16,21 +16,25 @@
$: writesTotal = data.databasesWritesTotal;
</script>
<Usage
title="Databases"
path={`${base}/project-${$page.params.project}/databases/usage`}
{total}
{count}
countMetadata={{
legend: 'Databases',
title: 'Total databases'
}} />
<div class="u-flex u-flex-vertical u-gap-16">
<Usage
title="Usage"
path={`${base}/project-${$page.params.project}/databases/usage`}
{total}
{count}
countMetadata={{
legend: 'Databases',
title: 'Total databases'
}} />
<UsageMultiple
title="Reads and writes"
total={[readsTotal, writesTotal]}
count={[reads, writes]}
legendData={[
{ name: 'Reads', value: readsTotal },
{ name: 'Writes', value: writesTotal }
]} />
<UsageMultiple
title="Reads and writes"
showHeader={false}
overlapContainerCover
total={[readsTotal, writesTotal]}
count={[reads, writes]}
legendData={[
{ name: 'Reads', value: readsTotal },
{ name: 'Writes', value: writesTotal }
]} />
</div>