fix: remove remaining per-resource Usage tabs and shortcuts

Removes the Usage tab/route and its g-u command-center shortcut for
buckets, functions, sites, and auth — the same cleanup already done
for databases (#3128/#3130/#3131). Project-level billing usage
(settings/usage) is untouched.
This commit is contained in:
harsh mahajan committed 2026-07-21 17:47:59 +05:30
1 parent 1d1eabcec7
commit de3deb88c0
15 files changed
-193

No files matched your search

@@ -56,16 +56,6 @@ export const functionsSearcher = (async (query: string) => {
},
group: 'functions'
},
{
label: 'Go to usage',
nested: true,
callback() {
goto(
`${base}/project-${page.params.region}-${projectId}/functions/function-${func.$id}/usage`
);
},
group: 'functions'
},
{
label: 'Go to executions',
nested: true,
@@ -58,16 +58,6 @@
rank: 1,
disabled: page.url.pathname.endsWith('teams')
},
{
label: 'Go to usage',
keys: ['g', 'u'],
callback: async () => {
await goto(withPath(authProjectRoute, '/usage'));
},
group: 'navigation',
rank: 1,
disabled: page.url.pathname.endsWith('usage')
},
{
label: 'Go to security',
keys: ['g', 'e'],
@@ -34,12 +34,6 @@
event: 'templates',
disabled: !$canWriteProjects
},
{
href: `${path}/usage`,
title: 'Usage',
hasChildren: true,
event: 'usage'
},
{
href: `${path}/settings`,
title: 'Settings',
@@ -1,20 +0,0 @@
<script lang="ts">
import { base } from '$app/paths';
import { page } from '$app/state';
import { Container, Usage } from '$lib/layout';
export let data;
$: total = data.usersTotal;
$: count = data.users;
</script>
<Container>
<Usage
path={`${base}/project-${page.params.region}-${page.params.project}/auth/usage`}
countMetadata={{
legend: 'Users',
title: 'Registered users'
}}
{total}
{count} />
</Container>
@@ -1,14 +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).users.getUsage({ range: period }))
};
};
@@ -131,18 +131,6 @@
rank: 10,
disabled: page.url.pathname.endsWith($func.$id)
},
{
label: 'Go to usage',
callback() {
goto(
`${base}/project-${page.params.region}-${page.params.project}/functions/function-${$func.$id}/usage`
);
},
keys: ['g', 'u'],
group: 'navigation',
rank: 10,
disabled: page.url.pathname.endsWith('usage')
},
{
label: 'Go to executions',
callback() {
@@ -28,12 +28,6 @@
title: 'Domains',
event: 'domains'
},
{
href: `${path}/usage`,
title: 'Usage',
event: 'usage',
hasChildren: true
},
{
href: `${path}/settings`,
event: 'settings',
@@ -1,56 +0,0 @@
<script lang="ts">
import { base } from '$app/paths';
import { page } from '$app/state';
import { clampMin } from '$lib/helpers/numbers';
import { Container, Usage } from '$lib/layout';
import { Layout } from '@appwrite.io/pink-svelte';
import type { PageProps } from './$types';
let { data }: PageProps = $props();
const count = $derived(data.executions ?? []);
const total = $derived(clampMin(count.reduce((sum, metric) => sum + metric.value, 0)));
// Function compute time is returned as MB-seconds and displayed as GB-hours.
const executionsTime = $derived(data.executionsTime ?? []);
const gbHoursCount = $derived(
executionsTime
.map((metric) => ({
...metric,
value: metric.value / 1000 / 3600
}))
.filter(({ value }) => value)
);
const gbHoursTotal = $derived(
clampMin(gbHoursCount.reduce((sum, metric) => sum + metric.value, 0))
);
</script>
<Container>
<Layout.Stack gap="l">
{#if count.length}
<Usage
path={`${base}/project-${page.params.region}-${page.params.project}/functions/function-${page.params.function}/usage`}
countMetadata={{
legend: 'Executions',
title: 'Total executions'
}}
isCumulative
{total}
{count} />
{/if}
{#if executionsTime.length}
<Usage
hidePeriodSelect
path={`${base}/project-${page.params.region}-${page.params.project}/functions/function-${page.params.function}/usage`}
countMetadata={{
legend: 'GB hours',
title: 'Total GB hours'
}}
isCumulative
total={gbHoursTotal}
count={gbHoursCount} />
{/if}
</Layout.Stack>
</Container>
@@ -1,17 +0,0 @@
import { sdk } from '$lib/stores/sdk';
import { UsageRange } from '@appwrite.io/console';
import type { PageLoad } from './$types';
import { isValueOfStringEnum } from '$lib/helpers/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).functions.getUsage({
functionId: params.function,
range: period
}))
};
};
@@ -90,18 +90,6 @@
rank: 10,
disabled: page.url.pathname.endsWith('deployments')
},
{
label: 'Go to usage',
callback() {
goto(
`${base}/project-${$project.region}-${$project.$id}/sites/site-${page.params.site}/usage`
);
},
keys: ['g', 'u'],
group: 'navigation',
rank: 10,
disabled: page.url.pathname.endsWith('usage')
},
{
label: 'Go to logs',
callback() {
@@ -1,7 +0,0 @@
<script lang="ts">
import { Container } from '$lib/layout';
export let data;
</script>
<Container></Container>
@@ -1,3 +0,0 @@
import type { PageLoad } from './$types';
export const load: PageLoad = async () => ({});
@@ -74,18 +74,6 @@
group: 'navigation',
rank: 10
},
{
label: 'Go to usage',
callback() {
goto(
`${base}/project-${$project.region}-${$project.$id}/storage/bucket-${$bucket.$id}/usage`
);
},
disabled: page.url.pathname.endsWith('usage'),
keys: ['g', 'u'],
group: 'navigation',
rank: 10
},
{
label: 'Go to settings',
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 () => ({});