-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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
Added graph to stats page for os #22291
Conversation
ref https://linear.app/ghost/issue/ANAL-128/ - added a chart for OS to the technical section on the stats page
WalkthroughThe pull request introduces an Possibly related PRs
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 ESLint
ghost/admin/app/controllers/stats.jsOops! Something went wrong! :( ESLint: 8.44.0 Error: Failed to load parser '@babel/eslint-parser' declared in 'ghost/admin/.eslintrc.js': Cannot find module '@babel/eslint-parser'
ghost/admin/app/components/stats/charts/technical.jsOops! Something went wrong! :( ESLint: 8.44.0 Error: Failed to load parser '@babel/eslint-parser' declared in 'ghost/admin/.eslintrc.js': Cannot find module '@babel/eslint-parser'
ghost/admin/app/utils/stats.jsOops! Something went wrong! :( ESLint: 8.44.0 Error: Failed to load parser '@babel/eslint-parser' declared in 'ghost/admin/.eslintrc.js': Cannot find module '@babel/eslint-parser'
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (4)
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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 selected for processing (3)
ghost/admin/app/components/stats/charts/technical.js
(2 hunks)ghost/admin/app/components/stats/technical-overview.hbs
(1 hunks)ghost/admin/app/components/stats/technical-overview.js
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- ghost/admin/app/components/stats/technical-overview.js
🔇 Additional comments (3)
ghost/admin/app/components/stats/technical-overview.hbs (1)
14-19
: Well implemented conditional OS tab renderingThe conditional rendering of the OS tab button based on API version is cleanly implemented. This ensures the button only appears when the API supports OS data (apiVersion > 0), providing a smooth experience for users regardless of their API version.
ghost/admin/app/components/stats/charts/technical.js (2)
30-38
: Good fallback implementation for unsupported API versionsThe fallback logic for handling OS selection when the API version doesn't support it is well-designed. By creating an
effectiveSelected
variable, the code gracefully falls back to 'devices' when OS is selected but not supported by the current API version.
53-68
: Well-structured endpoint configuration based on API versionThe switch statement has been effectively updated to use
effectiveSelected
and dynamically construct endpoints based on theapiVersion
. This is a clean approach that maintains backward compatibility while supporting the new OS statistics feature.
console.log(`selected`, selected) | ||
console.log(`apiVersion`, apiVersion) | ||
let effectiveSelected = selected; |
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.
🛠️ Refactor suggestion
Remove debug console.log statements
There are several console.log statements that should be removed before merging to production.
- console.log(`selected`, selected)
- console.log(`apiVersion`, apiVersion)
let effectiveSelected = selected;
if (selected === 'os' && (!apiVersion || apiVersion < 1)) {
effectiveSelected = 'devices';
}
- console.log(`effectiveSelected`, effectiveSelected)
Also applies to: 39-39
ref https://linear.app/ghost/issue/ANAL-128/