-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TSVB][Lens] Navigate to Lens with your current configuration (#114794)
* [Lens][TSVB] Convert to Lens * Add logic for multiple series * Basic formula * Fix circular dependencies * Minor cleanup * Fix types * fix jest tests * Fix test * Change the schema, add more styling options, fix bugs * Supports time shift and custom date interval * Fix types * Fix some types * Move edit in lens button to top nav menu * Cleanup * Further cleanup * Add try it badge in menu, controlled by localStorage * Add go back to app button * Discard changes modal and go back to TSVB * Update by value and by reference visualizations, delete existing by ref * Fix bug * Apply some changes * get title and description only if has context * Pass originating app, title and description from the savedVis * By ref TSVB to by ref Lens * Match TSVB cardinality with Lens unique_count function * Support moving average * Fix test * Support derivative * Support cumulative_sum * Add overall functions * Support filter ratio * Refactor code for easier testing * Fix bug with auto interval * Fetch types from visualizations plugin * Pipeline aggs compatible with percentile * Add some bugs * Support nesred aggs * Mini refactor and support all aggregations to Math * Transfer terms sorting options * Transfer axis position * Fix translations keys * Revert * Fix redirectToOrigin buttion when the there is no embeddableId but comes from dashboard * Improve context identification * Support yExtents * Fix bug in formula caused by changes in the main branch * Support formatters * Support custom label * Cleaning up * Fix terms bugs * Support filter breakdown by * Fixes math bug and escapes filter ratio query * Add some unit tests * Testing triggerOptions payload * Fix console warning * Add more unit tests on TSVB function helpers * Adds a unit test on the vis top nav menu testing the new menu item * Add unit tests * Fix unsupported palette bug, clean up, add a unit test case * Add final unit tests * Support timeScale in derivative * Add functional tests * Cleanup * Fix jest test * Fix some bugs * Fix some math agg bugs * Fix more bugs * Fixes jest test * Fix the problem with the dashboard state * Hides the badge and link instead of disabling it * Changes the text * Adds menu item vertical separator * Enhance the appLeace confirm modal to change the confirm button text and color * Fixes CI * Adress code review comments * Address some of the comments * Fix more bugs * Fix more bugs * Zero decimals for formatting * fix tests * Navigate from dashboard to TSVB to Lens hides the appLeave modal * Adds support for terms on a date field * Support filter by * Move the trigger to the visualizations plugin * Minor * Fix CI * Support percentage charts * Improve the vertical separator * Fixes on the appLeave logic * Remove unecessary import * Add badge to the nav item level * Fix jest test * Fi filter ratio and filter by bug * Replace all occurences of a variable * Nest badge into the button level * Design improvements Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
1f4a7d4
commit d364f23
Showing
72 changed files
with
4,473 additions
and
132 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
...ment/core/public/kibana-plugin-core-public.appleaveconfirmaction.buttoncolor.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [AppLeaveConfirmAction](./kibana-plugin-core-public.appleaveconfirmaction.md) > [buttonColor](./kibana-plugin-core-public.appleaveconfirmaction.buttoncolor.md) | ||
|
||
## AppLeaveConfirmAction.buttonColor property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
buttonColor?: ButtonColor; | ||
``` |
11 changes: 11 additions & 0 deletions
11
...ore/public/kibana-plugin-core-public.appleaveconfirmaction.confirmbuttontext.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [AppLeaveConfirmAction](./kibana-plugin-core-public.appleaveconfirmaction.md) > [confirmButtonText](./kibana-plugin-core-public.appleaveconfirmaction.confirmbuttontext.md) | ||
|
||
## AppLeaveConfirmAction.confirmButtonText property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
confirmButtonText?: string; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
src/plugins/vis_types/timeseries/public/trigger_action/get_datasource_info.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
import type { DataView } from '../../../../data/common'; | ||
import { getDataSourceInfo } from './get_datasource_info'; | ||
const dataViewsMap: Record<string, DataView> = { | ||
test1: { id: 'test1', title: 'test1', timeFieldName: 'timeField1' } as DataView, | ||
test2: { | ||
id: 'test2', | ||
title: 'test2', | ||
timeFieldName: 'timeField2', | ||
} as DataView, | ||
test3: { id: 'test3', title: 'test3', timeFieldName: 'timeField3' } as DataView, | ||
}; | ||
|
||
const getDataview = (id: string): DataView | undefined => dataViewsMap[id]; | ||
jest.mock('../services', () => { | ||
return { | ||
getDataStart: jest.fn(() => { | ||
return { | ||
dataViews: { | ||
getDefault: jest.fn(() => { | ||
return { id: '12345', title: 'default', timeFieldName: '@timestamp' }; | ||
}), | ||
get: getDataview, | ||
}, | ||
}; | ||
}), | ||
}; | ||
}); | ||
|
||
describe('getDataSourceInfo', () => { | ||
test('should return the default dataview if model_indexpattern is string', async () => { | ||
const { indexPatternId, timeField } = await getDataSourceInfo( | ||
'test', | ||
undefined, | ||
false, | ||
undefined | ||
); | ||
expect(indexPatternId).toBe('12345'); | ||
expect(timeField).toBe('@timestamp'); | ||
}); | ||
|
||
test('should return the correct dataview if model_indexpattern is object', async () => { | ||
const { indexPatternId, timeField } = await getDataSourceInfo( | ||
{ id: 'dataview-1-id' }, | ||
'timeField-1', | ||
false, | ||
undefined | ||
); | ||
expect(indexPatternId).toBe('dataview-1-id'); | ||
expect(timeField).toBe('timeField-1'); | ||
}); | ||
|
||
test('should fetch the correct data if overwritten dataview is provided', async () => { | ||
const { indexPatternId, timeField } = await getDataSourceInfo( | ||
{ id: 'dataview-1-id' }, | ||
'timeField-1', | ||
true, | ||
{ id: 'test2' } | ||
); | ||
expect(indexPatternId).toBe('test2'); | ||
expect(timeField).toBe('timeField2'); | ||
}); | ||
}); |
46 changes: 46 additions & 0 deletions
46
src/plugins/vis_types/timeseries/public/trigger_action/get_datasource_info.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
import { fetchIndexPattern, isStringTypeIndexPattern } from '../../common/index_patterns_utils'; | ||
import type { IndexPatternValue } from '../../common/types'; | ||
import { getDataStart } from '../services'; | ||
|
||
export const getDataSourceInfo = async ( | ||
modelIndexPattern: IndexPatternValue, | ||
modelTimeField: string | undefined, | ||
isOverwritten: boolean, | ||
overwrittenIndexPattern: IndexPatternValue | undefined | ||
) => { | ||
const { dataViews } = getDataStart(); | ||
let indexPatternId = | ||
modelIndexPattern && !isStringTypeIndexPattern(modelIndexPattern) ? modelIndexPattern.id : ''; | ||
|
||
let timeField = modelTimeField; | ||
// handle override index pattern | ||
if (isOverwritten) { | ||
const { indexPattern } = await fetchIndexPattern(overwrittenIndexPattern, dataViews); | ||
if (indexPattern) { | ||
indexPatternId = indexPattern.id ?? ''; | ||
timeField = indexPattern.timeFieldName; | ||
} | ||
} | ||
|
||
if (!indexPatternId) { | ||
const defaultIndex = await dataViews.getDefault(); | ||
indexPatternId = defaultIndex?.id ?? ''; | ||
timeField = defaultIndex?.timeFieldName; | ||
} | ||
if (!timeField) { | ||
const indexPattern = await dataViews.get(indexPatternId); | ||
timeField = indexPattern.timeFieldName; | ||
} | ||
|
||
return { | ||
indexPatternId, | ||
timeField, | ||
}; | ||
}; |
Oops, something went wrong.