mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
fix(databases): remove leftover per-database Usage tab
Same cleanup as #3128/#3130: removes the per-database Usage tab (database-[database]/usage) and its command-center shortcut. It called tablesDB.getUsage(), which is going away with the backend usage-endpoint removal.
This commit is contained in:
1 parent
1d1eabcec7
commit
ac4672ec6c
4 files changed
-76
No files matched your search
-12
@@ -147,18 +147,6 @@
|
||||
keys: ['g', 'c'],
|
||||
group: 'databases'
|
||||
},
|
||||
{
|
||||
label: 'Go to usage',
|
||||
callback() {
|
||||
goto(
|
||||
`${base}/project-${page.params.region}-${project}/databases/database-${databaseId}/usage`
|
||||
);
|
||||
},
|
||||
disabled:
|
||||
page.url.pathname.includes('/usage') || page.url.pathname.includes('table-'),
|
||||
keys: ['g', 'u'],
|
||||
group: 'databases'
|
||||
},
|
||||
{
|
||||
label: 'Go to backups',
|
||||
callback() {
|
||||
|
||||
-6
@@ -34,12 +34,6 @@
|
||||
event: 'backups',
|
||||
hasChildren: true
|
||||
},
|
||||
{
|
||||
href: withPath(baseDatabasePath, '/usage'),
|
||||
title: 'Usage',
|
||||
event: 'usage',
|
||||
hasChildren: true
|
||||
},
|
||||
{
|
||||
href: withPath(baseDatabasePath, '/settings'),
|
||||
event: 'settings',
|
||||
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/state';
|
||||
import { clampMin } from '$lib/helpers/numbers';
|
||||
import { formatNum } from '$lib/helpers/string';
|
||||
import { Container, UsageMultiple } from '$lib/layout';
|
||||
import type { PageProps } from './$types';
|
||||
|
||||
let { data }: PageProps = $props();
|
||||
|
||||
const reads = $derived(data.databaseReads ?? []);
|
||||
const readsTotal = $derived(clampMin(reads.reduce((sum, item) => sum + item.value, 0)));
|
||||
|
||||
const writes = $derived(data.databaseWrites ?? []);
|
||||
const writesTotal = $derived(clampMin(writes.reduce((sum, item) => sum + item.value, 0)));
|
||||
|
||||
const usagePath = $derived(
|
||||
`${base}/project-${page.params.region}-${page.params.project}/databases/database-${page.params.database}/usage`
|
||||
);
|
||||
</script>
|
||||
|
||||
<Container databasesMainScreen>
|
||||
<UsageMultiple
|
||||
title="Reads and writes"
|
||||
path={usagePath}
|
||||
total={[readsTotal, writesTotal]}
|
||||
count={[reads, writes]}
|
||||
isCumulative={false}
|
||||
options={{
|
||||
yAxis: {
|
||||
axisLabel: {
|
||||
formatter: formatNum
|
||||
}
|
||||
}
|
||||
}}
|
||||
legendNumberFormat="abbreviate"
|
||||
legendData={[
|
||||
{ name: 'Reads', value: readsTotal },
|
||||
{ name: 'Writes', value: writesTotal }
|
||||
]} />
|
||||
</Container>
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
import { isValueOfStringEnum } from '$lib/helpers/types';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { UsageRange } from '@appwrite.io/console';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ params }) => {
|
||||
const period = isValueOfStringEnum(UsageRange, params.period)
|
||||
? params.period
|
||||
: UsageRange.ThirtyDays;
|
||||
|
||||
return {
|
||||
...(await sdk.forProject(params.region, params.project).tablesDB.getUsage({
|
||||
databaseId: params.database,
|
||||
range: period
|
||||
}))
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user