Explore: Add feature to open log sample in split view (#62097)

* Add tests

* Implement split open to see logs functionality

* Fix imports in test

* Update packages/grafana-data/src/types/logs.ts

Co-authored-by: Matias Chomicki <matyax@gmail.com>

* Update packages/grafana-data/src/types/logs.ts

Co-authored-by: Matias Chomicki <matyax@gmail.com>

* Update default scneario to throw error

* Exit early in getSupplementaryQuery

* Update public/app/features/explore/LogsSamplePanel.tsx

Co-authored-by: Matias Chomicki <matyax@gmail.com>
This commit is contained in:
Ivana Huckova
2023-01-26 16:06:10 +01:00
committed by GitHub
parent 5e1dc22f88
commit ea1fcbb866
10 changed files with 392 additions and 109 deletions

View File

@@ -195,11 +195,23 @@ export enum SupplementaryQueryType {
* @internal
*/
export interface DataSourceWithSupplementaryQueriesSupport<TQuery extends DataQuery> {
/**
* Returns an observable that will be used to fetch supplementary data based on the provided
* supplementary query type and original request.
*/
getDataProvider(
type: SupplementaryQueryType,
request: DataQueryRequest<TQuery>
): Observable<DataQueryResponse> | undefined;
/**
* Returns supplementary query types that data source supports.
*/
getSupportedSupplementaryQueryTypes(): SupplementaryQueryType[];
/**
* Returns a supplementary query to be used to fetch supplementary data based on the provided type and original query.
* If provided query is not suitable for provided supplementary query type, undefined should be returned.
*/
getSupplementaryQuery(type: SupplementaryQueryType, query: TQuery): TQuery | undefined;
}
export const hasSupplementaryQuerySupport = <TQuery extends DataQuery>(
@@ -214,6 +226,7 @@ export const hasSupplementaryQuerySupport = <TQuery extends DataQuery>(
return (
withSupplementaryQueriesSupport.getDataProvider !== undefined &&
withSupplementaryQueriesSupport.getSupplementaryQuery !== undefined &&
withSupplementaryQueriesSupport.getSupportedSupplementaryQueryTypes().includes(type)
);
};