Skip to content

fix(console): correct usage chart labels from functions/sites to deployments#2986

Open
singhvishalkr wants to merge 3 commits into
appwrite:mainfrom
singhvishalkr:fix/usage-label-deployments
Open

fix(console): correct usage chart labels from functions/sites to deployments#2986
singhvishalkr wants to merge 3 commits into
appwrite:mainfrom
singhvishalkr:fix/usage-label-deployments

Conversation

@singhvishalkr
Copy link
Copy Markdown

Summary

Fixes #2224

The usage chart on both the Functions and Sites aggregate usage pages displays incorrect labels. The data source is deploymentsTotal / deployments, but the chart metadata says "Total functions" / "Total sites" respectively.

Changes

  • Functions usage page: Changed legend from "Functions" to "Deployments" and title from "Total functions" to "Total deployments"
  • Sites usage page: Changed legend from "Sites" to "Deployments" and title from "Total sites" to "Total deployments"

Both pages load deployment metrics from the API (data.deploymentsTotal, data.deployments), so the labels should reflect that.

Files changed

  • src/routes/(console)/project-[region]-[project]/functions/usage/[[period]]/+page.svelte
  • src/routes/(console)/project-[region]-[project]/sites/usage/[[period]]/+page.svelte

Test plan

  • Navigate to Functions > Usage tab and verify chart says "Total deployments"
  • Navigate to Sites > Usage tab and verify chart says "Total deployments"
  • Verify the actual count matches the number of deployments, not the number of functions/sites

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 20, 2026

Greptile Summary

This PR wires up the Usage component on the aggregate Functions and Sites usage pages and corrects the chart labels from "Functions"/"Sites" to "Deployments", aligning them with the actual data source (deploymentsTotal / deployments). However, both +page.ts loaders still return {} with no API call, so data.deploymentsTotal and data.deployments are always undefined and the chart never renders.

  • Functions usage page (functions/usage/[[period]]/+page.svelte): Usage component added with corrected "Total deployments" label, but +page.ts must be updated to fetch deployment data from the API.
  • Sites usage page (sites/usage/[[period]]/+page.svelte): Same template change and same missing data-fetching problem — the page will render an empty card until +page.ts is updated.

Confidence Score: 3/5

The label fix is correct, but the charts will remain blank because the data loaders do not fetch any deployment metrics from the API.

The +page.ts files for both routes return an empty object and make no API call, so data.deploymentsTotal and data.deployments are always undefined. The Usage component guards its chart behind {#if count}, meaning users will see an empty card on both pages after this change. The fix is incomplete without corresponding updates to the loaders.

Both +page.ts loaders (functions/usage/[[period]]/+page.ts and sites/usage/[[period]]/+page.ts) need to be updated to call the appropriate API endpoints and return deploymentsTotal and deployments.

Important Files Changed

Filename Overview
src/routes/(console)/project-[region]-[project]/functions/usage/[[period]]/+page.svelte Adds Usage component with corrected "Deployments" labels, but data.deploymentsTotal and data.deployments are always undefined because the +page.ts loader returns an empty object without fetching any API data
src/routes/(console)/project-[region]-[project]/sites/usage/[[period]]/+page.svelte Same as functions usage page — correct label fix, but chart will never render because the +page.ts loader returns {} and no deployment data is ever fetched

Reviews (2): Last reviewed commit: "Merge appwrite/console main into fix/usa..." | Re-trigger Greptile

Retain usage Deployments wording; upstream stubs replaced with ours during conflict.
@singhvishalkr
Copy link
Copy Markdown
Author

Merged current \�ppwrite/console\ \main\ (**\c83bd25**). Upstream temporarily stubbed both usage routes; conflicts resolved by keeping this PR's \Usage\ wiring + Deployments \legend/\ itle\ metadata.

Comment on lines +7 to +8
$: total = data.deploymentsTotal;
$: count = data.deployments;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Data loader returns empty object — chart never renders

Both data.deploymentsTotal and data.deployments will always be undefined because functions/usage/[[period]]/+page.ts returns {} with no API call. The Usage component renders its chart only when count is truthy ({#if count}), so the chart will be blank for every visitor. The same issue applies to the sites usage page (sites/usage/[[period]]/+page.ts).

Compare with the working per-function usage loader at functions/function-[function]/usage/[[period]]/+page.ts, which calls sdk.forProject(...).functions.getUsage(...) and spreads the result into the returned data object. The aggregate usage pages need a similar API call wired up in their +page.ts before this template change has any visible effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Bug Report: Functions usage typo

1 participant