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

[Backport 2.x] Add data source info in discover url when navigating #348

Merged
merged 1 commit into from
Oct 12, 2024
Merged
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
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
Loading