-
Notifications
You must be signed in to change notification settings - Fork 235
fix: remove all-time usage stats from functions, sites, and storage #3013
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ba97a75
fix: remove misleading all-time usage stats from functions, sites, an…
HarshMN2345 1d33ca2
fix lint issue
HarshMN2345 4d2562a
fix: clear loaders and unused data props on emptied usage pages
HarshMN2345 1f2aab9
fix: remove databases reads/writes usage tab and clear loaders
HarshMN2345 ee6d36f
Revert "fix: remove databases reads/writes usage tab and clear loaders"
HarshMN2345 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,7 @@ | |
| { | ||
| href: `${path}/usage`, | ||
| title: 'Usage', | ||
| event: 'sage', | ||
| event: 'usage', | ||
| hasChildren: true | ||
| }, | ||
| { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 2 additions & 17 deletions
19
src/routes/(console)/project-[region]-[project]/functions/usage/[[period]]/+page.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,5 @@ | ||
| <script lang="ts"> | ||
| import { base } from '$app/paths'; | ||
| import { page } from '$app/state'; | ||
| import { Container, Usage } from '$lib/layout'; | ||
|
|
||
| export let data; | ||
| $: total = data.deploymentsTotal; | ||
| $: count = data.deployments; | ||
| import { Container } from '$lib/layout'; | ||
| </script> | ||
|
|
||
| <Container> | ||
| <Usage | ||
| path={`${base}/project-${page.params.region}-${page.params.project}/functions/usage`} | ||
| countMetadata={{ | ||
| legend: 'Functions', | ||
| title: 'Total functions' | ||
| }} | ||
| {total} | ||
| {count} /> | ||
| </Container> | ||
| <Container></Container> | ||
15 changes: 1 addition & 14 deletions
15
src/routes/(console)/project-[region]-[project]/functions/usage/[[period]]/+page.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,3 @@ | ||
| 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) | ||
| .functions.listUsage({ range: period })) | ||
| }; | ||
| }; | ||
| export const load: PageLoad = async () => ({}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 2 additions & 28 deletions
30
...utes/(console)/project-[region]-[project]/sites/site-[site]/usage/[[period]]/+page.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,7 @@ | ||
| <script lang="ts"> | ||
| import { base } from '$app/paths'; | ||
| import { page } from '$app/state'; | ||
| import { Container, Usage } from '$lib/layout'; | ||
| import { Container } from '$lib/layout'; | ||
|
|
||
| export let data; | ||
| $: total = data.deploymentsTotal; | ||
| $: count = data.deployments; | ||
|
|
||
| // $: totalBuilds = data.buildsTotal; | ||
| // $: countBuilds = data.builds; | ||
| </script> | ||
|
|
||
| <Container> | ||
| <Usage | ||
| path={`${base}/project-${page.params.region}-${page.params.project}/sites/site-${page.params.site}/usage`} | ||
| countMetadata={{ | ||
| legend: 'Deployments', | ||
| title: 'Total deployments' | ||
| }} | ||
| {total} | ||
| {count} /> | ||
|
|
||
| <!-- <Usage | ||
| title="Builds" | ||
| path={`${base}/project-${page.params.region}-${page.params.project}/sites/site-${page.params.site}/usage`} | ||
| countMetadata={{ | ||
| legend: 'Builds', | ||
| title: 'Total builds' | ||
| }} | ||
| total={totalBuilds} | ||
| count={countBuilds} /> --> | ||
| </Container> | ||
| <Container></Container> |
16 changes: 1 addition & 15 deletions
16
src/routes/(console)/project-[region]-[project]/sites/site-[site]/usage/[[period]]/+page.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,3 @@ | ||
| 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).sites.getUsage({ | ||
| siteId: params.site, | ||
| range: period | ||
| })) | ||
| }; | ||
| }; | ||
| export const load: PageLoad = async () => ({}); |
19 changes: 2 additions & 17 deletions
19
src/routes/(console)/project-[region]-[project]/sites/usage/[[period]]/+page.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,5 @@ | ||
| <script lang="ts"> | ||
| import { base } from '$app/paths'; | ||
| import { page } from '$app/state'; | ||
| import { Container, Usage } from '$lib/layout'; | ||
|
|
||
| export let data; | ||
| $: total = data.deploymentsTotal; | ||
| $: count = data.deployments; | ||
| import { Container } from '$lib/layout'; | ||
| </script> | ||
|
|
||
| <Container> | ||
| <Usage | ||
| path={`${base}/project-${page.params.region}-${page.params.project}/sites/usage`} | ||
| countMetadata={{ | ||
| legend: 'Sites', | ||
| title: 'Total sites' | ||
| }} | ||
| {total} | ||
| {count} /> | ||
| </Container> | ||
| <Container></Container> |
13 changes: 1 addition & 12 deletions
13
src/routes/(console)/project-[region]-[project]/sites/usage/[[period]]/+page.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,3 @@ | ||
| 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).sites.listUsage({ range: period })) | ||
| }; | ||
| }; | ||
| export const load: PageLoad = async () => ({}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 2 additions & 30 deletions
32
...console)/project-[region]-[project]/storage/bucket-[bucket]/usage/[[period]]/+page.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,5 @@ | ||
| <script lang="ts"> | ||
| import { base } from '$app/paths'; | ||
| import { page } from '$app/state'; | ||
| import { Container, Usage } from '$lib/layout'; | ||
|
|
||
| export let data; | ||
| $: filesTotal = data.filesTotal; | ||
| $: files = data.files; | ||
| $: transformationsTotal = data.imageTransformationsTotal; | ||
| $: transformations = data.imageTransformations; | ||
| import { Container } from '$lib/layout'; | ||
| </script> | ||
|
|
||
| <Container> | ||
| <Usage | ||
| path={`${base}/project-${page.params.region}-${page.params.project}/storage/bucket-${page.params.bucket}/usage`} | ||
| total={filesTotal} | ||
| count={files} | ||
| countMetadata={{ | ||
| legend: 'Files', | ||
| title: 'Total files' | ||
| }} /> | ||
|
|
||
| <Usage | ||
| path={`${base}/project-${page.params.region}-${page.params.project}/storage/bucket-${page.params.bucket}/usage`} | ||
| total={transformationsTotal} | ||
| count={transformations} | ||
| countMetadata={{ | ||
| legend: 'Image transformations', | ||
| title: 'Total transformations' | ||
| }} | ||
| isCumulative | ||
| hidePeriodSelect /> | ||
| </Container> | ||
| <Container></Container> |
21 changes: 1 addition & 20 deletions
21
...es/(console)/project-[region]-[project]/storage/bucket-[bucket]/usage/[[period]]/+page.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,3 @@ | ||
| import { sdk } from '$lib/stores/sdk'; | ||
| import type { PageLoad } from './$types'; | ||
| import { isValueOfStringEnum } from '$lib/helpers/types'; | ||
| import { UsageRange, type Models } from '@appwrite.io/console'; | ||
|
|
||
| export const load: PageLoad = async ({ params }) => { | ||
| const period = isValueOfStringEnum(UsageRange, params.period) | ||
| ? params.period | ||
| : UsageRange.ThirtyDays; | ||
|
|
||
| const response = await sdk.forProject(params.region, params.project).storage.getBucketUsage({ | ||
| bucketId: params.bucket, | ||
| range: period | ||
| }); | ||
|
|
||
| return { | ||
| filesTotal: response.filesTotal, | ||
| files: response.files as Models.Metric[], | ||
| imageTransformationsTotal: response.imageTransformationsTotal, | ||
| imageTransformations: response.imageTransformations as Models.Metric[] | ||
| }; | ||
| }; | ||
| export const load: PageLoad = async () => ({}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 2 additions & 17 deletions
19
src/routes/(console)/project-[region]-[project]/storage/usage/[[period]]/+page.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,5 @@ | ||
| <script lang="ts"> | ||
| import { base } from '$app/paths'; | ||
| import { page } from '$app/state'; | ||
| import { Container, Usage } from '$lib/layout'; | ||
|
|
||
| export let data; | ||
| $: total = data.bucketsTotal; | ||
| $: count = data.buckets; | ||
| import { Container } from '$lib/layout'; | ||
| </script> | ||
|
|
||
| <Container> | ||
| <Usage | ||
| path={`${base}/project-${page.params.region}-${page.params.project}/storage/usage`} | ||
| {total} | ||
| {count} | ||
| countMetadata={{ | ||
| legend: 'Buckets', | ||
| title: 'Total buckets' | ||
| }} /> | ||
| </Container> | ||
| <Container></Container> |
13 changes: 1 addition & 12 deletions
13
src/routes/(console)/project-[region]-[project]/storage/usage/[[period]]/+page.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,3 @@ | ||
| 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).storage.getUsage({ range: period })) | ||
| }; | ||
| }; | ||
| export const load: PageLoad = async () => ({}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.