Skip to content

Commit 24f2731

Browse files
committed
[ML] Fix lat_long anomalies table links menu and value formatting
1 parent eb4c47e commit 24f2731

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

x-pack/legacy/plugins/ml/public/components/anomalies_table/anomalies_table_columns.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ function renderTime(date, aggregationInterval) {
4848
}
4949
}
5050

51-
function showLinksMenuForItem(item) {
52-
const canConfigureRules = (isRuleSupported(item) && checkPermission('canUpdateJob'));
51+
function showLinksMenuForItem(item, showViewSeriesLink) {
52+
const canConfigureRules = (isRuleSupported(item.source) && checkPermission('canUpdateJob'));
5353
return (canConfigureRules ||
54-
item.isTimeSeriesViewRecord ||
54+
(showViewSeriesLink && item.isTimeSeriesViewRecord) ||
5555
item.entityName === 'mlcategory' ||
5656
item.customUrls !== undefined);
5757
}
@@ -248,7 +248,7 @@ export function getColumns(
248248
});
249249
}
250250

251-
const showLinks = (showViewSeriesLink === true) || items.some(item => showLinksMenuForItem(item));
251+
const showLinks = items.some(item => showLinksMenuForItem(item, showViewSeriesLink));
252252

253253
if (showLinks === true) {
254254
columns.push({

x-pack/legacy/plugins/ml/public/components/anomalies_table/description_cell.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function DescriptionCell({ actual, typical }) {
2929
} = getMetricChangeDescription(actual, typical);
3030

3131
return (
32-
<EuiFlexGroup gutterSize="s">
32+
<EuiFlexGroup gutterSize="s" alignItems="center">
3333
{iconType !== undefined &&
3434
<EuiFlexItem grow={false}>
3535
<EuiIcon

x-pack/legacy/plugins/ml/public/formatters/format_value.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ export function formatValue(value, mlFunction, fieldFormat, record) {
3737
if (value.length === 1) {
3838
return formatSingleValue(value[0], mlFunction, fieldFormat, record);
3939
} else {
40-
// Return with array style formatting.
41-
const values = value.map(val => formatSingleValue(val, mlFunction, fieldFormat, record));
40+
// Currently only multi-value response is for lat_long detectors.
41+
// Return with array style formatting, with items formatted as numbers, rather than
42+
// the default String format which is set for geo_point and geo_shape fields.
43+
const values = value.map(val => formatSingleValue(val, mlFunction, undefined, record));
4244
return `[${values}]`;
4345
}
4446
} else {

0 commit comments

Comments
 (0)