mirror of
https://github.com/apache/superset.git
synced 2024-09-12 08:39:45 -04:00
fix: can not correctly set force in store (#19932)
* fix: can not correctly set force in store * fix ut
This commit is contained in:
parent
7f8279b4b3
commit
24e4ab6a1f
@ -164,6 +164,14 @@ export function unsetTimeFormattedColumn(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const SET_FORCE_QUERY = 'SET_FORCE_QUERY';
|
||||||
|
export function setForceQuery(force: boolean) {
|
||||||
|
return {
|
||||||
|
type: SET_FORCE_QUERY,
|
||||||
|
force,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export const exploreActions = {
|
export const exploreActions = {
|
||||||
...toastActions,
|
...toastActions,
|
||||||
setDatasourceType,
|
setDatasourceType,
|
||||||
@ -181,6 +189,7 @@ export const exploreActions = {
|
|||||||
sliceUpdated,
|
sliceUpdated,
|
||||||
setTimeFormattedColumn,
|
setTimeFormattedColumn,
|
||||||
unsetTimeFormattedColumn,
|
unsetTimeFormattedColumn,
|
||||||
|
setForceQuery,
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ExploreActions = typeof exploreActions;
|
export type ExploreActions = typeof exploreActions;
|
||||||
|
@ -54,6 +54,7 @@ const createProps = () => ({
|
|||||||
sort_y_axis: 'alpha_asc',
|
sort_y_axis: 'alpha_asc',
|
||||||
extra_form_data: {},
|
extra_form_data: {},
|
||||||
},
|
},
|
||||||
|
queryForce: false,
|
||||||
chartStatus: 'rendered',
|
chartStatus: 'rendered',
|
||||||
onCollapseChange: jest.fn(),
|
onCollapseChange: jest.fn(),
|
||||||
queriesResponse: [
|
queriesResponse: [
|
||||||
|
@ -233,6 +233,7 @@ const TableControls = ({
|
|||||||
|
|
||||||
export const DataTablesPane = ({
|
export const DataTablesPane = ({
|
||||||
queryFormData,
|
queryFormData,
|
||||||
|
queryForce,
|
||||||
onCollapseChange,
|
onCollapseChange,
|
||||||
chartStatus,
|
chartStatus,
|
||||||
ownState,
|
ownState,
|
||||||
@ -240,6 +241,7 @@ export const DataTablesPane = ({
|
|||||||
queriesResponse,
|
queriesResponse,
|
||||||
}: {
|
}: {
|
||||||
queryFormData: Record<string, any>;
|
queryFormData: Record<string, any>;
|
||||||
|
queryForce: boolean;
|
||||||
chartStatus: string;
|
chartStatus: string;
|
||||||
ownState?: JsonObject;
|
ownState?: JsonObject;
|
||||||
onCollapseChange: (isOpen: boolean) => void;
|
onCollapseChange: (isOpen: boolean) => void;
|
||||||
@ -271,6 +273,7 @@ export const DataTablesPane = ({
|
|||||||
}));
|
}));
|
||||||
return getChartDataRequest({
|
return getChartDataRequest({
|
||||||
formData: queryFormData,
|
formData: queryFormData,
|
||||||
|
force: queryForce,
|
||||||
resultFormat: 'json',
|
resultFormat: 'json',
|
||||||
resultType,
|
resultType,
|
||||||
ownState,
|
ownState,
|
||||||
|
@ -189,6 +189,7 @@ const ExploreChartPanel = ({
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const refreshCachedQuery = useCallback(() => {
|
const refreshCachedQuery = useCallback(() => {
|
||||||
|
actions.setForceQuery(true);
|
||||||
actions.postChartFormData(
|
actions.postChartFormData(
|
||||||
formData,
|
formData,
|
||||||
true,
|
true,
|
||||||
@ -387,6 +388,7 @@ const ExploreChartPanel = ({
|
|||||||
<DataTablesPane
|
<DataTablesPane
|
||||||
ownState={ownState}
|
ownState={ownState}
|
||||||
queryFormData={queryFormData}
|
queryFormData={queryFormData}
|
||||||
|
queryForce={force}
|
||||||
onCollapseChange={onCollapseChange}
|
onCollapseChange={onCollapseChange}
|
||||||
chartStatus={chart.chartStatus}
|
chartStatus={chart.chartStatus}
|
||||||
errorMessage={errorMessage}
|
errorMessage={errorMessage}
|
||||||
|
@ -285,6 +285,7 @@ function ExploreViewContainer(props) {
|
|||||||
}, [props.actions, props.chart.id, props.timeout]);
|
}, [props.actions, props.chart.id, props.timeout]);
|
||||||
|
|
||||||
const onQuery = useCallback(() => {
|
const onQuery = useCallback(() => {
|
||||||
|
props.actions.setForceQuery(false);
|
||||||
props.actions.triggerQuery(true, props.chart.id);
|
props.actions.triggerQuery(true, props.chart.id);
|
||||||
addHistory();
|
addHistory();
|
||||||
setLastQueriedControls(props.controls);
|
setLastQueriedControls(props.controls);
|
||||||
|
@ -273,6 +273,12 @@ export default function exploreReducer(state = {}, action) {
|
|||||||
);
|
);
|
||||||
return { ...state, timeFormattedColumns: newTimeFormattedColumns };
|
return { ...state, timeFormattedColumns: newTimeFormattedColumns };
|
||||||
},
|
},
|
||||||
|
[actions.SET_FORCE_QUERY]() {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
force: action.force,
|
||||||
|
};
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (action.type in actionHandlers) {
|
if (action.type in actionHandlers) {
|
||||||
|
Loading…
Reference in New Issue
Block a user