mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
chore: remove Container from usage component
This commit is contained in:
1 parent
750a4e71f8
commit
9472838847
13 files changed
+211
-189
No files matched your search
+40
-43
@@ -58,7 +58,6 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { Container } from '$lib/layout';
|
||||
import { BarChart } from '$lib/charts';
|
||||
import { formatNumberWithCommas } from '$lib/helpers/numbers';
|
||||
import { Card } from '$lib/components';
|
||||
@@ -81,52 +80,50 @@
|
||||
export let hidePeriodSelect = false;
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
<Layout.Stack gap="s">
|
||||
{#if !hidePeriodSelect}
|
||||
<div
|
||||
style:max-width="250px"
|
||||
style:--input-background-color="var(--bgcolor-neutral-primary)">
|
||||
<InputSelect
|
||||
on:change={(e) => goto(`${path}/${e.detail}`)}
|
||||
id="period"
|
||||
options={[
|
||||
<Layout.Stack gap="s">
|
||||
{#if !hidePeriodSelect}
|
||||
<div
|
||||
style:max-width="250px"
|
||||
style:--input-background-color="var(--bgcolor-neutral-primary)">
|
||||
<InputSelect
|
||||
on:change={(e) => goto(`${path}/${e.detail}`)}
|
||||
id="period"
|
||||
options={[
|
||||
{
|
||||
label: '24 hours',
|
||||
value: '24h'
|
||||
},
|
||||
{
|
||||
label: '30 days',
|
||||
value: '30d'
|
||||
},
|
||||
{
|
||||
label: '90 days',
|
||||
value: '90d'
|
||||
}
|
||||
]}
|
||||
value={$page.params.period ?? '30d'} />
|
||||
</div>
|
||||
{/if}
|
||||
<Card>
|
||||
{#if count}
|
||||
<Layout.Stack gap="xs">
|
||||
<Typography.Title>{formatNumberWithCommas(total)}</Typography.Title>
|
||||
<Typography.Text>{countMetadata.title}</Typography.Text>
|
||||
</Layout.Stack>
|
||||
<div class="chart-container">
|
||||
<BarChart
|
||||
formatted={$page.params.period === '24h' ? 'hours' : 'days'}
|
||||
series={[
|
||||
{
|
||||
label: '24 hours',
|
||||
value: '24h'
|
||||
},
|
||||
{
|
||||
label: '30 days',
|
||||
value: '30d'
|
||||
},
|
||||
{
|
||||
label: '90 days',
|
||||
value: '90d'
|
||||
name: countMetadata.legend,
|
||||
data: accumulateFromEndingTotal(count, total)
|
||||
}
|
||||
]}
|
||||
value={$page.params.period ?? '30d'} />
|
||||
]} />
|
||||
</div>
|
||||
{/if}
|
||||
<Card>
|
||||
{#if count}
|
||||
<Layout.Stack gap="xs">
|
||||
<Typography.Title>{formatNumberWithCommas(total)}</Typography.Title>
|
||||
<Typography.Text>{countMetadata.title}</Typography.Text>
|
||||
</Layout.Stack>
|
||||
<div class="chart-container">
|
||||
<BarChart
|
||||
formatted={$page.params.period === '24h' ? 'hours' : 'days'}
|
||||
series={[
|
||||
{
|
||||
name: countMetadata.legend,
|
||||
data: accumulateFromEndingTotal(count, total)
|
||||
}
|
||||
]} />
|
||||
</div>
|
||||
{/if}
|
||||
</Card>
|
||||
</Layout.Stack>
|
||||
</Container>
|
||||
</Card>
|
||||
</Layout.Stack>
|
||||
|
||||
<style lang="scss">
|
||||
.chart-container {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import { Container } from '$lib/layout';
|
||||
import { BarChart, Legend, type LegendData } from '$lib/charts';
|
||||
import { accumulateFromEndingTotal } from '$lib/layout/usage.svelte';
|
||||
import { Card, SecondaryTabs, SecondaryTabsItem } from '$lib/components';
|
||||
@@ -14,10 +13,9 @@
|
||||
export let count: Models.Metric[][];
|
||||
export let legendData: LegendData[];
|
||||
export let showHeader: boolean = true;
|
||||
export let overlapContainerCover = false;
|
||||
</script>
|
||||
|
||||
<Container overlapCover={overlapContainerCover}>
|
||||
<div>
|
||||
{#if showHeader}
|
||||
<div class="u-flex u-main-space-between common-section">
|
||||
<Typography.Title>{title}</Typography.Title>
|
||||
@@ -66,7 +64,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
</Card>
|
||||
</Container>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.multiple-chart-container {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Usage } from '$lib/layout';
|
||||
import { Container, Usage } from '$lib/layout';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
export let data: PageData;
|
||||
@@ -9,12 +9,14 @@
|
||||
$: count = data.users;
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Users"
|
||||
path={`${base}/project-${$page.params.project}/auth/usage`}
|
||||
countMetadata={{
|
||||
legend: 'Users',
|
||||
title: 'Registered users'
|
||||
}}
|
||||
{total}
|
||||
{count} />
|
||||
<Container>
|
||||
<Usage
|
||||
title="Users"
|
||||
path={`${base}/project-${$page.params.project}/auth/usage`}
|
||||
countMetadata={{
|
||||
legend: 'Users',
|
||||
title: 'Registered users'
|
||||
}}
|
||||
{total}
|
||||
{count} />
|
||||
</Container>
|
||||
+12
-9
@@ -2,6 +2,7 @@
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Usage } from '$lib/layout';
|
||||
import Container from '$lib/layout/container.svelte';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
export let data: PageData;
|
||||
@@ -9,12 +10,14 @@
|
||||
$: count = data.documents;
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Databases"
|
||||
path={`${base}/project-${$page.params.project}/databases/database-${$page.params.database}/collection-${$page.params.collection}/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Documents',
|
||||
title: 'Total documents'
|
||||
}} />
|
||||
<Container>
|
||||
<Usage
|
||||
title="Databases"
|
||||
path={`${base}/project-${$page.params.project}/databases/database-${$page.params.database}/collection-${$page.params.collection}/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Documents',
|
||||
title: 'Total documents'
|
||||
}} />
|
||||
</Container>
|
||||
+24
-20
@@ -1,7 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Usage, UsageMultiple } from '$lib/layout';
|
||||
import { Container, Usage, UsageMultiple } from '$lib/layout';
|
||||
import { Layout } from '@appwrite.io/pink-svelte';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
export let data: PageData;
|
||||
@@ -16,23 +17,26 @@
|
||||
$: writesTotal = data.databaseWritesTotal;
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Usage"
|
||||
path={`${base}/project-${$page.params.project}/databases/database-${$page.params.database}/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Collections',
|
||||
title: 'Total collections'
|
||||
}} />
|
||||
<Container>
|
||||
<Layout.Stack gap="l">
|
||||
<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"
|
||||
showHeader={false}
|
||||
overlapContainerCover
|
||||
total={[readsTotal, writesTotal]}
|
||||
count={[reads, writes]}
|
||||
legendData={[
|
||||
{ name: 'Reads', value: readsTotal },
|
||||
{ name: 'Writes', value: writesTotal }
|
||||
]} />
|
||||
<UsageMultiple
|
||||
title="Reads and writes"
|
||||
showHeader={false}
|
||||
total={[readsTotal, writesTotal]}
|
||||
count={[reads, writes]}
|
||||
legendData={[
|
||||
{ name: 'Reads', value: readsTotal },
|
||||
{ name: 'Writes', value: writesTotal }
|
||||
]} />
|
||||
</Layout.Stack>
|
||||
</Container>
|
||||
@@ -1,7 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Usage, UsageMultiple } from '$lib/layout';
|
||||
import { Container, Usage, UsageMultiple } from '$lib/layout';
|
||||
import { Layout } from '@appwrite.io/pink-svelte';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
export let data: PageData;
|
||||
@@ -15,23 +16,26 @@
|
||||
$: writesTotal = data.databasesWritesTotal;
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Usage"
|
||||
path={`${base}/project-${$page.params.project}/databases/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Databases',
|
||||
title: 'Total databases'
|
||||
}} />
|
||||
<Container>
|
||||
<Layout.Stack gap="l">
|
||||
<Usage
|
||||
title="Usage"
|
||||
path={`${base}/project-${$page.params.project}/databases/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Databases',
|
||||
title: 'Total databases'
|
||||
}} />
|
||||
|
||||
<UsageMultiple
|
||||
title="Reads and writes"
|
||||
showHeader={false}
|
||||
overlapContainerCover
|
||||
total={[readsTotal, writesTotal]}
|
||||
count={[reads, writes]}
|
||||
legendData={[
|
||||
{ name: 'Reads', value: readsTotal },
|
||||
{ name: 'Writes', value: writesTotal }
|
||||
]} />
|
||||
<UsageMultiple
|
||||
title="Reads and writes"
|
||||
showHeader={false}
|
||||
total={[readsTotal, writesTotal]}
|
||||
count={[reads, writes]}
|
||||
legendData={[
|
||||
{ name: 'Reads', value: readsTotal },
|
||||
{ name: 'Writes', value: writesTotal }
|
||||
]} />
|
||||
</Layout.Stack>
|
||||
</Container>
|
||||
+28
-26
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Usage } from '$lib/layout';
|
||||
import { Container, Usage } from '$lib/layout';
|
||||
import { page } from '$app/stores';
|
||||
import type { PageData } from './$types';
|
||||
import { base } from '$app/paths';
|
||||
@@ -12,29 +12,31 @@
|
||||
$: mbSecondsCount = data.executionsMbSeconds;
|
||||
</script>
|
||||
|
||||
<Layout.Stack gap="l">
|
||||
{#if count}
|
||||
<Usage
|
||||
title="Executions"
|
||||
path={`${base}/project-${$page.params.project}/functions/function-${$page.params.function}/usage`}
|
||||
countMetadata={{
|
||||
legend: 'Executions',
|
||||
title: 'Total executions'
|
||||
}}
|
||||
{total}
|
||||
{count} />
|
||||
{/if}
|
||||
<Container>
|
||||
<Layout.Stack gap="l">
|
||||
{#if count}
|
||||
<Usage
|
||||
title="Executions"
|
||||
path={`${base}/project-${$page.params.project}/functions/function-${$page.params.function}/usage`}
|
||||
countMetadata={{
|
||||
legend: 'Executions',
|
||||
title: 'Total executions'
|
||||
}}
|
||||
{total}
|
||||
{count} />
|
||||
{/if}
|
||||
|
||||
{#if mbSecondsCount}
|
||||
<Usage
|
||||
hidePeriodSelect
|
||||
title="GB hours"
|
||||
path={`${base}/project-${$page.params.project}/functions/function-${$page.params.function}/usage`}
|
||||
countMetadata={{
|
||||
legend: 'GB hours',
|
||||
title: 'Total GB hours'
|
||||
}}
|
||||
total={gbHoursTotal}
|
||||
count={mbSecondsCount} />
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
{#if mbSecondsCount}
|
||||
<Usage
|
||||
hidePeriodSelect
|
||||
title="GB hours"
|
||||
path={`${base}/project-${$page.params.project}/functions/function-${$page.params.function}/usage`}
|
||||
countMetadata={{
|
||||
legend: 'GB hours',
|
||||
title: 'Total GB hours'
|
||||
}}
|
||||
total={gbHoursTotal}
|
||||
count={mbSecondsCount} />
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
</Container>
|
||||
@@ -1,19 +1,21 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Usage } from '$lib/layout';
|
||||
import { Container, Usage } from '$lib/layout';
|
||||
|
||||
export let data;
|
||||
$: total = data.deploymentsTotal;
|
||||
$: count = data.deployments;
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Functions"
|
||||
path={`${base}/project-${$page.params.project}/functions/usage`}
|
||||
countMetadata={{
|
||||
legend: 'Functions',
|
||||
title: 'Total functions'
|
||||
}}
|
||||
{total}
|
||||
{count} />
|
||||
<Container>
|
||||
<Usage
|
||||
title="Functions"
|
||||
path={`${base}/project-${$page.params.project}/functions/usage`}
|
||||
countMetadata={{
|
||||
legend: 'Functions',
|
||||
title: 'Total functions'
|
||||
}}
|
||||
{total}
|
||||
{count} />
|
||||
</Container>
|
||||
+4
-1
@@ -6,6 +6,7 @@
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { DeploymentDownloadType, type Models } from '@appwrite.io/console';
|
||||
import {
|
||||
IconChevronRight,
|
||||
IconDotsHorizontal,
|
||||
IconDownload,
|
||||
IconLightningBolt,
|
||||
@@ -77,7 +78,9 @@
|
||||
{#if deployment?.status === 'ready' || deployment?.status === 'failed'}
|
||||
<SubMenu>
|
||||
<ActionMenu.Root noPadding>
|
||||
<ActionMenu.Item.Button leadingIcon={IconDownload}>
|
||||
<ActionMenu.Item.Button
|
||||
leadingIcon={IconDownload}
|
||||
trailingIcon={IconChevronRight}>
|
||||
Download
|
||||
</ActionMenu.Item.Button>
|
||||
</ActionMenu.Root>
|
||||
|
||||
+16
-14
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Usage } from '$lib/layout';
|
||||
import { Container, Usage } from '$lib/layout';
|
||||
|
||||
export let data;
|
||||
$: total = data.deploymentsTotal;
|
||||
@@ -13,22 +13,24 @@
|
||||
$: console.log(data);
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Deployments"
|
||||
path={`${base}/project-${$page.params.project}/sites/site-${$page.params.site}/usage`}
|
||||
countMetadata={{
|
||||
legend: 'Deployments',
|
||||
title: 'Total deployments'
|
||||
}}
|
||||
{total}
|
||||
{count} />
|
||||
<Container>
|
||||
<Usage
|
||||
title="Deployments"
|
||||
path={`${base}/project-${$page.params.project}/sites/site-${$page.params.site}/usage`}
|
||||
countMetadata={{
|
||||
legend: 'Deployments',
|
||||
title: 'Total deployments'
|
||||
}}
|
||||
{total}
|
||||
{count} />
|
||||
|
||||
<!-- <Usage
|
||||
<!-- <Usage
|
||||
title="Builds"
|
||||
path={`${base}/project-${$page.params.project}/sites/site-${$page.params.site}/usage`}
|
||||
countMetadata={{
|
||||
legend: 'Builds',
|
||||
title: 'Total builds'
|
||||
}}
|
||||
total={totalBuilds}
|
||||
count={countBuilds} /> -->
|
||||
}}
|
||||
total={totalBuilds}
|
||||
count={countBuilds} /> -->
|
||||
</Container>
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Usage } from '$lib/layout';
|
||||
import { Container, Usage } from '$lib/layout';
|
||||
|
||||
export let data;
|
||||
$: total = data.deploymentsTotal;
|
||||
@@ -10,12 +10,14 @@
|
||||
$: console.log(data);
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Sites"
|
||||
path={`${base}/project-${$page.params.project}/sites/usage`}
|
||||
countMetadata={{
|
||||
legend: 'Sites',
|
||||
title: 'Total sites'
|
||||
}}
|
||||
{total}
|
||||
{count} />
|
||||
<Container>
|
||||
<Usage
|
||||
title="Sites"
|
||||
path={`${base}/project-${$page.params.project}/sites/usage`}
|
||||
countMetadata={{
|
||||
legend: 'Sites',
|
||||
title: 'Total sites'
|
||||
}}
|
||||
{total}
|
||||
{count} />
|
||||
</Container>
|
||||
+12
-10
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Usage } from '$lib/layout';
|
||||
import { Container, Usage } from '$lib/layout';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
export let data: PageData;
|
||||
@@ -9,12 +9,14 @@
|
||||
$: count = data.files;
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Files"
|
||||
path={`${base}/project-${$page.params.project}/storage/bucket-${$page.params.bucket}/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Files',
|
||||
title: 'Total files'
|
||||
}} />
|
||||
<Container>
|
||||
<Usage
|
||||
title="Files"
|
||||
path={`${base}/project-${$page.params.project}/storage/bucket-${$page.params.bucket}/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Files',
|
||||
title: 'Total files'
|
||||
}} />
|
||||
</Container>
|
||||
@@ -1,20 +1,21 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Usage } from '$lib/layout';
|
||||
import type { PageData } from './$types';
|
||||
import { Container, Usage } from '$lib/layout';
|
||||
|
||||
export let data: PageData;
|
||||
export let data;
|
||||
$: total = data.bucketsTotal;
|
||||
$: count = data.buckets;
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Buckets"
|
||||
path={`${base}/project-${$page.params.project}/storage/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Buckets',
|
||||
title: 'Total buckets'
|
||||
}} />
|
||||
<Container>
|
||||
<Usage
|
||||
title="Buckets"
|
||||
path={`${base}/project-${$page.params.project}/storage/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Buckets',
|
||||
title: 'Total buckets'
|
||||
}} />
|
||||
</Container>
|
||||
Reference in new issue
Block a user