Merge pull request #3128 from appwrite/fix-remove-databases-usage-tab

fix(databases): remove leftover top-level Usage tab
This commit is contained in:
Harsh Mahajan authored and GitHub committed 2026-07-20 15:20:09 +05:30
commit 368fa34995
11 files changed
-141

No files matched your search

@@ -1,28 +1,12 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { page } from '$app/state';
import { DatabasesPanel } from '$lib/commandCenter/panels';
import { resolveRoute, withPath } from '$lib/stores/navigation';
import { addSubPanel, registerCommands, updateCommandGroupRanks } from '$lib/commandCenter';
let { children } = $props();
const databasesProjectRoute = $derived.by(() => {
return resolveRoute('/(console)/project-[region]-[project]/databases', page.params);
});
$effect(() => {
$registerCommands([
{
label: 'Go to usage',
callback: () => {
goto(withPath(databasesProjectRoute, 'usage'));
},
keys: ['g', 'u'],
disabled:
page.url.pathname.includes('usage') || page.url.pathname.includes('database-'),
group: 'databases'
},
{
label: 'Find databases',
callback: () => {
@@ -14,12 +14,6 @@
title: 'Databases',
event: 'databases',
hasChildren: true
},
{
href: `${path}/usage`,
title: 'Usage',
event: 'usage',
hasChildren: true
}
];
</script>
@@ -1,69 +0,0 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { base } from '$app/paths';
import { page } from '$app/state';
import { Container, UsageMultiple } from '$lib/layout';
import { InputSelect } from '$lib/elements/forms';
import { clampMin } from '$lib/helpers/numbers';
import { formatNum } from '$lib/helpers/string';
import { Layout } from '@appwrite.io/pink-svelte';
import type { PageProps } from './$types';
let { data }: PageProps = $props();
const reads = $derived(data.databasesReads ?? []);
const readsTotal = $derived(clampMin(reads.reduce((sum, item) => sum + item.value, 0)));
const writes = $derived(data.databasesWrites ?? []);
const writesTotal = $derived(clampMin(writes.reduce((sum, item) => sum + item.value, 0)));
const usagePath = $derived(
`${base}/project-${page.params.region}-${page.params.project}/databases/usage`
);
</script>
<Container>
<Layout.Stack gap="l">
<div
style:max-width="250px"
style:--input-background-color="var(--bgcolor-neutral-primary)">
<InputSelect
on:change={(e) => goto(`${usagePath}/${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>
<UsageMultiple
title="Reads and writes"
showHeader={false}
total={[readsTotal, writesTotal]}
count={[reads, writes]}
isCumulative={false}
options={{
yAxis: {
axisLabel: {
formatter: formatNum
}
}
}}
legendNumberFormat="abbreviate"
legendData={[
{ name: 'Reads', value: readsTotal },
{ name: 'Writes', value: writesTotal }
]} />
</Layout.Stack>
</Container>
@@ -1,16 +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.listUsage({ range: period }))
};
};
@@ -1,5 +0,0 @@
<script lang="ts">
import { Container } from '$lib/layout';
</script>
<Container></Container>
@@ -1,3 +0,0 @@
import type { PageLoad } from './$types';
export const load: PageLoad = async () => ({});
@@ -1,5 +0,0 @@
<script lang="ts">
import { Container } from '$lib/layout';
</script>
<Container></Container>
@@ -1,3 +0,0 @@
import type { PageLoad } from './$types';
export const load: PageLoad = async () => ({});
@@ -23,16 +23,6 @@
group: 'buckets',
disabled: !$canWriteBuckets
},
{
label: 'Go to usage',
callback() {
goto(`${base}/project-${$project.region}-${$project.$id}/storage/usage`);
},
keys: ['g', 'u'],
disabled: page.url.pathname.endsWith('usage') || page.url.pathname.includes('bucket-'),
group: 'navigation',
rank: 10
},
{
label: 'Find buckets',
callback: () => {
@@ -1,5 +0,0 @@
<script lang="ts">
import { Container } from '$lib/layout';
</script>
<Container></Container>
@@ -1,3 +0,0 @@
import type { PageLoad } from './$types';
export const load: PageLoad = async () => ({});