Saved Query: Add onSelectQuery to QueryLibraryContext (#110536)
* Saved Query: Remove onSelectQuery prop requirement from components using saved queries * preserve onSelectQueryCallback on SaveQuery * add missing onSelectQueryCallbacks
This commit is contained in:
@@ -70,6 +70,7 @@ export type QueryLibraryContextType = {
|
||||
contextOverride?: string
|
||||
) => void;
|
||||
setNewQuery: (query?: QueryTemplate) => void;
|
||||
onSelectQuery: (query: DataQuery) => void;
|
||||
};
|
||||
|
||||
export const QueryLibraryContext = createContext<QueryLibraryContextType>({
|
||||
@@ -91,6 +92,7 @@ export const QueryLibraryContext = createContext<QueryLibraryContextType>({
|
||||
queryLibraryEnabled: false,
|
||||
context: 'unknown',
|
||||
triggerAnalyticsEvent: () => {},
|
||||
onSelectQuery: () => {},
|
||||
});
|
||||
|
||||
export function useQueryLibraryContext() {
|
||||
|
||||
@@ -19,6 +19,7 @@ export function QueryLibraryContextProviderMock(props: PropsWithChildren<Props>)
|
||||
context: 'explore',
|
||||
triggerAnalyticsEvent: jest.fn(),
|
||||
setNewQuery: jest.fn(),
|
||||
onSelectQuery: jest.fn(),
|
||||
}}
|
||||
>
|
||||
{props.children}
|
||||
|
||||
@@ -393,8 +393,8 @@ export class QueryEditorRow<TQuery extends DataQuery> extends PureComponent<Prop
|
||||
<MaybeQueryLibrarySaveButton
|
||||
query={query}
|
||||
app={app}
|
||||
onSelectQuery={this.onSelectQueryFromLibrary}
|
||||
onUpdateSuccess={this.onExitQueryLibraryEditingMode}
|
||||
onSelectQuery={this.onSelectQueryFromLibrary}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user