Skip to content
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

Merged

Conversation

graceguo-supercat
Copy link

@graceguo-supercat graceguo-supercat commented May 6, 2020

CATEGORY

Choose one

  • Bug Fix
  • Enhancement (new features, refinement)
  • Refactor
  • Add tests
  • Build / Development Environment
  • Documentation

SUMMARY

This PR is to add extra logging data for new and/or edit mode dashboard.

TEST PLAN

Manual test

REVIEWERS

@etr2460

@codecov-io
Copy link

codecov-io commented May 6, 2020

Codecov Report

Merging #9745 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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              
Flag Coverage Δ
#cypress 53.60% <100.00%> (+0.02%) ⬆️
#javascript 58.91% <100.00%> (+0.03%) ⬆️
#python 70.92% <ø> (ø)
Impacted Files Coverage Δ
...et-frontend/src/dashboard/components/Dashboard.jsx 83.11% <100.00%> (+0.22%) ⬆️
...et-frontend/src/dashboard/util/isDashboardEmpty.ts 100.00% <100.00%> (ø)
superset/charts/schemas.py 100.00% <0.00%> (ø)
superset-frontend/src/SqlLab/actions/sqlLab.js 66.81% <0.00%> (ø)
...rset-frontend/src/dashboard/util/getEmptyLayout.js 100.00% <0.00%> (+100.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 821e7e5...8bbff7c. Read the comment docs.

Copy link
Member

@etr2460 etr2460 left a 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 @@
/**
Copy link
Member

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 @@
/**
Copy link
Member

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?

Comment on lines 104 to 105
if (isDashboardEmpty(this.props.layout)) {
eventData.is_empty = true;
}
Copy link
Member

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,
Copy link
Member

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', () => {
Copy link
Member

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

Copy link
Author

Choose a reason for hiding this comment

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

thanks! fixed.

@graceguo-supercat graceguo-supercat force-pushed the gg-ImproveLogging branch 2 times, most recently from 29a53a4 to 8bbff7c Compare May 6, 2020 03:41
Copy link
Member

@etr2460 etr2460 left a 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),
Copy link
Member

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

@graceguo-supercat graceguo-supercat merged commit 83b4165 into apache:master May 6, 2020
@graceguo-supercat graceguo-supercat deleted the gg-ImproveLogging branch June 11, 2020 23:19
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.37.0 labels Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/M 🚢 0.37.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants