mirror of https://github.com/grafana/grafana
Correlations: Create paginated API (#65241)
* Add pagination params and apply to sql * Create getCorrelationsResponse that returns metadata * Set up pagination, change correlations fetch to only get source datasource correlations * Move correlations from root to pane, only fetch correlations for one datasource when initialized or datasource is changed * Fix tests * Fix remaining tests * Use functional component to handle state * Remove unneeded mocks, fix tests * Change perPage to limit * Fix Go Tests * Fix linter * Remove parameter * Account for mixed datasources * Delete unused hook * add source UID filter to API, start backing out front end hook changes * add source IDs to API, use when loading or changing datasource * Fix prettier * Mock correlations response * Get correlations for all datasources in mixed scenario * Add documentation for new parameters * Attempt to fix swagger * Fix correlations page * add swagger and openapi docs * Add mocks to failing test * Change API for consistency, remove extra hooks and unused function * Add max to limit and re-gen api docs * Move the page to the previous page if deleting all the rows on the page * Only fetch if remove does not have value * Change page to a reference hook * Fix documentation, a test and some logic thinking page could be 0pull/71184/head
parent
340c536d0e
commit
f18a02149a
File diff suppressed because it is too large
Load Diff
@ -1,35 +0,0 @@ |
||||
import { useEffect } from 'react'; |
||||
|
||||
import { config } from '@grafana/runtime'; |
||||
import { useAppNotification } from 'app/core/copy/appNotification'; |
||||
import { useCorrelations } from 'app/features/correlations/useCorrelations'; |
||||
import { useDispatch } from 'app/types'; |
||||
|
||||
import { saveCorrelationsAction } from '../state/main'; |
||||
|
||||
export function useExploreCorrelations() { |
||||
const { get } = useCorrelations(); |
||||
const { warning } = useAppNotification(); |
||||
|
||||
const dispatch = useDispatch(); |
||||
useEffect(() => { |
||||
if (!config.featureToggles.correlations) { |
||||
dispatch(saveCorrelationsAction([])); |
||||
} else { |
||||
get.execute(); |
||||
} |
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []); |
||||
|
||||
useEffect(() => { |
||||
if (get.value) { |
||||
dispatch(saveCorrelationsAction(get.value)); |
||||
} else if (get.error) { |
||||
dispatch(saveCorrelationsAction([])); |
||||
warning( |
||||
'Could not load correlations.', |
||||
'Correlations data could not be loaded, DataLinks may have partial data.' |
||||
); |
||||
} |
||||
}, [get.value, get.error, dispatch, warning]); |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue