Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] [ML] Fix lat_long anomalies table links menu and value formatting (#50916) #50937

Merged
merged 1 commit into from
Nov 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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