Skip to content

Commit

Permalink
[ML] Fixing data view search based on title (#120737) (#120781)
Browse files Browse the repository at this point in the history
* [ML] Fixing data view search based on title

* removing size argument
# Conflicts:
#	x-pack/plugins/ml/server/lib/alerts/alerting_service.ts
  • Loading branch information
jgowdyelastic authored Dec 9, 2021
1 parent 2cef585 commit 4d4d636
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions x-pack/plugins/ml/public/application/util/index_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ export async function getDataViewIdFromName(name: string): Promise<string | null
if (dataViewsContract === null) {
throw new Error('Data views are not initialized!');
}
const [dv] = await dataViewsContract?.find(name);
if (!dv) {
const dataViews = await dataViewsContract.find(name);
const dataView = dataViews.find(({ title }) => title === name);
if (!dataView) {
return null;
}
return dv.id ?? dv.title;
return dataView.id ?? dataView.title;
}

export function getDataViewById(id: string): Promise<DataView> {
Expand Down

0 comments on commit 4d4d636

Please sign in to comment.