-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
feat(explore): Fill dashboard name when adding new chart from dashboard view #20129
Conversation
@@ -699,12 +699,17 @@ function mapStateToProps(state) { | |||
const chartKey = Object.keys(charts)[0]; | |||
const chart = charts[chartKey]; | |||
|
|||
let dashboardId = Number(explore.form_data?.dashboardId); | |||
if (Number.isNaN(dashboardId)) { |
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.
??
operator doesn't exclude NaNs. I also don't want to use ||
operator in order not to exclude dashboards with id 0
Codecov Report
@@ Coverage Diff @@
## master #20129 +/- ##
==========================================
- Coverage 66.47% 66.47% -0.01%
==========================================
Files 1727 1727
Lines 64724 64731 +7
Branches 6822 6824 +2
==========================================
+ Hits 43024 43028 +4
- Misses 19969 19970 +1
- Partials 1731 1733 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
99de199
to
b016a37
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.
Looks good! Just some questions, no feedback
const formData = encodeURIComponent( | ||
JSON.stringify({ | ||
viz_type: this.state.visType, | ||
datasource: this.state.datasource?.value, | ||
...(!isNullish(dashboardId) && { dashboardId }), |
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.
this is a cool function, why nullish?
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.
!dashboardId
would exclude dashboardId === 0
, which is a valid id 😄
@@ -19,6 +19,7 @@ | |||
/* header has mysterious extra margin */ | |||
header.top { | |||
margin-bottom: 2px; | |||
z-index: 10; |
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 is this necessary?
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.
The main menu items on the right were not clickable because in edit mode the right panel was covering them (they were visible but unclickable because of invisible part of that panel covering them)
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.
You can test that by opening dashboard in edit mode and then try to click the "+" icon in top right corner
/testenv up |
@AAfghahi Ephemeral environment spinning up at http://34.221.68.91:8080. Credentials are |
Ephemeral environment shutdown and build artifacts deleted. |
…rd view (apache#20129) * feat(explore): Fill dashboard name when adding new chart from dashboard view * Update import paths * Update test * Fix test
SUMMARY
When user enters chart creation flow starting from a dashboard (e.g. with "Create chart" button in empty state or charts list in dashboard edit mode), the chart's save modal should have that dashboard's name prefilled. To achieve that, we pass
dashboard_id
as a url param to/chart/add
page and from there toexplore
.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Screen.Recording.2022-05-19.at.12.43.24.mov
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION
CC @kasiazjc