fix(console): correct usage chart labels from functions/sites to deployments#2986
fix(console): correct usage chart labels from functions/sites to deployments#2986singhvishalkr wants to merge 3 commits into
Conversation
Greptile SummaryThis PR wires up the
Confidence Score: 3/5The 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
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.
|
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. |
| $: total = data.deploymentsTotal; | ||
| $: count = data.deployments; |
There was a problem hiding this comment.
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.
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
legendfrom "Functions" to "Deployments" andtitlefrom "Total functions" to "Total deployments"legendfrom "Sites" to "Deployments" andtitlefrom "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.sveltesrc/routes/(console)/project-[region]-[project]/sites/usage/[[period]]/+page.svelteTest plan