Skip to content

Commit bbe4cc9

Browse files
committed
rename interface
1 parent 9785d3a commit bbe4cc9

File tree

7 files changed

+17
-27
lines changed

7 files changed

+17
-27
lines changed

src/platform/packages/private/kbn-esql-editor/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
export type { DataErrorsControl, IndexEditorContext } from './src/types';
10+
export type { DataErrorsControl } from './src/types';
1111
export type { ESQLEditorProps } from './src/esql_editor';
1212
import { ESQLEditor } from './src/esql_editor';
1313
export type { ESQLEditorRestorableState } from './src/restorable_state';

src/platform/packages/private/kbn-esql-editor/src/esql_editor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ const ESQLEditorInternal = function ESQLEditor({
130130
disableAutoFocus,
131131
controlsContext,
132132
esqlVariables,
133-
indexEditorContext,
133+
onOpenQueryInNewTab,
134134
expandToFitQueryOnMount,
135135
dataErrorsControl,
136136
formLabel,
@@ -773,7 +773,7 @@ const ESQLEditorInternal = function ESQLEditor({
773773
query,
774774
onLookupIndexCreate,
775775
onNewFieldsAddedToLookupIndex,
776-
indexEditorContext?.onOpenIndexInDiscover
776+
onOpenQueryInNewTab
777777
);
778778

779779
useDebounceWithOptions(

src/platform/packages/private/kbn-esql-editor/src/types.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import type {
2323
RecommendedField,
2424
} from '@kbn/esql-types';
2525
import type { InferenceEndpointsAutocompleteResult } from '@kbn/esql-types';
26-
import type { EditLookupIndexContentContext } from '@kbn/index-editor';
2726

2827
export interface ControlsContext {
2928
/** The editor supports the creation of controls,
@@ -36,10 +35,6 @@ export interface ControlsContext {
3635
onCancelControl: () => void;
3736
}
3837

39-
export interface IndexEditorContext {
40-
onOpenIndexInDiscover: EditLookupIndexContentContext['onOpenIndexInDiscover'];
41-
}
42-
4338
export interface DataErrorsControl {
4439
enabled: boolean;
4540
onChange: (value: boolean) => void;
@@ -96,8 +91,8 @@ export interface ESQLEditorProps {
9691
disableAutoFocus?: boolean;
9792
/** Enables the creation of controls from the editor **/
9893
controlsContext?: ControlsContext;
99-
/** Context for the lookup join index editor **/
100-
indexEditorContext?: IndexEditorContext;
94+
/** Opens the given query in a new Discover tab **/
95+
onOpenQueryInNewTab?: (tabName: string, esqlQuery: string) => Promise<void>;
10196
/** The available ESQL variables from the page context this editor was opened in */
10297
esqlVariables?: ESQLControlVariable[];
10398
/** Resize the editor to fit the initially passed query on mount */

src/platform/plugins/shared/discover/public/application/main/components/top_nav/discover_topnav.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,11 @@ export const DiscoverTopNav = ({
9999
onUpdateESQLQuery: stateContainer.actions.updateESQLQuery,
100100
});
101101

102-
// ES|QL lookup join index editor config
103-
const openIndexInNewTab = useCallback(
104-
async (indexName: string, esqlQuery: string) => {
102+
const onOpenQueryInNewTab = useCallback(
103+
async (tabName: string, esqlQuery: string) => {
105104
dispatch(
106105
internalStateActions.openInNewTab({
107-
tabLabel: indexName,
106+
tabLabel: tabName,
108107
appState: { query: { esql: esqlQuery } },
109108
})
110109
);
@@ -329,9 +328,7 @@ export const DiscoverTopNav = ({
329328
}
330329
: undefined
331330
}
332-
esqlIndexEditorConfig={{
333-
onOpenIndexInDiscover: openIndexInNewTab,
334-
}}
331+
onOpenQueryInNewTab={onOpenQueryInNewTab}
335332
/>
336333
{isESQLToDataViewTransitionModalVisible && (
337334
<ESQLToDataViewTransitionModal onClose={onESQLToDataViewTransitionModalClose} />

src/platform/plugins/shared/unified_search/public/query_string_input/query_bar_top_row.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ import type { ESQLControlVariable } from '@kbn/esql-types';
4949
import { useKibana } from '@kbn/kibana-react-plugin/public';
5050
import { SplitButton } from '@kbn/split-button';
5151

52-
import type { IndexEditorContext } from '@kbn/esql-editor';
5352
import { AddFilterPopover } from './add_filter_popover';
5453
import type { DataViewPickerProps } from '../dataview_picker';
5554
import { DataViewPicker } from '../dataview_picker';
@@ -234,11 +233,10 @@ export interface QueryBarTopRowProps<QT extends Query | AggregateQuery = Query>
234233
*/
235234
controlsWrapper: React.ReactNode;
236235
};
237-
/** Optional configurations for the lookup join index editor */
238-
esqlIndexEditorConfig?: {
239-
/** Callback function invoked to open the current index in Discover */
240-
onOpenIndexInDiscover: IndexEditorContext['onOpenIndexInDiscover'];
241-
};
236+
/**
237+
* Optional - Callback function invoked to open the current query in a new Discover tab
238+
*/
239+
onOpenQueryInNewTab?: ESQLEditorProps['onOpenQueryInNewTab'];
242240
useBackgroundSearchButton?: boolean;
243241
showProjectPicker?: boolean;
244242
}
@@ -928,7 +926,7 @@ export const QueryBarTopRow = React.memo(
928926
: undefined
929927
}
930928
esqlVariables={props.esqlVariablesConfig?.esqlVariables ?? []}
931-
indexEditorContext={props.esqlIndexEditorConfig}
929+
onOpenQueryInNewTab={props.onOpenQueryInNewTab}
932930
/>
933931
)
934932
);

src/platform/plugins/shared/unified_search/public/search_bar/create_search_bar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ export function createSearchBar({
279279
esqlEditorInitialState={props.esqlEditorInitialState}
280280
onEsqlEditorInitialStateChange={props.onEsqlEditorInitialStateChange}
281281
esqlVariablesConfig={props.esqlVariablesConfig}
282-
esqlIndexEditorConfig={props.esqlIndexEditorConfig}
282+
onOpenQueryInNewTab={props.onOpenQueryInNewTab}
283283
useBackgroundSearchButton={props.useBackgroundSearchButton}
284284
/>
285285
</core.i18n.Context>

src/platform/plugins/shared/unified_search/public/search_bar/search_bar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export interface SearchBarOwnProps<QT extends AggregateQuery | Query = Query> {
163163
esqlVariablesConfig?: QueryBarTopRowProps['esqlVariablesConfig'];
164164

165165
/** Optional configurations for the lookup join index editor */
166-
esqlIndexEditorConfig?: QueryBarTopRowProps['esqlIndexEditorConfig'];
166+
onOpenQueryInNewTab?: QueryBarTopRowProps['onOpenQueryInNewTab'];
167167

168168
esqlEditorInitialState?: QueryBarTopRowProps['esqlEditorInitialState'];
169169
onEsqlEditorInitialStateChange?: QueryBarTopRowProps['onEsqlEditorInitialStateChange'];
@@ -785,7 +785,7 @@ export class SearchBarUI<QT extends (Query | AggregateQuery) | Query = Query> ex
785785
esqlEditorInitialState={this.props.esqlEditorInitialState}
786786
onEsqlEditorInitialStateChange={this.props.onEsqlEditorInitialStateChange}
787787
esqlVariablesConfig={this.props.esqlVariablesConfig}
788-
esqlIndexEditorConfig={this.props.esqlIndexEditorConfig}
788+
onOpenQueryInNewTab={this.props.onOpenQueryInNewTab}
789789
useBackgroundSearchButton={this.props.useBackgroundSearchButton}
790790
showProjectPicker={this.props.showProjectPicker}
791791
/>

0 commit comments

Comments
 (0)