Skip to content

Commit

Permalink
fix some typing issues
Browse files Browse the repository at this point in the history
Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
  • Loading branch information
kavilla committed Jul 25, 2024
1 parent 27a74ab commit bf057f2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
10 changes: 5 additions & 5 deletions src/plugins/data/public/antlr/opensearch_sql/code_completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ export const getSuggestions = async ({
selectionEnd,
position,
query,
openSearchDashboards,
services,
}: QuerySuggestionGetFnArgs): Promise<QuerySuggestion[]> => {
const { api } = openSearchDashboards.uiSettings;
const dataSetManager = openSearchDashboards.data.query.dataSet;
const { api } = services.uiSettings;
const dataSetManager = services.data.query.dataSet;
const suggestions = getOpenSearchSqlAutoCompleteSuggestions(query, {
line: position?.lineNumber || selectionStart,
column: position?.column || selectionEnd,
Expand All @@ -62,8 +62,8 @@ export const getSuggestions = async ({

schemas.forEach((schema) => {
if (schema.body?.fields?.length > 0) {
const columns = schema.body.fields.find((col) => col.name === 'COLUMN_NAME');
const fieldTypes = schema.body.fields.find((col) => col.name === 'DATA_TYPE');
const columns = schema.body.fields.find((col: any) => col.name === 'COLUMN_NAME');
const fieldTypes = schema.body.fields.find((col: any) => col.name === 'DATA_TYPE');
if (columns && fieldTypes) {
finalSuggestions.push(
...columns.values.map((col: string) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { DataSetManager } from './dataset_manager';
import { coreMock } from '../../../../../core/public/mocks';
import { SimpleDataSet } from '../../../common/data_sets';
import { SimpleDataSet } from '../../../common';

describe('DataSetManager', () => {
let service: DataSetManager;
Expand Down
9 changes: 6 additions & 3 deletions src/plugins/data/public/ui/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,17 @@ function createStartContract(
const queryEnhancements = new Map();
return {
IndexPatternSelect: jest.fn(),
DataSetNavigator: jest.fn(), // Add the missing property
SearchBar: jest.fn(),
SuggestionsComponent: jest.fn(), // Add the missing property
Settings: new SettingsMock(
{ enabled: isEnhancementsEnabled, supportedAppNames: ['discover'] },
{ supportedAppNames: ['discover'] },
searchServiceMock,
createMockStorage(),
queryEnhancements
queryEnhancements,
{} // Add the missing argument here
),
container$: new Observable(),
dataSetContainer$: new Observable(),
};
}

Expand Down
9 changes: 1 addition & 8 deletions src/plugins/data/public/ui/query_editor/query_editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,7 @@ import { isEqual } from 'lodash';
import React, { Component, createRef, RefObject } from 'react';
import { monaco } from '@osd/monaco';
import { Settings } from '..';
import {
DataSource,
IDataPluginServices,
IFieldType,
IIndexPattern,
Query,
TimeRange,
} from '../..';
import { IDataPluginServices, IFieldType, IIndexPattern, Query, TimeRange } from '../..';
import {
CodeEditor,
OpenSearchDashboardsReactContextValue,
Expand Down

0 comments on commit bf057f2

Please sign in to comment.