Skip to content

Commit

Permalink
[Transforms] Fixing use full data button (#167404)
Browse files Browse the repository at this point in the history
Fixing bug introduced by a merge clash between
#166622 and
#166651

The `hideFrozenDataTierChoice` prop is no longer available in the
`FullTimeRangeSelector` component and so the transforms plugin needs to
set `showFrozenDataTierChoice` in the data picker context.
  • Loading branch information
jgowdyelastic authored and pull[bot] committed Jan 16, 2024
1 parent 69ba158 commit 5abddfc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ export const FullTimeRangeSelector: FC<FullTimeRangeSelectorProps> = (props) =>
toasts,
http,
query,
showFrozenDataTierChoice ? frozenDataPreference === FROZEN_TIER_PREFERENCE.EXCLUDE : false,
showFrozenDataTierChoice === false
? false
: frozenDataPreference === FROZEN_TIER_PREFERENCE.EXCLUDE,
apiPath
);
if (typeof callback === 'function' && fullTimeRange !== undefined) {
Expand Down Expand Up @@ -192,9 +194,16 @@ export const FullTimeRangeSelector: FC<FullTimeRangeSelectorProps> = (props) =>
[sortOptions, frozenDataPreference, setPreference]
);

const buttonTooltip = useMemo(
() =>
frozenDataPreference === FROZEN_TIER_PREFERENCE.EXCLUDE ? (
const buttonTooltip = useMemo(() => {
if (showFrozenDataTierChoice === false) {
return (
<FormattedMessage
id="xpack.ml.datePicker.fullTimeRangeSelector.useFullData"
defaultMessage="Use full range of data."
/>
);
} else {
return frozenDataPreference === FROZEN_TIER_PREFERENCE.EXCLUDE ? (
<FormattedMessage
id="xpack.ml.datePicker.fullTimeRangeSelector.useFullDataExcludingFrozenButtonTooltip"
defaultMessage="Use full range of data excluding frozen data tier."
Expand All @@ -204,9 +213,9 @@ export const FullTimeRangeSelector: FC<FullTimeRangeSelectorProps> = (props) =>
id="xpack.ml.datePicker.fullTimeRangeSelector.useFullDataIncludingFrozenButtonTooltip"
defaultMessage="Use full range of data including frozen data tier, which might have slower search results."
/>
),
[frozenDataPreference]
);
);
}
}, [frozenDataPreference, showFrozenDataTierChoice]);

return (
<EuiFlexGroup responsive={false} gutterSize="xs">
Expand All @@ -222,7 +231,7 @@ export const FullTimeRangeSelector: FC<FullTimeRangeSelectorProps> = (props) =>
/>
</EuiButton>
</EuiToolTip>
{showFrozenDataTierChoice ? (
{showFrozenDataTierChoice === false ? null : (
<EuiFlexItem grow={false}>
<EuiPopover
id={'mlFullTimeRangeSelectorOption'}
Expand All @@ -248,7 +257,7 @@ export const FullTimeRangeSelector: FC<FullTimeRangeSelectorProps> = (props) =>
{popoverContent}
</EuiPopover>
</EuiFlexItem>
) : null}
)}
</EuiFlexGroup>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ import { EuiSteps, EuiStepStatus } from '@elastic/eui';

import { i18n } from '@kbn/i18n';
import { DataView } from '@kbn/data-views-plugin/public';
import { DatePickerContextProvider } from '@kbn/ml-date-picker';
import { DatePickerContextProvider, type DatePickerDependencies } from '@kbn/ml-date-picker';
import { Storage } from '@kbn/kibana-utils-plugin/public';
import { StorageContextProvider } from '@kbn/ml-local-storage';
import { UrlStateProvider } from '@kbn/ml-url-state';
import { UI_SETTINGS } from '@kbn/data-plugin/common';
import type { FieldStatsServices } from '@kbn/unified-field-list/src/components/field_stats';
import type { RuntimeMappings } from '@kbn/ml-runtime-field-utils';

import { useEnabledFeatures } from '../../../../serverless_context';
import type { TransformConfigUnion } from '../../../../../../common/types/transform';

import { getCreateTransformRequestBody } from '../../../../common';
Expand Down Expand Up @@ -106,6 +107,7 @@ export const CreateTransformWizardContext = createContext<{
});

export const Wizard: FC<WizardProps> = React.memo(({ cloneConfig, searchItems }) => {
const { showNodeInfo } = useEnabledFeatures();
const appDependencies = useAppDependencies();
const {
ml: { FieldStatsFlyoutProvider },
Expand Down Expand Up @@ -226,9 +228,10 @@ export const Wizard: FC<WizardProps> = React.memo(({ cloneConfig, searchItems })

const stepsConfig = [stepDefine, stepDetails, stepCreate];

const datePickerDeps = {
const datePickerDeps: DatePickerDependencies = {
...pick(appDependencies, ['data', 'http', 'notifications', 'theme', 'uiSettings', 'i18n']),
uiSettingsKeys: UI_SETTINGS,
showFrozenDataTierChoice: showNodeInfo,
};

const fieldStatsServices: FieldStatsServices = useMemo(
Expand Down

0 comments on commit 5abddfc

Please sign in to comment.