Skip to content

Commit

Permalink
Address code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
stratoula committed Aug 31, 2023
1 parent b937d2a commit 6b75898
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/kbn-text-based-editor/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export const getDocumentationSections = async (language: string) => {
await import('./esql_documentation_sections');
groups.push({
label: i18n.translate('textBasedEditor.query.textBasedLanguagesEditor.esql', {
defaultMessage: 'ESQL',
defaultMessage: 'ES|QL',
}),
items: [],
});
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/data/common/search/expressions/esql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ export const getEsqlFn = ({ getStartDependencies }: EsqlFnArguments) => {
type: 'datatable',
inputTypes: ['kibana_context', 'null'],
help: i18n.translate('data.search.esql.help', {
defaultMessage: 'Queries Elasticsearch using ESQL.',
defaultMessage: 'Queries Elasticsearch using ES|QL.',
}),
args: {
query: {
aliases: ['_', 'q'],
types: ['string'],
help: i18n.translate('data.search.esql.query.help', {
defaultMessage: 'An ESQL query.',
defaultMessage: 'An ES|QL query.',
}),
},
timezone: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function getHookProps(
replaceUrlState,
};
}
const query = { esql: 'rom the-data-view-title' };
const query = { esql: 'from the-data-view-title' };
const msgComplete = {
recordRawType: RecordRawType.PLAIN,
fetchStatus: FetchStatus.PARTIAL,
Expand Down Expand Up @@ -108,12 +108,11 @@ describe('useTextBasedQueryLanguage', () => {
index: 'the-data-view-id',
});
});
expect(replaceUrlState).toHaveBeenCalledWith({ index: 'the-data-view-id' });

replaceUrlState.mockReset();

stateContainer.dataState.data$.documents$.next(msgComplete);
await waitFor(() => expect(replaceUrlState).toHaveBeenCalledTimes(0));
expect(replaceUrlState).toHaveBeenCalledTimes(0);
});
test('should change viewMode to DOCUMENT_LEVEL if it was AGGREGATED_LEVEL', async () => {
const { replaceUrlState } = renderHookWithContext(false, {
Expand Down Expand Up @@ -284,7 +283,7 @@ describe('useTextBasedQueryLanguage', () => {
fetchStatus: FetchStatus.LOADING,
query: { esql: 'from the-data-view-title | WHERE field1=2' },
});
await waitFor(() => expect(replaceUrlState).toHaveBeenCalledTimes(0));
expect(replaceUrlState).toHaveBeenCalledTimes(0);
documents$.next({
recordRawType: RecordRawType.PLAIN,
fetchStatus: FetchStatus.PARTIAL,
Expand All @@ -297,7 +296,7 @@ describe('useTextBasedQueryLanguage', () => {
],
query: { esql: 'from the-data-view-title | WHERE field1=2' },
});
await waitFor(() => expect(replaceUrlState).toHaveBeenCalledTimes(0));
expect(replaceUrlState).toHaveBeenCalledTimes(0);
stateContainer.appState.getState = jest.fn(() => {
return { columns: ['field1', 'field2'], index: 'the-data-view-id' };
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ export class SavedSearchEmbeddable
const useTextBased = this.isTextBasedSearch(savedSearch);

try {
// Request SQL data
// Request text based data
if (useTextBased && query) {
const result = await fetchTextBased(
savedSearch.searchSource.getField('query')!,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ export function ChangeDataView({
data-test-subj="select-text-based-language-panel"
>
{i18n.translate('unifiedSearch.query.queryBar.textBasedLanguagesTryLabel', {
defaultMessage: 'Try ES | QL',
defaultMessage: 'Try ES|QL',
})}
<EuiBadge color="hollow">
{i18n.translate('unifiedSearch.query.queryBar.textBasedLanguagesTechPreviewLabel', {
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/discover/group2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('./_data_grid_pagination'));
loadTestFile(require.resolve('./_data_grid_footer'));
loadTestFile(require.resolve('./_adhoc_data_views'));
loadTestFile(require.resolve('./_sql_view'));
loadTestFile(require.resolve('./_esql_view'));
loadTestFile(require.resolve('./_indexpattern_with_unmapped_fields'));
loadTestFile(require.resolve('./_runtime_fields_editor'));
loadTestFile(require.resolve('./_huge_fields'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export function LensEditConfigurationFlyout({
<EuiCallOut
size="s"
title={i18n.translate('xpack.lens.config.configFlyoutCallout', {
defaultMessage: 'ESQL currently offers limited configuration options',
defaultMessage: 'ES|QL currently offers limited configuration options',
})}
iconType="iInCircle"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe('Text based languages utils', () => {

it('should return the index pattern for es|ql query', () => {
const indexPattern = getIndexPatternFromTextBasedQuery({
sql: 'from foo | keep bytes, memory ',
esql: 'from foo | keep bytes, memory ',
});

expect(indexPattern).toBe('foo');
Expand Down

0 comments on commit 6b75898

Please sign in to comment.