Commit cee2e478 by Dominik Prokop

Do not read store state from toggle panelaction creator

parent 14bf960b
......@@ -25,7 +25,7 @@ interface GraphContainerProps {
export class GraphContainer extends PureComponent<GraphContainerProps> {
onClickGraphButton = () => {
this.props.toggleGraph(this.props.exploreId);
this.props.toggleGraph(this.props.exploreId, this.props.showingGraph);
};
onChangeTime = (timeRange: TimeRange) => {
......
......@@ -32,7 +32,7 @@ interface LogsContainerProps {
export class LogsContainer extends PureComponent<LogsContainerProps> {
onClickLogsButton = () => {
this.props.toggleLogs(this.props.exploreId);
this.props.toggleLogs(this.props.exploreId, this.props.showingLogs);
};
handleDedupStrategyChange = (dedupStrategy: LogsDedupStrategy) => {
......
......@@ -21,7 +21,7 @@ interface TableContainerProps {
export class TableContainer extends PureComponent<TableContainerProps> {
onClickTableButton = () => {
this.props.toggleTable(this.props.exploreId);
this.props.toggleTable(this.props.exploreId, this.props.showingTable);
};
render() {
......
......@@ -714,25 +714,20 @@ const togglePanelActionCreator = (
| ActionCreator<ToggleGraphPayload>
| ActionCreator<ToggleLogsPayload>
| ActionCreator<ToggleTablePayload>
) => (exploreId: ExploreId) => {
return (dispatch, getState) => {
let shouldRunQueries, uiFragmentStateUpdate: Partial<ExploreUIState>;
) => (exploreId: ExploreId, isPanelVisible: boolean) => {
return (dispatch) => {
let uiFragmentStateUpdate: Partial<ExploreUIState>;
const shouldRunQueries = !isPanelVisible;
switch (actionCreator.type) {
case toggleGraphAction.type:
const isShowingGraph = getState().explore[exploreId].showingGraph;
shouldRunQueries = !isShowingGraph;
uiFragmentStateUpdate = { showingGraph: !isShowingGraph };
uiFragmentStateUpdate = { showingGraph: !isPanelVisible };
break;
case toggleLogsAction.type:
const isShowingLogs = getState().explore[exploreId].showingLogs;
shouldRunQueries = !isShowingLogs;
uiFragmentStateUpdate = { showingLogs: !isShowingLogs };
uiFragmentStateUpdate = { showingLogs: !isPanelVisible };
break;
case toggleTableAction.type:
const isShowingTable = getState().explore[exploreId].showingTable;
shouldRunQueries = !isShowingTable;
uiFragmentStateUpdate = { showingTable: !isShowingTable };
uiFragmentStateUpdate = { showingTable: !isPanelVisible };
break;
}
......@@ -768,3 +763,12 @@ export const changeDedupStrategy = (exploreId, dedupStrategy: LogsDedupStrategy)
dispatch(updateExploreUIState(exploreId, { dedupStrategy }));
};
};
/**
* Change logs deduplication strategy and update URL.
*/
export const hiddenLogLe = (exploreId, dedupStrategy: LogsDedupStrategy) => {
return dispatch => {
dispatch(updateExploreUIState(exploreId, { dedupStrategy }));
};
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment