Skip to content

Commit 1b42f30

Browse files
[ML] Fixing results for unknown fields (#24577) (#24633)
* [Ml] Fixing results for known fields * renaming known-type to unknown * correcting comments * tiny refactor
1 parent 6609982 commit 1b42f30

File tree

14 files changed

+165
-66
lines changed

14 files changed

+165
-66
lines changed

x-pack/plugins/ml/common/constants/field_types.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const ES_FIELD_TYPES = {
2727
TOKEN_COUNT: 'token_count',
2828
_ID: '_id',
2929
_SOURCE: '_source',
30-
_TYPE: '_type'
30+
_TYPE: '_type',
3131
};
3232

3333
export const KBN_FIELD_TYPES = {
@@ -52,6 +52,7 @@ export const ML_JOB_FIELD_TYPES = {
5252
IP: 'ip',
5353
KEYWORD: 'keyword',
5454
NUMBER: 'number',
55-
TEXT: 'text'
55+
TEXT: 'text',
56+
UNKNOWN: 'unknown',
5657
};
5758

x-pack/plugins/ml/public/components/field_data_card/styles/main.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
background-color: #920000;
3535
}
3636

37-
.type-other {
37+
.type-other, .unknown {
3838
background-color: #bfa180;
3939
}
4040

x-pack/plugins/ml/public/components/field_type_icon/field_type_icon.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ export function FieldTypeIcon({ tooltipEnabled = false, type }) {
4747
ariaLabel = 'IP type';
4848
iconClass = 'fa-laptop';
4949
break;
50+
case ML_JOB_FIELD_TYPES.UNKNOWN:
51+
ariaLabel = 'Unknown type';
52+
iconChar = '?';
53+
break;
5054
default:
5155
// if type doesn't match one of ML_JOB_FIELD_TYPES
5256
// don't render the component at all

x-pack/plugins/ml/public/file_datavisualizer/components/_index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
@import 'fields_stats/index';
55
@import 'about_panel/index';
66
@import 'import_summary/index';
7+
@import 'experimental_badge/index';

x-pack/plugins/ml/public/file_datavisualizer/components/about_panel/about_panel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function AboutPanel({ onFilePickerChange }) {
5252

5353
export function LoadingPanel() {
5454
return (
55-
<EuiPage restrictWidth={200}>
55+
<EuiPage restrictWidth={400}>
5656
<EuiPageBody>
5757
<EuiFlexGroup gutterSize="xl">
5858
<EuiFlexItem grow={false}>

x-pack/plugins/ml/public/file_datavisualizer/components/about_panel/welcome_content.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import React from 'react';
99

1010
import {
11-
EuiBetaBadge,
1211
EuiFlexGroup,
1312
EuiFlexItem,
1413
EuiIcon,
@@ -18,6 +17,8 @@ import {
1817
EuiTitle,
1918
} from '@elastic/eui';
2019

20+
import { ExperimentalBadge } from '../experimental_badge';
21+
2122
export function WelcomeContent() {
2223

2324
return (
@@ -29,7 +30,9 @@ export function WelcomeContent() {
2930
<EuiTitle size="m">
3031
<h3>
3132
Visualize data from a log file &nbsp;
32-
<EuiBetaBadge label="Experimental" tooltipContent="Experimental feature. We'd love to hear your feedback." />
33+
<ExperimentalBadge
34+
tooltipContent="Experimental feature. We'd love to hear your feedback."
35+
/>
3336
</h3>
3437
</EuiTitle>
3538
<EuiSpacer size="s" />
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.ml-experimental-badge.euiBetaBadge {
2+
font-size: 10px;
3+
vertical-align: middle;
4+
margin-bottom: 5px;
5+
padding: 0px 20px;
6+
line-height: 20px;
7+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import 'experimental_badge'
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import React from 'react';
8+
9+
import {
10+
EuiBetaBadge,
11+
} from '@elastic/eui';
12+
13+
export function ExperimentalBadge({ tooltipContent }) {
14+
return (
15+
<span>
16+
<EuiBetaBadge className="ml-experimental-badge" label="Experimental" tooltipContent={tooltipContent} />
17+
</span>
18+
);
19+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
8+
export { ExperimentalBadge } from './experimental_badge';

0 commit comments

Comments
 (0)