-
Notifications
You must be signed in to change notification settings - Fork 894
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Discover-Next] conditionally render selector (#7059)
When selecting a specific language, the data source selector disappears and relies completely on the query editor when enhancements are enabled. If toggled on and then off, everything is working properly. #7046 Signed-off-by: Kawika Avilla <kavilla414@gmail.com> --------- Signed-off-by: Kawika Avilla <kavilla414@gmail.com> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> (cherry picked from commit 7f0e9d0) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
3f5cff8
commit f066337
Showing
14 changed files
with
157 additions
and
35 deletions.
There are no files selected for viewing
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,2 @@ | ||
feat: | ||
- Render the datasource selector component conditionally ([#7059](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7059)) |
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
90 changes: 90 additions & 0 deletions
90
src/plugins/data/server/search/opensearch_search/get_default_search_params.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,90 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { getDefaultSearchParams, getAsyncOptions } from './get_default_search_params'; | ||
import { UI_SETTINGS } from '../../../common/constants'; | ||
import { IUiSettingsClient } from 'src/core/server'; | ||
|
||
import { coreMock } from '../../../../../../src/core/server/mocks'; | ||
|
||
describe('getDefaultSearchParams', () => { | ||
let uiSettings: IUiSettingsClient; | ||
|
||
beforeEach(async () => { | ||
const coreContext = coreMock.createRequestHandlerContext(); | ||
uiSettings = coreContext.uiSettings.client; | ||
}); | ||
|
||
describe('getDefaultSearchParams', () => { | ||
describe('maxConcurrentShardRequests', () => { | ||
it('returns as undefined if less than 0', async () => { | ||
uiSettings.get = jest.fn().mockReturnValue(-1); | ||
const result = await getDefaultSearchParams(uiSettings); | ||
expect(result.maxConcurrentShardRequests).toBeUndefined(); | ||
}); | ||
|
||
it('returns as value if greater than 0', async () => { | ||
uiSettings.get = jest.fn().mockReturnValue(5); | ||
const result = await getDefaultSearchParams(uiSettings); | ||
expect(result.maxConcurrentShardRequests).toBe(5); | ||
}); | ||
}); | ||
|
||
describe('ignoreThrottled', () => { | ||
it('returns as true if false', async () => { | ||
uiSettings.get = jest.fn().mockReturnValue(false); | ||
const result = await getDefaultSearchParams(uiSettings); | ||
expect(result.ignoreThrottled).toBe(true); | ||
}); | ||
|
||
it('returns as false if true', async () => { | ||
uiSettings.get = jest.fn().mockReturnValue(true); | ||
const result = await getDefaultSearchParams(uiSettings); | ||
expect(result.ignoreThrottled).toBe(false); | ||
}); | ||
}); | ||
|
||
describe('dataFrameHydrationStrategy', () => { | ||
it('returns correct value', async () => { | ||
uiSettings.get = jest.fn().mockReturnValue('strategy'); | ||
const result = await getDefaultSearchParams(uiSettings); | ||
expect(result.dataFrameHydrationStrategy).toBe('strategy'); | ||
}); | ||
}); | ||
|
||
it('returns correct search params', async () => { | ||
uiSettings.get = jest.fn().mockImplementation((setting: string) => { | ||
switch (setting) { | ||
case UI_SETTINGS.SEARCH_INCLUDE_FROZEN: | ||
return false; | ||
case UI_SETTINGS.COURIER_MAX_CONCURRENT_SHARD_REQUESTS: | ||
return 5; | ||
case UI_SETTINGS.QUERY_DATAFRAME_HYDRATION_STRATEGY: | ||
return 'strategy'; | ||
default: | ||
return undefined; | ||
} | ||
}); | ||
|
||
const result = await getDefaultSearchParams(uiSettings); | ||
expect(result).toEqual({ | ||
maxConcurrentShardRequests: 5, | ||
ignoreThrottled: true, | ||
dataFrameHydrationStrategy: 'strategy', | ||
ignoreUnavailable: true, | ||
trackTotalHits: true, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('getAsyncOptions', () => { | ||
it('returns correct async options', () => { | ||
expect(getAsyncOptions()).toEqual({ | ||
waitForCompletionTimeout: '100ms', | ||
keepAlive: '1m', | ||
}); | ||
}); | ||
}); | ||
}); |
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