mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Dataset quality] Pass breakdown field over to logs explorer from degraded docs chart (#181509)
## Summary
The PR adds the `breakdownField` param in `LogsExplorerNavigationParams`
so that when "Explorer data in Logs Explorer" is clicked on Degraded
Docs chart on Dataset Quality flyout while the chart has a breakdown
field selected, the field is passed over to Logs Explorer.
b380ac85
-e40e-451b-983f-41c68f87ed7b
This commit is contained in:
parent
58562c9565
commit
707ec552d9
3 changed files with 63 additions and 1 deletions
|
@ -68,6 +68,10 @@ export interface LogsExplorerNavigationParams extends SerializableRecord {
|
|||
* Optionally apply curated filter controls
|
||||
*/
|
||||
filterControls?: FilterControls;
|
||||
/**
|
||||
* Optionally set chart's breakdown field
|
||||
*/
|
||||
breakdownField?: string;
|
||||
}
|
||||
|
||||
export interface LogsExplorerLocatorParams extends LogsExplorerNavigationParams {
|
||||
|
|
|
@ -99,6 +99,21 @@ describe('Observability Logs Explorer Locators', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('should allow specifying breakdown field', async () => {
|
||||
const params: AllDatasetsLocatorParams = {
|
||||
breakdownField: 'service.name',
|
||||
};
|
||||
|
||||
const { allDatasetsLocator } = await setup();
|
||||
const location = await allDatasetsLocator.getLocation(params);
|
||||
|
||||
expect(location).toMatchObject({
|
||||
app: OBSERVABILITY_LOGS_EXPLORER_APP_ID,
|
||||
path: '/?pageState=(breakdownField:service.name,dataSourceSelection:(selectionType:all),v:2)',
|
||||
state: {},
|
||||
});
|
||||
});
|
||||
|
||||
it('should allow specifying columns', async () => {
|
||||
const params: AllDatasetsLocatorParams = {
|
||||
columns: [{ field: '_source', type: 'document-field' }],
|
||||
|
@ -211,6 +226,22 @@ describe('Observability Logs Explorer Locators', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('should allow specifying breakdown field', async () => {
|
||||
const params: ObsLogsExplorerDataViewLocatorParams = {
|
||||
id: 'data-view-id',
|
||||
breakdownField: 'service.name',
|
||||
};
|
||||
|
||||
const { dataViewLocator } = await setup();
|
||||
const location = await dataViewLocator.getLocation(params);
|
||||
|
||||
expect(location).toMatchObject({
|
||||
app: OBSERVABILITY_LOGS_EXPLORER_APP_ID,
|
||||
path: `/?pageState=(breakdownField:service.name,dataSourceSelection:(selection:(dataView:(dataType:unresolved,id:data-view-id)),selectionType:dataView),v:2)`,
|
||||
state: {},
|
||||
});
|
||||
});
|
||||
|
||||
it('should allow specifying columns', async () => {
|
||||
const params: ObsLogsExplorerDataViewLocatorParams = {
|
||||
id: 'data-view-id',
|
||||
|
@ -331,6 +362,23 @@ describe('Observability Logs Explorer Locators', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('should allow specifying breakdown field', async () => {
|
||||
const params: SingleDatasetLocatorParams = {
|
||||
integration,
|
||||
dataset,
|
||||
breakdownField: 'service.name',
|
||||
};
|
||||
|
||||
const { singleDatasetLocator } = await setup();
|
||||
const location = await singleDatasetLocator.getLocation(params);
|
||||
|
||||
expect(location).toMatchObject({
|
||||
app: OBSERVABILITY_LOGS_EXPLORER_APP_ID,
|
||||
path: `/?pageState=(breakdownField:service.name,dataSourceSelection:(selection:(dataset:(name:'logs-test-*-*',title:test),name:Test),selectionType:unresolved),v:2)`,
|
||||
state: {},
|
||||
});
|
||||
});
|
||||
|
||||
it('should allow specifying columns', async () => {
|
||||
const params: SingleDatasetLocatorParams = {
|
||||
integration,
|
||||
|
|
|
@ -35,7 +35,16 @@ interface LocatorPathConstructionParams {
|
|||
export const constructLocatorPath = async (params: LocatorPathConstructionParams) => {
|
||||
const {
|
||||
dataSourceSelection,
|
||||
locatorParams: { filterControls, filters, query, refreshInterval, timeRange, columns, origin },
|
||||
locatorParams: {
|
||||
filterControls,
|
||||
filters,
|
||||
query,
|
||||
refreshInterval,
|
||||
timeRange,
|
||||
columns,
|
||||
origin,
|
||||
breakdownField,
|
||||
},
|
||||
useHash,
|
||||
} = params;
|
||||
|
||||
|
@ -47,6 +56,7 @@ export const constructLocatorPath = async (params: LocatorPathConstructionParams
|
|||
query,
|
||||
refreshInterval,
|
||||
time: timeRange,
|
||||
breakdownField,
|
||||
columns: columns?.map((column) => {
|
||||
return column.type === 'smart-field' ? SMART_FALLBACK_FIELDS[column.smartField] : column;
|
||||
}),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue