-
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
fix: should be able to remove selection from X-AXIS control #21371
Conversation
Codecov Report
@@ Coverage Diff @@
## master #21371 +/- ##
==========================================
+ Coverage 66.53% 66.57% +0.03%
==========================================
Files 1791 1791
Lines 68599 68559 -40
Branches 7320 7319 -1
==========================================
- Hits 45645 45644 -1
+ Misses 21064 21021 -43
- Partials 1890 1894 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
I left a few comments. I think the important thing to test is to ensure that a chart that has been created before the flag was enabled still renders correctly (=with the x-axis control being set to the temporal column)
superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/constants.tsx
Outdated
Show resolved
Hide resolved
// default to the chosen time column if x-axis is unset and the | ||
// GENERIC_CHART_AXES feature flag is enabled | ||
const { value } = control; | ||
if (value) { | ||
return value; | ||
} | ||
const timeColumn = controlPanel?.form_data?.granularity_sqla; | ||
if (isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES) && timeColumn) { | ||
return timeColumn; | ||
} | ||
return null; | ||
}, |
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.
IIRC, this logic was added so that charts that were created when the GENERIC_CHART_AXES
FF was unset would render correctly when exploring them after the GENERIC_CHART_AXES
FF was enabled. Otherwise it would open Explor and clear the chart due to the required x_axis
control being unset. So the flow should be something like this:
- When entering Explore with FF disabled, nothing should happen (
x_axis
should benull
) - When entering Explore with the FF enabled and the
x_axis
value is unset, the value should be set to the temporal column - When entering Explore with the FF enabled and the
x_axis
value is set, it should not be changed
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 X-Axis control value
should be set instead of setting the default
value because if the default value had been set, the X-Axis control wouldn't have chance to remove it(the X-AXIS always sets a default value). Let me find a way to set the X-Axis as the sqla_grainularity
if GENERIC_CHART_AXES
is enabled.
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.
Hi @villebro, I have added a new property for controls, initialValue
. It refers to how to initialize a control when loading, this setting avoids the default value always set to the control.
I also tested charts between FF enabled and disabled.
- Create a Bar Chart V2 when
GENERIC_CHART_AXES
is disabled, and then create a dashboard and take the chart. - Open the
GENERIC_CHART_AXES
- the Chart on the Explore page and Dashboard same as the disabled FF.
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.
Hi @villebro, I have added a new property for controls,
initialValue
. It refers to how to initialize a control when loading, this setting avoids the default value always set to the control.
This is a really useful addition 👍 I'm sure this will be needed in the future at some point.
afde2bd
to
b7df283
Compare
b7df283
to
e1098bb
Compare
/testenv up |
@zhaoyongjie Ephemeral environment spinning up at http://34.212.24.2:8080. Credentials are |
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 and tested to work as expected 👍
// default to the chosen time column if x-axis is unset and the | ||
// GENERIC_CHART_AXES feature flag is enabled | ||
const { value } = control; | ||
if (value) { | ||
return value; | ||
} | ||
const timeColumn = controlPanel?.form_data?.granularity_sqla; | ||
if (isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES) && timeColumn) { | ||
return timeColumn; | ||
} | ||
return null; | ||
}, |
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.
Hi @villebro, I have added a new property for controls,
initialValue
. It refers to how to initialize a control when loading, this setting avoids the default value always set to the control.
This is a really useful addition 👍 I'm sure this will be needed in the future at some point.
Ephemeral environment shutdown and build artifacts deleted. |
SUMMARY
Should be able to remove a column from X-AXIS control, since the x-axis control has supported categorical or date columns.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before
remove.axis.before.mov
After
should.be.able.to.remove.selection.column.from.x-axis.mov
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION