mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
Merge remote-tracking branch 'origin/fix-remove-remaining-resource-usage-tabs' into fix-remove-remaining-usage-tabs-consolidated
This commit is contained in:
commit
987cc06e73
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 }))
|
||||
};
|
||||
};
|
||||
-12
@@ -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() {
|
||||
|
||||
-6
@@ -28,12 +28,6 @@
|
||||
title: 'Domains',
|
||||
event: 'domains'
|
||||
},
|
||||
{
|
||||
href: `${path}/usage`,
|
||||
title: 'Usage',
|
||||
event: 'usage',
|
||||
hasChildren: true
|
||||
},
|
||||
{
|
||||
href: `${path}/settings`,
|
||||
event: 'settings',
|
||||
|
||||
-56
@@ -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>
|
||||
-17
@@ -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
|
||||
}))
|
||||
};
|
||||
};
|
||||
-12
@@ -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() {
|
||||
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { Container } from '$lib/layout';
|
||||
|
||||
export let data;
|
||||
</script>
|
||||
|
||||
<Container></Container>
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async () => ({});
|
||||
-12
@@ -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() {
|
||||
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { Container } from '$lib/layout';
|
||||
</script>
|
||||
|
||||
<Container></Container>
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async () => ({});
|
||||
Reference in new issue
Block a user