-
Notifications
You must be signed in to change notification settings - Fork 202
feat: add screenshotsGenerated metrics across console #2543
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
base: main
Are you sure you want to change the base?
Conversation
Console (appwrite/console)Project ID: Tip Every Git commit and branch gets its own deployment URL automatically |
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the WalkthroughThis pull request adds a new resource metric, screenshotsGenerated, across billing and usage surfaces. SDK types (OrganizationUsage, Plan, UsageProject) now include screenshotsGenerated arrays and totals; PlanServices union gains 'screenshotsGenerated'. UI pages (organization and project usage, plan summary, project breakdown) render the new metric and reuse existing formatting/progress logic. package.json adds a new dependency "install": "^0.13.0". No control-flow or error-handling behavior was changed. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (9)
package.json(1 hunks)src/lib/sdk/billing.ts(4 hunks)src/lib/sdk/usage.ts(1 hunks)src/lib/stores/billing.ts(1 hunks)src/routes/(console)/organization-[organization]/billing/planSummary.svelte(2 hunks)src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte(1 hunks)src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.ts(1 hunks)src/routes/(console)/organization-[organization]/usage/[[invoice]]/ProjectBreakdown.svelte(2 hunks)src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.svelte(2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-26T06:48:57.938Z
Learnt from: ItzNotABug
Repo: appwrite/console PR: 2373
File: src/routes/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/empty.svelte:629-631
Timestamp: 2025-09-26T06:48:57.938Z
Learning: In the Appwrite console codebase using appwrite.io/pink-svelte, the Icon component automatically handles CSS variable names passed to its color prop by internally wrapping them with var(). Therefore, passing '--some-css-variable' as a string to the Icon color prop works correctly without needing to manually wrap it with var().
Applied to files:
package.json
🧬 Code graph analysis (1)
src/lib/sdk/billing.ts (1)
src/lib/sdk/usage.ts (1)
Metric(21-30)
🪛 ESLint
src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.svelte
[error] 33-33: Unexpected any. Specify a different type.
(@typescript-eslint/no-explicit-any)
[error] 34-34: Unexpected any. Specify a different type.
(@typescript-eslint/no-explicit-any)
🔇 Additional comments (10)
src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.ts (1)
37-39: LGTM! Consistent with existing temporary fix pattern.The new fields are correctly initialized to null in the early-return path, matching the pattern used for other metrics like
imageTransformationsTotal.src/lib/stores/billing.ts (1)
153-154: LGTM! Service type extension is correct.The addition of
'screenshotsGenerated'to thePlanServicesunion follows the existing pattern and enables the new metric to be used withgetServiceLimit().src/lib/sdk/usage.ts (1)
336-344: LGTM! Type definitions follow established pattern.The new
screenshotsGeneratedandscreenshotsGeneratedTotalfields mirror the structure ofimageTransformations, maintaining consistency in the data model.package.json (1)
25-25: Dependency update noted.Package version updated to support the new screenshotsGenerated metric feature.
src/routes/(console)/organization-[organization]/usage/[[invoice]]/ProjectBreakdown.svelte (1)
19-20: LGTM! Metric handling is consistent.The addition of
'screenshotsGenerated'to the Metric type and its formatting logic correctly mirrors theimageTransformationsimplementation, usingformatNumberWithCommasfor display.Also applies to: 93-93
src/lib/sdk/billing.ts (1)
295-295: LGTM! Comprehensive metric integration.The new
screenshotsGeneratedmetric is properly integrated across all billing data structures:
- Organization-level metrics and totals
- Per-project tracking
- Plan limits and usage pricing
All additions follow the established pattern from
imageTransformations.Also applies to: 302-302, 321-321, 390-390, 418-418
src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.svelte (1)
246-283: LGTM! UI implementation follows established patterns.The new "Screenshots generated" CardGrid section correctly mirrors the structure of other usage metrics, including the chart visualization and "No data to show" fallback state.
src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte (1)
325-370: LGTM! Organization usage section is well-implemented.The new "Screenshots generated" section correctly integrates with the billing system, including:
- Progress bar with current usage and plan limits
- Bar chart visualization
- Project breakdown for detailed analysis
- Proper conditional rendering for empty states
The implementation is consistent with other usage metrics in the file.
src/routes/(console)/organization-[organization]/billing/planSummary.svelte (2)
130-132: LGTM! Resource mapping follows established pattern.The addition of
screenshotsGeneratedto the resource mapping is consistent with how other metrics (executions, imageTransformations, etc.) are handled.
286-298: LGTM! Billing row implementation is consistent and complete.The screenshots generated metric row correctly implements:
- Formatted usage display with current/limit values
- Currency formatting for pricing
- Progress bar visualization
- Proper handling of unlimited plans
The implementation mirrors the pattern used for other metrics like image transformations, ensuring UI consistency.
src/routes/(console)/project-[region]-[project]/settings/usage/[[invoice]]/+page.svelte
Outdated
Show resolved
Hide resolved
…billing-metrics-console
| 'screenshots-generated', | ||
| 'Screenshots generated', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all the ids and text that are passed to createResourceRow are always same and only separated by -. We should just infer the text from the id in that case like -
createResourceRow(
'screenshots-generated', // simply replace `-` with a ` ` and making the first char uppercased
getResource(resources, 'screenshotsGenerated'),
currentPlan?.screenshotsGenerated
),| "deep-equal": "^2.2.3", | ||
| "echarts": "^5.6.0", | ||
| "ignore": "^6.0.2", | ||
| "install": "^0.13.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whats this for?
lohanidamodar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should instead start using the generated SDK, it should already have these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, generated SDK should have these.

What does this PR do?
(Provide a description of what this PR does.)
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)
Related PRs and Issues
(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)
Have you read the Contributing Guidelines on issues?
(Write your answer here.)
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.