mirror of https://github.com/apache/superset.git
chore: Pass the dashboard id when requesting filter values (#25025)
This commit is contained in:
parent
b428b06217
commit
52c7186b56
|
@ -226,7 +226,6 @@ export async function getChartDataRequest({
|
|||
credentials: 'include',
|
||||
};
|
||||
}
|
||||
|
||||
const [useLegacyApi, parseMethod] = getQuerySettings(formData);
|
||||
if (useLegacyApi) {
|
||||
return legacyChartDataRequest(
|
||||
|
|
|
@ -101,6 +101,9 @@ const FilterValue: React.FC<FilterControlProps> = ({
|
|||
const dependencies = useFilterDependencies(id, dataMaskSelected);
|
||||
const shouldRefresh = useShouldFilterRefresh();
|
||||
const [state, setState] = useState<ChartDataResponseResult[]>([]);
|
||||
const dashboardId = useSelector<RootState, number>(
|
||||
state => state.dashboardInfo.id,
|
||||
);
|
||||
const [error, setError] = useState<ClientErrorObject>();
|
||||
const [formData, setFormData] = useState<Partial<QueryFormData>>({
|
||||
inView: false,
|
||||
|
@ -146,6 +149,7 @@ const FilterValue: React.FC<FilterControlProps> = ({
|
|||
groupby,
|
||||
adhoc_filters,
|
||||
time_range,
|
||||
dashboardId,
|
||||
});
|
||||
const filterOwnState = filter.dataMask?.ownState || {};
|
||||
// TODO: We should try to improve our useEffect hooks to depend more on
|
||||
|
@ -170,7 +174,6 @@ const FilterValue: React.FC<FilterControlProps> = ({
|
|||
getChartDataRequest({
|
||||
formData: newFormData,
|
||||
force: false,
|
||||
requestParams: { dashboardId: 0 },
|
||||
ownState: filterOwnState,
|
||||
})
|
||||
.then(({ response, json }) => {
|
||||
|
|
|
@ -354,7 +354,9 @@ const FiltersConfigForm = (
|
|||
const [activeTabKey, setActiveTabKey] = useState<string>(
|
||||
FilterTabs.configuration.key,
|
||||
);
|
||||
|
||||
const dashboardId = useSelector<RootState, number>(
|
||||
state => state.dashboardInfo.id,
|
||||
);
|
||||
const [undoFormValues, setUndoFormValues] = useState<Record<
|
||||
string,
|
||||
any
|
||||
|
@ -479,6 +481,7 @@ const FiltersConfigForm = (
|
|||
}
|
||||
const formData = getFormData({
|
||||
datasetId: formFilter?.dataset?.value,
|
||||
dashboardId,
|
||||
groupby: formFilter?.column,
|
||||
...formFilter,
|
||||
});
|
||||
|
@ -492,7 +495,6 @@ const FiltersConfigForm = (
|
|||
getChartDataRequest({
|
||||
formData,
|
||||
force,
|
||||
requestParams: { dashboardId: 0 },
|
||||
})
|
||||
.then(({ response, json }) => {
|
||||
if (isFeatureEnabled(FeatureFlag.GLOBAL_ASYNC_QUERIES)) {
|
||||
|
|
|
@ -54,7 +54,9 @@ export const getFormData = ({
|
|||
time_range,
|
||||
granularity_sqla,
|
||||
type,
|
||||
dashboardId,
|
||||
}: Partial<Filter> & {
|
||||
dashboardId: number;
|
||||
datasetId?: number;
|
||||
dependencies?: object;
|
||||
groupby?: string;
|
||||
|
@ -91,6 +93,7 @@ export const getFormData = ({
|
|||
inView: true,
|
||||
viz_type: filterType,
|
||||
type,
|
||||
dashboardId,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue