mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Do not read store state from toggle panelaction creator
This commit is contained in:
parent
14bf960b64
commit
cee2e4788b
@ -25,7 +25,7 @@ interface GraphContainerProps {
|
|||||||
|
|
||||||
export class GraphContainer extends PureComponent<GraphContainerProps> {
|
export class GraphContainer extends PureComponent<GraphContainerProps> {
|
||||||
onClickGraphButton = () => {
|
onClickGraphButton = () => {
|
||||||
this.props.toggleGraph(this.props.exploreId);
|
this.props.toggleGraph(this.props.exploreId, this.props.showingGraph);
|
||||||
};
|
};
|
||||||
|
|
||||||
onChangeTime = (timeRange: TimeRange) => {
|
onChangeTime = (timeRange: TimeRange) => {
|
||||||
|
@ -32,7 +32,7 @@ interface LogsContainerProps {
|
|||||||
|
|
||||||
export class LogsContainer extends PureComponent<LogsContainerProps> {
|
export class LogsContainer extends PureComponent<LogsContainerProps> {
|
||||||
onClickLogsButton = () => {
|
onClickLogsButton = () => {
|
||||||
this.props.toggleLogs(this.props.exploreId);
|
this.props.toggleLogs(this.props.exploreId, this.props.showingLogs);
|
||||||
};
|
};
|
||||||
|
|
||||||
handleDedupStrategyChange = (dedupStrategy: LogsDedupStrategy) => {
|
handleDedupStrategyChange = (dedupStrategy: LogsDedupStrategy) => {
|
||||||
|
@ -21,7 +21,7 @@ interface TableContainerProps {
|
|||||||
|
|
||||||
export class TableContainer extends PureComponent<TableContainerProps> {
|
export class TableContainer extends PureComponent<TableContainerProps> {
|
||||||
onClickTableButton = () => {
|
onClickTableButton = () => {
|
||||||
this.props.toggleTable(this.props.exploreId);
|
this.props.toggleTable(this.props.exploreId, this.props.showingTable);
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -714,25 +714,20 @@ const togglePanelActionCreator = (
|
|||||||
| ActionCreator<ToggleGraphPayload>
|
| ActionCreator<ToggleGraphPayload>
|
||||||
| ActionCreator<ToggleLogsPayload>
|
| ActionCreator<ToggleLogsPayload>
|
||||||
| ActionCreator<ToggleTablePayload>
|
| ActionCreator<ToggleTablePayload>
|
||||||
) => (exploreId: ExploreId) => {
|
) => (exploreId: ExploreId, isPanelVisible: boolean) => {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
let shouldRunQueries, uiFragmentStateUpdate: Partial<ExploreUIState>;
|
let uiFragmentStateUpdate: Partial<ExploreUIState>;
|
||||||
|
const shouldRunQueries = !isPanelVisible;
|
||||||
|
|
||||||
switch (actionCreator.type) {
|
switch (actionCreator.type) {
|
||||||
case toggleGraphAction.type:
|
case toggleGraphAction.type:
|
||||||
const isShowingGraph = getState().explore[exploreId].showingGraph;
|
uiFragmentStateUpdate = { showingGraph: !isPanelVisible };
|
||||||
shouldRunQueries = !isShowingGraph;
|
|
||||||
uiFragmentStateUpdate = { showingGraph: !isShowingGraph };
|
|
||||||
break;
|
break;
|
||||||
case toggleLogsAction.type:
|
case toggleLogsAction.type:
|
||||||
const isShowingLogs = getState().explore[exploreId].showingLogs;
|
uiFragmentStateUpdate = { showingLogs: !isPanelVisible };
|
||||||
shouldRunQueries = !isShowingLogs;
|
|
||||||
uiFragmentStateUpdate = { showingLogs: !isShowingLogs };
|
|
||||||
break;
|
break;
|
||||||
case toggleTableAction.type:
|
case toggleTableAction.type:
|
||||||
const isShowingTable = getState().explore[exploreId].showingTable;
|
uiFragmentStateUpdate = { showingTable: !isPanelVisible };
|
||||||
shouldRunQueries = !isShowingTable;
|
|
||||||
uiFragmentStateUpdate = { showingTable: !isShowingTable };
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -768,3 +763,12 @@ export const changeDedupStrategy = (exploreId, dedupStrategy: LogsDedupStrategy)
|
|||||||
dispatch(updateExploreUIState(exploreId, { dedupStrategy }));
|
dispatch(updateExploreUIState(exploreId, { dedupStrategy }));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change logs deduplication strategy and update URL.
|
||||||
|
*/
|
||||||
|
export const hiddenLogLe = (exploreId, dedupStrategy: LogsDedupStrategy) => {
|
||||||
|
return dispatch => {
|
||||||
|
dispatch(updateExploreUIState(exploreId, { dedupStrategy }));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user