[ML] Fix time range not correct in Anomaly detection field statistics flyout (#155423)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Quynh Nguyen (Quinn) 2023-04-25 10:38:39 -05:00 committed by GitHub
parent 7112c286ab
commit a018d38687
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View file

@ -10,7 +10,7 @@ import type { DataView } from '@kbn/data-plugin/common';
import type { FieldStatsServices } from '@kbn/unified-field-list-plugin/public';
import type { TimeRange as TimeRangeMs } from '@kbn/ml-date-picker';
import type { FieldStatsProps } from '@kbn/unified-field-list-plugin/public';
import { MLJobWizardFieldStatsFlyoutContext } from './use_field_stats_flytout_context';
import { MLFieldStatsFlyoutContext } from './use_field_stats_flytout_context';
import { FieldStatsFlyout } from './field_stats_flyout';
export const FieldStatsFlyoutProvider: FC<{
@ -29,7 +29,7 @@ export const FieldStatsFlyoutProvider: FC<{
);
return (
<MLJobWizardFieldStatsFlyoutContext.Provider
<MLFieldStatsFlyoutContext.Provider
value={{
isFlyoutVisible: isFieldStatsFlyoutVisible,
setIsFlyoutVisible: setFieldStatsIsFlyoutVisible,
@ -47,6 +47,6 @@ export const FieldStatsFlyoutProvider: FC<{
dslQuery={dslQuery}
/>
{children}
</MLJobWizardFieldStatsFlyoutContext.Provider>
</MLFieldStatsFlyoutContext.Provider>
);
};

View file

@ -9,7 +9,7 @@ export { FieldStatsFlyout } from './field_stats_flyout';
export { FieldStatsContent } from './field_stats_content';
export { FieldStatsFlyoutProvider } from './field_stats_flyout_provider';
export {
MLJobWizardFieldStatsFlyoutContext,
MLFieldStatsFlyoutContext,
useFieldStatsFlyoutContext,
} from './use_field_stats_flytout_context';
export { FieldStatsInfoButton } from './field_stats_info_button';

View file

@ -15,7 +15,7 @@ interface MLJobWizardFieldStatsFlyoutProps {
setFieldValue: (v: string) => void;
fieldValue?: string | number;
}
export const MLJobWizardFieldStatsFlyoutContext = createContext<MLJobWizardFieldStatsFlyoutProps>({
export const MLFieldStatsFlyoutContext = createContext<MLJobWizardFieldStatsFlyoutProps>({
isFlyoutVisible: false,
setIsFlyoutVisible: () => {},
toggleFlyoutVisible: () => {},
@ -24,5 +24,5 @@ export const MLJobWizardFieldStatsFlyoutContext = createContext<MLJobWizardField
});
export function useFieldStatsFlyoutContext() {
return useContext(MLJobWizardFieldStatsFlyoutContext);
return useContext(MLFieldStatsFlyoutContext);
}

View file

@ -63,7 +63,7 @@ export const WizardSteps: FC<Props> = ({ currentStep, setCurrentStep }) => {
const timeRangeMs = useMemo(() => {
// If time range is available via jobCreator, use that
// else mimic Discover and set timeRange to be now for data view without time field
return start && end ? { from: start, to: start } : undefined;
return start && end ? { from: start, to: end } : undefined;
}, [start, end]);
// store whether the advanced and additional sections have been expanded.