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