Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
092ce21
[ML] Move to grid
qn895 Jan 5, 2021
c36c288
[ML] Update types for fields, remove old stats section
qn895 Jan 6, 2021
8dccac2
[ML] Move files out to stats datagrid, move common types to stats_dat…
qn895 Jan 6, 2021
0e13d1e
[ML] Move files out to stats datagrid, move common types to stats_dat…
qn895 Jan 6, 2021
9504dcb
[ML] Update mappings
qn895 Jan 6, 2021
5dda4db
[ML] Update tests for file based
qn895 Jan 6, 2021
5b65e84
[ML] Update filters for the file based data viz
qn895 Jan 6, 2021
659005a
[ML] Remove long
qn895 Jan 6, 2021
5c16ced
[ML] Update tests to assert field counts
qn895 Jan 6, 2021
b5d3b32
[ML] Update translations
qn895 Jan 6, 2021
bcb9005
Merge remote-tracking branch 'upstream/master' into ml-file-based-dat…
qn895 Jan 6, 2021
bb92c47
[ML] Remove 'long' and 'double' since we don't need it anymore
qn895 Jan 6, 2021
77176ee
[ML] Remove expanded row files into its own folder
qn895 Jan 6, 2021
fcf0d25
[ML] Update border styling
qn895 Jan 6, 2021
47dcf86
[ML] Fix field names
qn895 Jan 7, 2021
ed99b6c
[ML] Update for boolean content
qn895 Jan 11, 2021
09f2b31
[ML] Move createFields, filterFields
qn895 Jan 11, 2021
12055fd
[ML] Update boolean & number perview fields
qn895 Jan 12, 2021
aaed023
[ML] Update logic to show file based content preview
qn895 Jan 12, 2021
ea57967
[ML] Rename DataVisualizerDataGrid
qn895 Jan 12, 2021
68fa57f
[ML] Rename DataVisualizerTable types
qn895 Jan 12, 2021
898b686
[ML] Rename folder to stats_table
qn895 Jan 12, 2021
a2c8f30
[ML] Fix top values padding/margin inconsistent for long values
qn895 Jan 11, 2021
eaaf4b5
[ML] Fix types for stats number
qn895 Jan 11, 2021
0a51062
[ML] Update background color of expanded row to not change upon hover
qn895 Jan 11, 2021
a1004b9
Merge upstream/master into branch
qn895 Jan 12, 2021
8b99e8d
[ML] Delete redundant index file
qn895 Jan 12, 2021
eb5543f
[ML] Update boolean content
qn895 Jan 12, 2021
fb0677e
[ML] Update to common theme
qn895 Jan 12, 2021
be9bbc6
[ML] Update metric distribution chart to stats_table
qn895 Jan 12, 2021
f413c57
[ML] Add ip field support
qn895 Jan 12, 2021
9815f7a
[ML] Update translations
qn895 Jan 12, 2021
514f4a9
[ML] Remove duplicate es mapping
qn895 Jan 12, 2021
4d40cd5
Merge remote-tracking branch 'upstream/master' into ml-file-based-dat…
qn895 Jan 14, 2021
955932d
[ML] Add stats to boolean and count
qn895 Jan 14, 2021
bc29f19
[ML] Rename MetaTable to DocumentStatsTable
qn895 Jan 14, 2021
bccd4e7
[ML] Update IS_DARK_THEME and move ot use theme
qn895 Jan 14, 2021
18fad5d
[ML] Extend ListingPageUrlState
qn895 Jan 14, 2021
b70f474
[ML] Refactor field count stats to use same component and classname, …
qn895 Jan 14, 2021
93d64cc
[ML] Add FileBasedUnknownFieldVisConfig
qn895 Jan 14, 2021
5ae610d
[ML] Fix omit to exclude for mapping.properties.type
qn895 Jan 14, 2021
e6f1c5f
[ML] Update updatePageState type and isIndexBasedFieldVisConfig
qn895 Jan 14, 2021
3a0435f
[ML] Update translations
qn895 Jan 14, 2021
4c3047f
[ML] add document stats to all field
qn895 Jan 14, 2021
a640650
[ML] Remove redundant flexitem
qn895 Jan 14, 2021
d71e562
[ML] Update translations
qn895 Jan 15, 2021
16c7b4b
[ML] Update max width for doc stats column and guttersize for keyword
qn895 Jan 15, 2021
418f7ed
Merge remote-tracking branch 'upstream/master' into ml-file-based-dat…
qn895 Jan 15, 2021
e296ac0
[ML] Update guttersize for ip
qn895 Jan 15, 2021
5773aec
Merge upstream/master into branch
qn895 Jan 15, 2021
655fdeb
[ML] update geopoint
qn895 Jan 15, 2021
e69af6a
Update scss
qn895 Jan 15, 2021
f926679
Merge remote-tracking branch 'upstream/master' into ml-file-based-dat…
qn895 Jan 19, 2021
e09dc6f
[ML] Update chart theme
qn895 Jan 19, 2021
f46544e
Merge remote-tracking branch 'upstream/master' into ml-file-based-dat…
qn895 Jan 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions x-pack/plugins/ml/common/types/file_datavisualizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { ES_FIELD_TYPES } from '../../../../../src/plugins/data/common';

export interface InputOverrides {
[key: string]: string;
}
Expand All @@ -29,15 +31,27 @@ export interface FindFileStructureResponse {
count: number;
cardinality: number;
top_hits: Array<{ count: number; value: any }>;
mean_value?: number;
median_value?: number;
max_value?: number;
min_value?: number;
earliest?: string;
latest?: string;
};
};
sample_start: string;
num_messages_analyzed: number;
mappings: {
[fieldName: string]: {
type: string;
properties: {
[fieldName: string]: {
// including all possible Elasticsearch types
// since find_file_structure API can be enhanced to include new fields in the future
type: Exclude<
ES_FIELD_TYPES,
ES_FIELD_TYPES._ID | ES_FIELD_TYPES._INDEX | ES_FIELD_TYPES._SOURCE | ES_FIELD_TYPES._TYPE
>;
format?: string;
};
};
};
quote: string;
Expand Down
13 changes: 8 additions & 5 deletions x-pack/plugins/ml/common/types/ml_url_generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@ export interface MlGenericUrlPageState extends MlIndexBasedSearchState {
[key: string]: any;
}

export interface DataVisualizerIndexBasedAppState {
pageIndex: number;
pageSize: number;
sortField: string;
sortDirection: string;
export interface DataVisualizerIndexBasedAppState extends Omit<ListingPageUrlState, 'queryText'> {
searchString?: Query['query'];
searchQuery?: Query['query'];
searchQueryLanguage?: SearchQueryLanguage;
Expand All @@ -57,6 +53,13 @@ export interface DataVisualizerIndexBasedAppState {
showAllFields?: boolean;
showEmptyFields?: boolean;
}

export interface DataVisualizerFileBasedAppState extends Omit<ListingPageUrlState, 'queryText'> {
visibleFieldTypes?: string[];
visibleFieldNames?: string[];
showDistributions?: boolean;
}

export type MlGenericUrlState = MLPageState<
| typeof ML_PAGES.DATA_VISUALIZER_INDEX_VIEWER
| typeof ML_PAGES.ANOMALY_DETECTION_CREATE_JOB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

.mlDataGridChart__legendBoolean {
width: 100%;
min-width: $euiButtonMinWidth;
td { text-align: center }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { NON_AGGREGATABLE } from './common';

export const hoveredRow$ = new BehaviorSubject<any | null>(null);

const BAR_COLOR = euiPaletteColorBlind()[0];
export const BAR_COLOR = euiPaletteColorBlind()[0];
const BAR_COLOR_BLUR = euiPaletteColorBlind({ rotations: 2 })[10];
const MAX_CHART_COLUMNS = 20;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ import { EuiText, EuiToolTip } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

import { FieldTypeIcon } from '../field_type_icon';
import { FieldVisConfig } from '../../datavisualizer/index_based/common';
import { getMLJobTypeAriaLabel } from '../../util/field_types_utils';
import {
FieldVisConfig,
FileBasedFieldVisConfig,
isIndexBasedFieldVisConfig,
} from '../../datavisualizer/stats_table/types/field_vis_config';

interface Props {
card: FieldVisConfig;
card: FieldVisConfig | FileBasedFieldVisConfig;
}

export const FieldTitleBar: FC<Props> = ({ card }) => {
Expand All @@ -30,13 +34,13 @@ export const FieldTitleBar: FC<Props> = ({ card }) => {

if (card.fieldName === undefined) {
classNames.push('document_count');
} else if (card.isUnsupportedType === true) {
} else if (isIndexBasedFieldVisConfig(card) && card.isUnsupportedType === true) {
classNames.push('type-other');
} else {
classNames.push(card.type);
}

if (card.isUnsupportedType !== true) {
if (isIndexBasedFieldVisConfig(card) && card.isUnsupportedType !== true) {
// All the supported field types have aria labels.
cardTitleAriaLabel.unshift(getMLJobTypeAriaLabel(card.type)!);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
import { Direction, EuiBasicTableProps, Pagination, PropertySort } from '@elastic/eui';
import { useCallback, useMemo } from 'react';
import { ListingPageUrlState } from '../../../../../../../common/types/common';
import { DataVisualizerIndexBasedAppState } from '../../../../../../../common/types/ml_url_generator';
import {
DataVisualizerFileBasedAppState,
DataVisualizerIndexBasedAppState,
} from '../../../../../../../common/types/ml_url_generator';

const PAGE_SIZE_OPTIONS = [10, 25, 50];

Expand Down Expand Up @@ -38,7 +41,10 @@ interface UseTableSettingsReturnValue<T> {

export function useTableSettings<TypeOfItem>(
items: TypeOfItem[],
pageState: ListingPageUrlState | DataVisualizerIndexBasedAppState,
pageState:
| ListingPageUrlState
| DataVisualizerIndexBasedAppState
| DataVisualizerFileBasedAppState,
updatePageState: (update: Partial<ListingPageUrlState>) => void
): UseTableSettingsReturnValue<TypeOfItem> {
const { pageIndex, pageSize, sortField, sortDirection } = pageState;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@import 'file_based/index';
@import 'index_based/index';
@import 'stats_datagrid/index';
@import 'stats_table/index';
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@import 'file_datavisualizer_view/index';
@import 'results_view/index';
@import 'analysis_summary/index';
@import 'fields_stats/index';
@import 'about_panel/index';
@import 'import_summary/index';
@import 'experimental_badge/index';
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,28 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { EuiPanel } from '@elastic/eui';
import React, { FC } from 'react';

import { ML_JOB_FIELD_TYPES } from '../../../../../../common/constants/field_types';

import { FieldVisConfig } from '../../common';
import { FieldTitleBar } from '../../../../components/field_title_bar/index';
import React from 'react';
import {
BooleanContent,
DateContent,
GeoPointContent,
IpContent,
KeywordContent,
NotInDocsContent,
NumberContent,
OtherContent,
TextContent,
} from './content_types';
import { LoadingIndicator } from './loading_indicator';

export interface FieldDataCardProps {
config: FieldVisConfig;
}
NumberContent,
} from '../../../stats_table/components/field_data_expanded_row';
import { ML_JOB_FIELD_TYPES } from '../../../../../../common/constants/field_types';
import type { FileBasedFieldVisConfig } from '../../../stats_table/types/field_vis_config';

export const FieldDataCard: FC<FieldDataCardProps> = ({ config }) => {
const { fieldName, loading, type, existsInDocs } = config;
export const FileBasedDataVisualizerExpandedRow = ({ item }: { item: FileBasedFieldVisConfig }) => {
const config = item;
const { type, fieldName } = config;

function getCardContent() {
if (existsInDocs === false) {
return <NotInDocsContent />;
}

switch (type) {
case ML_JOB_FIELD_TYPES.NUMBER:
if (fieldName !== undefined) {
return <NumberContent config={config} />;
} else {
return null;
}
return <NumberContent config={config} />;

case ML_JOB_FIELD_TYPES.BOOLEAN:
return <BooleanContent config={config} />;
Expand All @@ -68,15 +51,11 @@ export const FieldDataCard: FC<FieldDataCardProps> = ({ config }) => {
}

return (
<EuiPanel
data-test-subj={`mlFieldDataCard ${fieldName} ${type}`}
className="mlFieldDataCard"
hasShadow={false}
<div
className="mlDataVisualizerFieldExpandedRow"
data-test-subj={`mlDataVisualizerFieldExpandedRow-${fieldName}`}
>
<FieldTitleBar card={config} />
<div className="mlFieldDataCard__content" data-test-subj="mlFieldDataCardContent">
{loading === true ? <LoadingIndicator /> : getCardContent()}
</div>
</EuiPanel>
{getCardContent()}
</div>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export { FileBasedDataVisualizerExpandedRow } from './file_based_expanded_row';
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export { FileBasedNumberContentPreview } from './number_content_preview';
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import React from 'react';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { FileBasedFieldVisConfig } from '../../../stats_table/types';

export const FileBasedNumberContentPreview = ({ config }: { config: FileBasedFieldVisConfig }) => {
const stats = config.stats;
if (
stats === undefined ||
stats.min === undefined ||
stats.median === undefined ||
stats.max === undefined
)
return null;
return (
<EuiFlexGroup direction={'column'} gutterSize={'xs'}>
<EuiFlexGroup gutterSize="xs">
<EuiFlexItem>
<b>
<FormattedMessage
id="xpack.ml.fileDatavisualizer.fieldStatsCard.minTitle"
defaultMessage="min"
/>
</b>
</EuiFlexItem>
<EuiFlexItem>
<b>
<FormattedMessage
id="xpack.ml.fileDatavisualizer.fieldStatsCard.medianTitle"
defaultMessage="median"
/>
</b>
</EuiFlexItem>
<EuiFlexItem>
<b>
<FormattedMessage
id="xpack.ml.fileDatavisualizer.fieldStatsCard.maxTitle"
defaultMessage="max"
/>
</b>
</EuiFlexItem>
</EuiFlexGroup>
<EuiFlexGroup gutterSize="xs">
<EuiFlexItem>{stats.min}</EuiFlexItem>
<EuiFlexItem>{stats.median}</EuiFlexItem>
<EuiFlexItem>{stats.max}</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexGroup>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import React, { FC, useMemo } from 'react';
import { i18n } from '@kbn/i18n';
import { MultiSelectPicker } from '../../../../components/multi_select_picker';
import type {
FileBasedFieldVisConfig,
FileBasedUnknownFieldVisConfig,
} from '../../../stats_table/types/field_vis_config';

interface Props {
fields: Array<FileBasedFieldVisConfig | FileBasedUnknownFieldVisConfig>;
setVisibleFieldNames(q: string[]): void;
visibleFieldNames: string[];
}

export const DataVisualizerFieldNamesFilter: FC<Props> = ({
fields,
setVisibleFieldNames,
visibleFieldNames,
}) => {
const fieldNameTitle = useMemo(
() =>
i18n.translate('xpack.ml.dataVisualizer.fileBased.fieldNameSelect', {
defaultMessage: 'Field name',
}),
[]
);
const options = useMemo(
() => fields.filter((d) => d.fieldName !== undefined).map((d) => ({ value: d.fieldName! })),
[fields]
);

return (
<MultiSelectPicker
title={fieldNameTitle}
options={options}
onChange={setVisibleFieldNames}
checkedOptions={visibleFieldNames}
dataTestSubj={'mlDataVisualizerFieldNameSelect'}
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/

export { FieldDataCard, FieldDataCardProps } from './field_data_card';
export { DataVisualizerFieldNamesFilter } from './field_names_filter';
Loading