geido commented on code in PR #30848:
URL: https://github.com/apache/superset/pull/30848#discussion_r1830819858
##########
superset-frontend/packages/superset-ui-chart-controls/src/sections/timeComparison.tsx:
##########
@@ -94,9 +98,29 @@ export const timeComparisonControls: ({
name: 'start_date_offset',
config: {
type: 'TimeOffsetControl',
- label: t('shift start date'),
+ label: t('Shift start date'),
visibility: ({ controls }) =>
controls?.time_compare.value === 'custom',
+ mapStateToProps: (
+ state: ControlPanelState,
+ controlState: ControlState,
+ ) => {
+ const { form_data } = state;
+ const { time_compare } = form_data;
+ const newState = { ...controlState };
+ if (
+ time_compare === 'custom' &&
+ (controlState.value === '' ||
+ controlState.value === 'Invalid date')
+ ) {
+ newState.externalValidationErrors = [
+ t('A date is required when using Custom date shift'),
Review Comment:
Is this "Custom" with capital C intended?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]