Skip to content

Commit adb5ba5

Browse files
Merge branch 'master' into add-version-improve-types
2 parents 54821b4 + 3cef292 commit adb5ba5

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

x-pack/plugins/ml/public/application/components/annotations/annotations_table/__snapshots__/annotations_table.test.js.snap

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import _ from 'lodash';
1313
import PropTypes from 'prop-types';
1414
import rison from 'rison-node';
1515
import React, { Component, Fragment } from 'react';
16-
16+
import memoizeOne from 'memoize-one';
1717
import {
1818
EuiBadge,
1919
EuiButtonIcon,
@@ -130,7 +130,7 @@ export class AnnotationsTable extends Component {
130130
}
131131
}
132132

133-
getAnnotationsWithExtraInfo(annotations) {
133+
getAnnotationsWithExtraInfo = memoizeOne((annotations) => {
134134
// if there is a specific view/chart entities that the annotations can be scoped to
135135
// add a new column called 'current_series'
136136
if (Array.isArray(this.props.chartDetails?.entityData?.entities)) {
@@ -147,7 +147,7 @@ export class AnnotationsTable extends Component {
147147
// if not make it return the original annotations
148148
return annotations;
149149
}
150-
}
150+
});
151151

152152
getJob(jobId) {
153153
// check if the job was supplied via props and matches the supplied jobId
@@ -438,7 +438,7 @@ export class AnnotationsTable extends Component {
438438
name: i18n.translate('xpack.ml.annotationsTable.labelColumnName', {
439439
defaultMessage: 'Label',
440440
}),
441-
sortable: true,
441+
sortable: (key) => +key,
442442
width: '60px',
443443
render: (key) => {
444444
return <EuiBadge color="default">{key}</EuiBadge>;
@@ -644,15 +644,18 @@ export class AnnotationsTable extends Component {
644644
name: CURRENT_SERIES,
645645
dataType: 'boolean',
646646
width: '0px',
647+
render: () => '',
647648
}
648649
);
650+
651+
const items = this.getAnnotationsWithExtraInfo(annotations);
649652
return (
650653
<Fragment>
651654
<EuiInMemoryTable
652655
error={searchError}
653656
className="eui-textOverflowWrap"
654657
compressed={true}
655-
items={this.getAnnotationsWithExtraInfo(annotations)}
658+
items={items}
656659
columns={columns}
657660
pagination={{
658661
pageSizeOptions: [5, 10, 25],

x-pack/plugins/ml/public/application/explorer/explorer_utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ export function loadAnnotationsTableData(selectedCells, selectedJobs, interval,
423423
return a.timestamp - b.timestamp;
424424
})
425425
.map((d, i) => {
426-
d.key = String.fromCharCode(65 + i);
426+
d.key = (i + 1).toString();
427427
return d;
428428
}),
429429
aggregations: resp.aggregations,

x-pack/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/get_focus_data.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ export function getFocusData(
156156
.sort((a, b) => {
157157
return a.timestamp - b.timestamp;
158158
})
159-
.map((d, i) => {
160-
d.key = String.fromCharCode(65 + i);
159+
.map((d, i: number) => {
160+
d.key = (i + 1).toString();
161161
return d;
162162
});
163163

0 commit comments

Comments
 (0)