Skip to content

Commit f79b3bd

Browse files
committed
[ML] fix createAndOpenUrl function
1 parent 93ed566 commit f79b3bd

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

  • x-pack/legacy/plugins/ml/public/application/components/anomalies_table

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

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -255,26 +255,7 @@ class LinksMenuUI extends Component {
255255
);
256256
};
257257

258-
function findFieldType(index) {
259-
getFieldTypeFromMapping(index, categorizationFieldName)
260-
.then(resp => {
261-
if (resp !== '') {
262-
createAndOpenUrl(index, resp);
263-
} else {
264-
i++;
265-
if (i < datafeedIndices.length) {
266-
findFieldType(datafeedIndices[i]);
267-
} else {
268-
error();
269-
}
270-
}
271-
})
272-
.catch(() => {
273-
error();
274-
});
275-
}
276-
277-
function createAndOpenUrl(index, categorizationFieldType) {
258+
const createAndOpenUrl = (index, categorizationFieldType) => {
278259
// Find the ID of the index pattern with a title attribute which matches the
279260
// index configured in the datafeed. If a Kibana index pattern has not been created
280261
// for this index, then the user will see a warning message on the Discover tab advising
@@ -359,6 +340,25 @@ class LinksMenuUI extends Component {
359340
})
360341
);
361342
});
343+
};
344+
345+
function findFieldType(index) {
346+
getFieldTypeFromMapping(index, categorizationFieldName)
347+
.then(resp => {
348+
if (resp !== '') {
349+
createAndOpenUrl(index, resp);
350+
} else {
351+
i++;
352+
if (i < datafeedIndices.length) {
353+
findFieldType(datafeedIndices[i]);
354+
} else {
355+
error();
356+
}
357+
}
358+
})
359+
.catch(() => {
360+
error();
361+
});
362362
}
363363
};
364364

0 commit comments

Comments
 (0)