mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
metrics adjustments
This commit is contained in:
+1
-1
@@ -18,7 +18,7 @@
|
||||
"e2e": "playwright test tests/e2e"
|
||||
},
|
||||
"dependencies": {
|
||||
"@appwrite.io/console": "npm:shimon-appwrite-console@0.1.2",
|
||||
"@appwrite.io/console": "npm:shimon-appwrite-console@0.3.3",
|
||||
"@appwrite.io/pink": "0.1.0-next.9",
|
||||
"@appwrite.io/pink-icons": "^0.1.0-next.9",
|
||||
"@popperjs/core": "^2.11.8",
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
};
|
||||
|
||||
export let title: string;
|
||||
export let total: number;
|
||||
export let count: Models.Metric[];
|
||||
export let countMetadata: MetricMetadata;
|
||||
export let path: string = null;
|
||||
@@ -48,7 +49,7 @@
|
||||
</div>
|
||||
<Card>
|
||||
{#if count}
|
||||
<Heading tag="h6" size="6">{total(count)}</Heading>
|
||||
<Heading tag="h6" size="6">{total}</Heading>
|
||||
<p>{countMetadata.title}</p>
|
||||
<div class="u-margin-block-start-16" />
|
||||
<div class="chart-container">
|
||||
|
||||
@@ -4,13 +4,14 @@
|
||||
import type { PageData } from './$types';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
$: count = data.usersTotal;
|
||||
$: total = data.usersTotal;
|
||||
$: count = data.users;
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Users"
|
||||
path={`/console/project-${$page.params.project}/auth/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Users',
|
||||
|
||||
@@ -8,7 +8,8 @@ export const load: PageLoad = async ({ params }) => {
|
||||
try {
|
||||
const response = await sdk.forProject.users.getUsage(period ?? '30d');
|
||||
return {
|
||||
usersTotal: response.usersTotal as unknown as Models.Metric[]
|
||||
usersTotal: response.usersTotal,
|
||||
users: response.users as unknown as Models.Metric[]
|
||||
};
|
||||
} catch (e) {
|
||||
throw error(e.code, e.message);
|
||||
|
||||
+3
-2
@@ -4,13 +4,14 @@
|
||||
import type { PageData } from './$types';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
$: count = data.documentsTotal;
|
||||
$: total = data.documentsTotal;
|
||||
$: count = data.documents;
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Databases"
|
||||
path={`/console/project-${$page.params.project}/databases/database-${$page.params.database}/collection-${$page.params.collection}/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Documents',
|
||||
|
||||
+2
-1
@@ -10,6 +10,7 @@ export const load: PageLoad = async ({ params }) => {
|
||||
);
|
||||
|
||||
return {
|
||||
documentsTotal: response.documentsTotal as unknown as Models.Metric[]
|
||||
documentsTotal: response.documentsTotal,
|
||||
documents: response.documents as unknown as Models.Metric[]
|
||||
};
|
||||
};
|
||||
|
||||
+3
-1
@@ -5,12 +5,14 @@
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
$: count = data.collectionsTotal;
|
||||
$: total = data.collectionsTotal;
|
||||
$: count = data.collections;
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Databases"
|
||||
path={`/console/project-${$page.params.project}/databases/database-${$page.params.database}/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Collections',
|
||||
|
||||
+2
-1
@@ -9,6 +9,7 @@ export const load: PageLoad = async ({ params }) => {
|
||||
);
|
||||
|
||||
return {
|
||||
collectionsTotal: response.collectionsTotal as unknown as Models.Metric[]
|
||||
collectionsTotal: response.collectionsTotal,
|
||||
collections: response.collections as unknown as Models.Metric[]
|
||||
};
|
||||
};
|
||||
|
||||
@@ -4,13 +4,14 @@
|
||||
import type { PageData } from './$types';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
$: count = data.databasesTotal;
|
||||
$: total = data.databasesTotal;
|
||||
$: count = data.databases;
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Databases"
|
||||
path={`/console/project-${$page.params.project}/databases/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Databases',
|
||||
|
||||
@@ -8,7 +8,8 @@ export const load: PageLoad = async ({ params }) => {
|
||||
try {
|
||||
const response = await sdk.forProject.databases.getUsage(period ?? '30d');
|
||||
return {
|
||||
databasesTotal: response.databasesTotal as unknown as Models.Metric[]
|
||||
databasesTotal: response.databasesTotal as unknown as Models.Metric[],
|
||||
databases: response.databases
|
||||
};
|
||||
} catch (e) {
|
||||
throw error(e.code, e.message);
|
||||
|
||||
+3
-3
@@ -1,13 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { Container } from '$lib/layout';
|
||||
import { Card, SecondaryTabsItem, SecondaryTabs, Heading } from '$lib/components';
|
||||
import { total } from '$lib/layout/usage.svelte';
|
||||
import { BarChart } from '$lib/charts';
|
||||
import { page } from '$app/stores';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
export let data: PageData;
|
||||
$: count = data.executionsTotal;
|
||||
$: total = data.executionsTotal;
|
||||
$: count = data.executions;
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
@@ -33,7 +33,7 @@
|
||||
</div>
|
||||
{#if count}
|
||||
<Card>
|
||||
<Heading tag="h6" size="6">{total(count)}</Heading>
|
||||
<Heading tag="h6" size="6">{total}</Heading>
|
||||
<p>Executions</p>
|
||||
<div class="u-margin-block-start-16" />
|
||||
<BarChart
|
||||
|
||||
+2
-1
@@ -11,7 +11,8 @@ export const load: PageLoad = async ({ params }) => {
|
||||
);
|
||||
|
||||
return {
|
||||
executionsTotal: response.executionsTotal as unknown as Models.Metric[]
|
||||
executionsTotal: response.executionsTotal,
|
||||
executions: response.executions as unknown as Models.Metric[]
|
||||
};
|
||||
} catch (e) {
|
||||
throw error(e.code, e.message);
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
<Onboard {projectId} />
|
||||
{:else}
|
||||
{#if $usage}
|
||||
{@const storage = humanFileSize(totalMetrics($usage.filesStorage) ?? 0)}
|
||||
{@const storage = humanFileSize($usage.filesStorageTotal ?? 0)}
|
||||
<section class="common-section">
|
||||
<div class="grid-dashboard-1s-2m-6l">
|
||||
<div class="card is-2-columns-medium-screen is-3-columns-large-screen">
|
||||
@@ -106,16 +106,14 @@
|
||||
|
||||
<div class="grid-item-1-end-start">
|
||||
<div class="heading-level-4">
|
||||
{formatNum(totalMetrics($usage.documentsTotal) ?? 0)}
|
||||
{formatNum($usage.documentsTotal ?? 0)}
|
||||
</div>
|
||||
<div>Documents</div>
|
||||
</div>
|
||||
|
||||
<div class="grid-item-1-end-end">
|
||||
<div class="text">
|
||||
Databases: {formatNum(
|
||||
totalMetrics($usage.databasesTotal) ?? 0
|
||||
)}
|
||||
Databases: {formatNum($usage.databasesTotal ?? 0)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -143,7 +141,7 @@
|
||||
|
||||
<div class="grid-item-1-end-end">
|
||||
<div class="text">
|
||||
Buckets: {formatNum(totalMetrics($usage.bucketsTotal) ?? 0)}
|
||||
Buckets: {formatNum($usage.bucketsTotal ?? 0)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -163,7 +161,7 @@
|
||||
|
||||
<div class="grid-item-1-end-start">
|
||||
<div class="heading-level-4">
|
||||
{formatNum(totalMetrics($usage.usersTotal) ?? 0)}
|
||||
{formatNum($usage.usersTotal ?? 0)}
|
||||
</div>
|
||||
<div>Users</div>
|
||||
</div>
|
||||
@@ -184,7 +182,7 @@
|
||||
|
||||
<div class="grid-item-1-end-start">
|
||||
<div class="heading-level-4">
|
||||
{formatNum(totalMetrics($usage.executionsTotal) ?? 0)}
|
||||
{formatNum($usage.executionsTotal ?? 0)}
|
||||
</div>
|
||||
<div>Executions</div>
|
||||
</div>
|
||||
|
||||
+3
-2
@@ -4,13 +4,14 @@
|
||||
import type { PageData } from './$types';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
$: count = data.filesTotal;
|
||||
$: total = data.filesTotal;
|
||||
$: count = data.files;
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Files"
|
||||
path={`/console/project-${$page.params.project}/storage/bucket-${$page.params.bucket}/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Files',
|
||||
|
||||
+2
-1
@@ -9,6 +9,7 @@ export const load: PageLoad = async ({ params }) => {
|
||||
);
|
||||
|
||||
return {
|
||||
filesTotal: response.filesTotal as unknown as Models.Metric[]
|
||||
filesTotal: response.filesTotal,
|
||||
files: response.files as unknown as Models.Metric[]
|
||||
};
|
||||
};
|
||||
|
||||
@@ -4,12 +4,14 @@
|
||||
import type { PageData } from './$types';
|
||||
|
||||
export let data: PageData;
|
||||
$: count = data.bucketsTotal;
|
||||
$: total = data.bucketsTotal;
|
||||
$: count = data.buckets;
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Buckets"
|
||||
path={`/console/project-${$page.params.project}/storage/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Buckets',
|
||||
|
||||
@@ -8,7 +8,8 @@ export const load: PageLoad = async ({ params }) => {
|
||||
const response = await sdk.forProject.storage.getUsage(params.period ?? '30d');
|
||||
|
||||
return {
|
||||
bucketsTotal: response.bucketsTotal as unknown as Models.Metric[]
|
||||
bucketsTotal: response.bucketsTotal,
|
||||
buckets: response.buckets as unknown as Models.Metric[]
|
||||
};
|
||||
} catch (e) {
|
||||
throw error(e.code, e.message);
|
||||
|
||||
Reference in New Issue
Block a user