[ML] Fix table factory usage. (#52486)
Moves calling the table factory out of components to avoid instantiation on every render call. Note all of this is a workaround for our own typescript version of EuiInMemoryTable. Once the original table has been migrated to TS, we should be able to remove the custom code.
This commit is contained in:
parent
e9299092f0
commit
cffb4dcea8
|
@ -26,6 +26,8 @@ import {
|
|||
import { AnalyticsViewAction } from '../../../data_frame_analytics/pages/analytics_management/components/analytics_list/actions';
|
||||
import { formatHumanReadableDateTimeSeconds } from '../../../util/date_utils';
|
||||
|
||||
const MlInMemoryTable = mlInMemoryTableFactory<DataFrameAnalyticsListRow>();
|
||||
|
||||
interface Props {
|
||||
items: DataFrameAnalyticsListRow[];
|
||||
}
|
||||
|
@ -113,8 +115,6 @@ export const AnalyticsTable: FC<Props> = ({ items }) => {
|
|||
},
|
||||
};
|
||||
|
||||
const MlInMemoryTable = mlInMemoryTableFactory<DataFrameAnalyticsListRow>();
|
||||
|
||||
return (
|
||||
<MlInMemoryTable
|
||||
allowNeutralSort={false}
|
||||
|
|
|
@ -34,6 +34,8 @@ import { JobSelectorBadge } from '../../../components/job_selector/job_selector_
|
|||
import { toLocaleString } from '../../../util/string_utils';
|
||||
import { getSeverityColor } from '../../../../../common/util/anomaly_utils';
|
||||
|
||||
const MlInMemoryTable = mlInMemoryTableFactory<Group>();
|
||||
|
||||
// Used to pass on attribute names to table columns
|
||||
export enum AnomalyDetectionListColumns {
|
||||
id = 'id',
|
||||
|
@ -195,8 +197,6 @@ export const AnomalyDetectionTable: FC<Props> = ({ items, jobsList, statsBarData
|
|||
},
|
||||
};
|
||||
|
||||
const MlInMemoryTable = mlInMemoryTableFactory<Group>();
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<EuiFlexGroup alignItems="center" justifyContent="spaceBetween">
|
||||
|
|
|
@ -22,6 +22,8 @@ import { ES_FIELD_TYPES } from '../../../../../../../../../../src/plugins/data/p
|
|||
import { formatHumanReadableDateTimeSeconds } from '../../../../../../common/utils/date_utils';
|
||||
import { transformTableFactory } from './transform_table';
|
||||
|
||||
const TransformTable = transformTableFactory<EsDoc>();
|
||||
|
||||
interface Props {
|
||||
transformConfig: TransformPivotConfig;
|
||||
}
|
||||
|
@ -197,8 +199,6 @@ export const ExpandedRowPreviewPane: FC<Props> = ({ transformConfig }) => {
|
|||
const transformTableLoading = previewData.length === 0 && isLoading === true;
|
||||
const dataTestSubj = `transformPreviewTabContent${!transformTableLoading ? ' loaded' : ''}`;
|
||||
|
||||
const TransformTable = transformTableFactory<EsDoc>();
|
||||
|
||||
return (
|
||||
<div data-test-subj={dataTestSubj}>
|
||||
<TransformTable
|
||||
|
|
Loading…
Reference in a new issue