Skip to content

Commit

Permalink
[ML] Fix lat_long anomalies table links menu and value formatting (#5…
Browse files Browse the repository at this point in the history
  • Loading branch information
peteharverson committed Dec 4, 2019
1 parent 06de1ba commit 8592f59
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ function renderTime(date, aggregationInterval) {
}
}

function showLinksMenuForItem(item) {
const canConfigureRules = (isRuleSupported(item) && checkPermission('canUpdateJob'));
function showLinksMenuForItem(item, showViewSeriesLink) {
const canConfigureRules = (isRuleSupported(item.source) && checkPermission('canUpdateJob'));
return (canConfigureRules ||
item.isTimeSeriesViewRecord ||
(showViewSeriesLink && item.isTimeSeriesViewRecord) ||
item.entityName === 'mlcategory' ||
item.customUrls !== undefined);
}
Expand Down Expand Up @@ -248,7 +248,7 @@ export function getColumns(
});
}

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

if (showLinks === true) {
columns.push({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function DescriptionCell({ actual, typical }) {
} = getMetricChangeDescription(actual, typical);

return (
<EuiFlexGroup gutterSize="s">
<EuiFlexGroup gutterSize="s" alignItems="center">
{iconType !== undefined &&
<EuiFlexItem grow={false}>
<EuiIcon
Expand Down
6 changes: 4 additions & 2 deletions x-pack/legacy/plugins/ml/public/formatters/format_value.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ export function formatValue(value, mlFunction, fieldFormat, record) {
if (value.length === 1) {
return formatSingleValue(value[0], mlFunction, fieldFormat, record);
} else {
// Return with array style formatting.
const values = value.map(val => formatSingleValue(val, mlFunction, fieldFormat, record));
// Currently only multi-value response is for lat_long detectors.
// Return with array style formatting, with items formatted as numbers, rather than
// the default String format which is set for geo_point and geo_shape fields.
const values = value.map(val => formatSingleValue(val, mlFunction, undefined, record));
return `[${values}]`;
}
} else {
Expand Down

0 comments on commit 8592f59

Please sign in to comment.