Skip to content

Commit

Permalink
fix training quick filters (#96500) (#96829)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
alvarezmelissa87 and kibanamachine authored Apr 12, 2021
1 parent b09b3d7 commit ee5cc66
Showing 1 changed file with 28 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,32 @@ import { FeatureImportanceSummaryPanelProps } from '../total_feature_importance_
import { useExplorationUrlState } from '../../hooks/use_exploration_url_state';
import { ExplorationQueryBarProps } from '../exploration_query_bar/exploration_query_bar';

const filters = {
options: [
{
id: 'training',
label: i18n.translate('xpack.ml.dataframe.analytics.explorationResults.trainingSubsetLabel', {
defaultMessage: 'Training',
}),
},
{
id: 'testing',
label: i18n.translate('xpack.ml.dataframe.analytics.explorationResults.testingSubsetLabel', {
defaultMessage: 'Testing',
}),
},
],
columnId: 'ml.is_training',
key: { training: true, testing: false },
};
function getFilters(resultsField: string) {
return {
options: [
{
id: 'training',
label: i18n.translate(
'xpack.ml.dataframe.analytics.explorationResults.trainingSubsetLabel',
{
defaultMessage: 'Training',
}
),
},
{
id: 'testing',
label: i18n.translate(
'xpack.ml.dataframe.analytics.explorationResults.testingSubsetLabel',
{
defaultMessage: 'Testing',
}
),
},
],
columnId: `${resultsField}.is_training`,
key: { training: true, testing: false },
};
}

export interface EvaluatePanelProps {
jobConfig: DataFrameAnalyticsConfig;
Expand Down Expand Up @@ -151,7 +159,7 @@ export const ExplorationPageWrapper: FC<Props> = ({
</>
)}

{indexPattern !== undefined && (
{indexPattern !== undefined && jobConfig && (
<>
<EuiFlexGroup direction="column">
<EuiFlexItem grow={false}>
Expand All @@ -162,7 +170,7 @@ export const ExplorationPageWrapper: FC<Props> = ({
indexPattern={indexPattern}
setSearchQuery={searchQueryUpdateHandler}
query={query}
filters={filters}
filters={getFilters(jobConfig.dest.results_field)}
/>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down

0 comments on commit ee5cc66

Please sign in to comment.