[ML] Fix feature importance decision path not showing up (#79679)

This commit is contained in:
Quynh Nguyen 2020-10-06 14:12:41 -05:00 committed by GitHub
parent 827f0c06fe
commit 478f587b5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View file

@ -45,7 +45,7 @@ export const DataGridTitle: FC<{ title: string }> = ({ title }) => (
interface PropsWithoutHeader extends UseIndexDataReturnType {
baseline?: number;
analysisType?: DataFrameAnalysisConfigType;
analysisType?: DataFrameAnalysisConfigType | 'unknown';
resultsField?: string;
dataTestSubj: string;
toastNotifications: CoreSetup['notifications']['toasts'];

View file

@ -159,11 +159,13 @@ interface LoadEvaluateResult {
error: string | null;
}
export const getAnalysisType = (analysis: AnalysisConfig): string => {
export const getAnalysisType = (
analysis: AnalysisConfig
): DataFrameAnalysisConfigType | 'unknown' => {
const keys = Object.keys(analysis);
if (keys.length === 1) {
return keys[0];
return keys[0] as DataFrameAnalysisConfigType;
}
return 'unknown';

View file

@ -23,7 +23,12 @@ import { useColorRange, ColorRangeLegend } from '../../../../../components/color
import { DataGrid, UseIndexDataReturnType } from '../../../../../components/data_grid';
import { SavedSearchQuery } from '../../../../../contexts/ml';
import { defaultSearchQuery, DataFrameAnalyticsConfig, SEARCH_SIZE } from '../../../../common';
import {
defaultSearchQuery,
DataFrameAnalyticsConfig,
SEARCH_SIZE,
getAnalysisType,
} from '../../../../common';
import {
ExpandableSection,
@ -113,6 +118,8 @@ export const ExpandableSectionResults: FC<ExpandableSectionResultsProps> = ({
indexData.rowCount,
colorRange
);
const analysisType =
jobConfig && jobConfig.analysis ? getAnalysisType(jobConfig.analysis) : undefined;
const resultsSectionContent = (
<>
{jobConfig !== undefined && needsDestIndexPattern && (
@ -133,6 +140,7 @@ export const ExpandableSectionResults: FC<ExpandableSectionResultsProps> = ({
{columnsWithCharts.length > 0 && tableItems.length > 0 && (
<DataGrid
{...indexData}
analysisType={analysisType}
dataTestSubj="mlExplorationDataGrid"
toastNotifications={getToastNotifications()}
/>