Skip to content

Commit

Permalink
Add data source info in discover url when navigating (#347) (#348)
Browse files Browse the repository at this point in the history
* add data source in url

Signed-off-by: tygao <tygao@amazon.com>

* doc: add changelog

Signed-off-by: tygao <tygao@amazon.com>

---------

Signed-off-by: tygao <tygao@amazon.com>
(cherry picked from commit f7fde7d)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 99c81e3 commit c5aa711
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions public/utils/alerting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,17 @@ export const buildUrlQuery = async (
from: timeDsl.from,
to: timeDsl.to,
};
let indexPatternTitle = indexPattern.title;
const indexPatternTitle = indexPattern.title;
let dataSource;
if (dataSourceId) {
try {
const dataSourceObject = await savedObjects.client.get('data-source', dataSourceId);
const dataSourceTitle = dataSourceObject?.get('title');
// If index pattern refers to a data source, discover list will display data source name as dataSourceTitle::indexPatternTitle
indexPatternTitle = `${dataSourceTitle}::${indexPatternTitle}`;
const dataSourceTitle = dataSourceObject?.get('title') ?? '';
dataSource = {
id: dataSourceId,
title: dataSourceTitle,
type: 'OpenSearch',
};
} catch (e) {
console.error('Get data source object error');
}
Expand All @@ -107,6 +111,7 @@ export const buildUrlQuery = async (
id: indexPattern.id,
timeFieldName: indexPattern.timeFieldName,
title: indexPatternTitle,
...(dataSource ? { dataSource } : {}),
},
language: 'kuery',
query: '',
Expand Down

0 comments on commit c5aa711

Please sign in to comment.