-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
[perf logging] Add extra logging for new/editMode dash #9745
[perf logging] Add extra logging for new/editMode dash #9745
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9745 +/- ##
==========================================
+ Coverage 70.74% 70.75% +0.01%
==========================================
Files 585 586 +1
Lines 30429 30435 +6
Branches 3115 3117 +2
==========================================
+ Hits 21526 21534 +8
+ Misses 8789 8787 -2
Partials 114 114
Continue to review full report at Codecov.
|
0e0dec3
to
1b6fc79
Compare
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.
a few comments, otherwise the business logic makes sense here
@@ -0,0 +1,41 @@ | |||
/** |
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.
could you make this TypeScript since it's a new file?
@@ -0,0 +1,27 @@ | |||
/** |
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.
Could you make this TypeScript since it's a new file?
if (isDashboardEmpty(this.props.layout)) { | ||
eventData.is_empty = true; | ||
} |
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.
why not do eventData.is_empty: isDashboardEmpty(this.props.layout)
? Then we could also do this up on line 98 instead too
const eventData = {}; | ||
const { dashboardState } = this.props; | ||
const eventData = { | ||
is_editMode: dashboardState.editMode, |
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.
let's either do snake_case or camelCase, not a mix of both
it('should return true for empty dashboard', () => { | ||
expect(isDashboardEmpty(emptyLayout)).toBe(true); | ||
}); | ||
it('should return false for empty dashboard', () => { |
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.
nit: should return false for a non-empty dashboard
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.
thanks! fixed.
29a53a4
to
8bbff7c
Compare
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.
lgtm, thanks for the TypeScript!
export default function isDashboardEmpty(layout: any): boolean { | ||
// has at least one chart or markdown component | ||
return !Object.values(layout).some( | ||
(item: any) => item.type && USER_CONTENT_COMPONENT_TYPE.includes(item.type), |
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.
not necessary this time, but you could type item
as { type?: string }
instead of any
if you wanted to get a bit more specific
8bbff7c
to
d5b6774
Compare
CATEGORY
Choose one
SUMMARY
This PR is to add extra logging data for new and/or edit mode dashboard.
TEST PLAN
Manual test
REVIEWERS
@etr2460