apache / superset

Apache Superset is a Data Visualization and Data Exploration Platform
https://superset.apache.org/
Apache License 2.0
62.35k stars 13.69k forks source link

Filters.visible= false Still shows the filters on embedded iFrame #26758

Open tanmaykansara opened 9 months ago

tanmaykansara commented 9 months ago

Bug description

`dashboardUiConfig: { // dashboard UI config: hideTitle, hideTab, hideChartControls, filters.visible, filters.expanded (optional)

    filters: {
    expanded: false,
        visible: false
    }`

I am using the above mentioned dashboardUIConfig, however the filters screen is still visible. It is not expanded but still not hidden.

How to reproduce the bug

Embedd Dashboard into an iFrame

Screenshots/recordings

No response

Superset version

3.1.0

Python version

3.10

Node version

16

Browser

Chrome

Additional context

No response

Checklist

jayakrishnankk commented 8 months ago

https://github.com/apache/superset/pull/18741 The changes in this commit are not present in master or 3.x

https://github.com/apache/superset/pull/18741/files#diff-6f2c6562ff1fad0ce405b3507cddff63a25dc91c76fb8613284b9cbb241dd928R36-R38

tanmaykansara commented 8 months ago

I am not sure what the right action is, but can someone please tackle this ?

jayakrishnankk commented 8 months ago

tagging @villebro original PR creator

rusackas commented 4 months ago

@Vitor-Avila @sfirke do either of you have an embedded test/example to say whether this is still the case in the latest versions?

rusackas commented 4 months ago

Some screenshots wouldn't hurt here, either. This issue has been open/silent for a long time, so if it's still happening, it seems like a bit of an edge case. PRs would be more than welcome, but it's likely to get closed as stale if nobody is interested in picking it up.

sfirke commented 4 months ago

I can't validate whether this is the case, I only use embedded Superset via iframe. But if I understand correctly someone is saying a fix has been merged but it's not in 3.x? In which case yes, this needs to be validated that it's still a problem in 4.0.1.

pritammobisoft commented 4 months ago

This is still happening in 4.0.1

supersetEmbeddedSdk.embedDashboard({
        id: "fef29801-702f-4473-ab93-3dd159030c11",
        supersetDomain: "https://somehost.com",
        mountPoint: document.getElementById("my-superset-container"),
        fetchGuestToken: () => fetchGuestTokenFromBackend(),
        dashboardUiConfig: {
          // dashboard UI config: hideTitle, hideTab, hideChartControls, filters.visible, filters.expanded (optional)
          hideTitle: true,
          filters: {
            expanded: false,
            visible: false
          },
        },
      });
Screenshot 2024-06-02 at 9 25 49 PM

As you can see in the image the filter bar is still present even when filters.visible is sent as false.

Screenshot 2024-06-02 at 9 29 49 PM

I can see in the network tab show_filters=false is being sent to the backend but for some reason the backend is not respecting it.

tanmaykansara commented 4 months ago

+1

Vitor-Avila commented 4 months ago

@rusackas Yup, I can also reproduce the issue on my end. Not sure what would be the expectation if the dashboard has horizontal filter bar configured, tho

rusackas commented 4 months ago

Hmm... I'm guessing there's just some conditional rendering with React that's not high enough in the component tree. Have any time/interest in diagnosing? A PR would be welcomed/appreciated, as this doesn't seem to be a top-priority bug for most core committers. Thanks in advance if you can help!

pritammobisoft commented 4 months ago

Debugged this a bit today:

The root cause is this line from file: superset/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx

const showFilterBar = (crossFiltersEnabled || nativeFiltersEnabled) && !editMode;

Here if crossFiltersEnabled true, setting nativeFiltersEnabled false has no effect.

crossFiltersEnabled is declared like this:

const crossFiltersEnabled = isFeatureEnabled(
    FeatureFlag.DashboardCrossFilters,
  );

So just by disabling DashboardCrossFilters feature I could get the filters.visible to work properly.

Being very new to SuperSet I don't even know what the DashboardCrossFilters feature is :-)

If those reading this also want to disable this feature in you need to add following to your superset_config.py:

FEATURE_FLAGS = {
    "EMBEDDED_SUPERSET": True,
    "DASHBOARD_CROSS_FILTERS": False
}

But for those who need DASHBOARD_CROSS_FILTERS feature, proper handling of above flags is needed in the code.

rusackas commented 4 months ago

Nice work, detective! Indeed, there are likely cases where you don't want to show the filters bar, but DO want cross-filters enabled (FYI, that means clicking something like a wedge on a pie chart, which filters the rest of the dashboard based on what you clicked). If anyone wants to open a PR to make the conditional logic in Superset a little better and make these features work more independently of one another, it would be appreciated!