diff --git a/public/app/features/explore/LogsContainer.tsx b/public/app/features/explore/LogsContainer.tsx index 581d97f85e2..817ff482335 100644 --- a/public/app/features/explore/LogsContainer.tsx +++ b/public/app/features/explore/LogsContainer.tsx @@ -18,7 +18,7 @@ import { getTimeZone } from '../profile/state/selectors'; import { LiveLogsWithTheme } from './LiveLogs'; import { Logs } from './Logs'; import { splitOpen } from './state/main'; -import { addResultsToCache, clearCache, loadLogsVolumeData, toggleLogsVolume } from './state/query'; +import { addResultsToCache, clearCache, loadLogsVolumeData, setLogsVolumeEnabled } from './state/query'; import { updateTimeRange } from './state/time'; import { LiveTailControls } from './useLiveTailControls'; import { LogsCrossFadeTransition } from './utils/LogsCrossFadeTransition'; @@ -129,7 +129,7 @@ class LogsContainer extends PureComponent { logsMeta={logsMeta} logsSeries={logsSeries} logsVolumeEnabled={this.props.logsVolumeEnabled} - onSetLogsVolumeEnabled={(enabled) => this.props.toggleLogsVolume(exploreId, enabled)} + onSetLogsVolumeEnabled={(enabled) => this.props.setLogsVolumeEnabled(exploreId, enabled)} logsVolumeData={logsVolumeData} logsQueries={logsQueries} width={width} @@ -204,7 +204,7 @@ const mapDispatchToProps = { addResultsToCache, clearCache, loadLogsVolumeData, - toggleLogsVolume, + setLogsVolumeEnabled, }; const connector = connect(mapStateToProps, mapDispatchToProps); diff --git a/public/app/features/explore/state/query.test.ts b/public/app/features/explore/state/query.test.ts index 7189e4c9db0..1f6567944d1 100644 --- a/public/app/features/explore/state/query.test.ts +++ b/public/app/features/explore/state/query.test.ts @@ -35,7 +35,7 @@ import { scanStartAction, scanStopAction, storeLogsVolumeDataProviderAction, - toggleLogsVolume, + setLogsVolumeEnabled, } from './query'; import { makeExplorePaneState } from './utils'; @@ -445,7 +445,7 @@ describe('reducer', () => { it('do not load logsVolume data when disabled', async () => { // turn logsvolume off - dispatch(toggleLogsVolume(ExploreId.left, false)); + dispatch(setLogsVolumeEnabled(ExploreId.left, false)); expect(getState().explore[ExploreId.left].logsVolumeEnabled).toBe(false); // verify that if we run a query, it will not do logsvolume, but the Provider will still be set @@ -457,14 +457,14 @@ describe('reducer', () => { it('load logsVolume data when it gets enabled', async () => { // first it is disabled - dispatch(toggleLogsVolume(ExploreId.left, false)); + dispatch(setLogsVolumeEnabled(ExploreId.left, false)); // runQueries sets up the logsVolume query, but does not run it await dispatch(runQueries(ExploreId.left)); expect(getState().explore[ExploreId.left].logsVolumeDataProvider).toBeDefined(); // we turn logsvolume on - await dispatch(toggleLogsVolume(ExploreId.left, true)); + await dispatch(setLogsVolumeEnabled(ExploreId.left, true)); // verify it was turned on expect(getState().explore[ExploreId.left].logsVolumeEnabled).toBe(true); diff --git a/public/app/features/explore/state/query.ts b/public/app/features/explore/state/query.ts index 47474721ace..10c42e8b4d9 100644 --- a/public/app/features/explore/state/query.ts +++ b/public/app/features/explore/state/query.ts @@ -108,8 +108,8 @@ export const queryStoreSubscriptionAction = createAction( - 'explore/toggleLogsVolumeAction' +const setLogsVolumeEnabledAction = createAction<{ exploreId: ExploreId; enabled: boolean }>( + 'explore/setLogsVolumeEnabledAction' ); export interface StoreLogsVolumeDataProvider { @@ -632,9 +632,9 @@ export function loadLogsVolumeData(exploreId: ExploreId): ThunkResult { }; } -export function toggleLogsVolume(exploreId: ExploreId, enabled: boolean): ThunkResult { +export function setLogsVolumeEnabled(exploreId: ExploreId, enabled: boolean): ThunkResult { return (dispatch, getState) => { - dispatch(toggleLogsVolumeAction({ exploreId, enabled })); + dispatch(setLogsVolumeEnabledAction({ exploreId, enabled })); storeLogsVolumeEnabled(enabled); if (enabled) { dispatch(loadLogsVolumeData(exploreId)); @@ -738,7 +738,7 @@ export const queryReducer = (state: ExploreItemState, action: AnyAction): Explor }; } - if (toggleLogsVolumeAction.match(action)) { + if (setLogsVolumeEnabledAction.match(action)) { const { enabled } = action.payload; if (state.logsVolumeDataSubscription) { state.logsVolumeDataSubscription.unsubscribe();