Skip to content

Commit

Permalink
fix(generic-x-axis): skip initial time filter for legacy charts (#23506)
Browse files Browse the repository at this point in the history
(cherry picked from commit 8db5cb1)
  • Loading branch information
villebro authored and eschutho committed May 31, 2023
1 parent 8f57d90 commit 86f79be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ export const datePickerInAdhocFilterMixin: Pick<
initialValue: (control: ControlState, state: ControlPanelState | null) => {
// skip initialValue if
// 1) GENERIC_CHART_AXES is disabled
// 2) there was a time filter in adhoc filters
// 2) the time_range control is present (this is the case for legacy charts)
// 3) there was a time filter in adhoc filters
if (
!hasGenericChartAxes ||
state?.controls?.time_range?.value ||
ensureIsArray(control.value).findIndex(
(flt: any) => flt?.operator === 'TEMPORAL_RANGE',
) > -1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ export const ControlPanelsContainer = (props: ControlPanelsContainerProps) => {
) => {
const isTemporalRange = (filter: Record<string, any>) =>
filter.operator === Operators.TEMPORAL_RANGE;
if (isTemporalRange(valueToBeDeleted)) {
if (!controls?.time_range?.value && isTemporalRange(valueToBeDeleted)) {
const count = values.filter(isTemporalRange).length;
if (count === 1) {
return t(
Expand Down

0 comments on commit 86f79be

Please sign in to comment.