Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 of 3 tasks
tanmaykansara opened this issue Jan 23, 2024 · 12 comments
Open
1 of 3 tasks

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

tanmaykansara opened this issue Jan 23, 2024 · 12 comments
Assignees
Labels
validation:required A committer should validate the issue

Comments

@tanmaykansara
Copy link

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

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
@jayakrishnankk
Copy link
Contributor

#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
Copy link
Author

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

@jayakrishnankk
Copy link
Contributor

tagging @villebro original PR creator

@rusackas
Copy link
Member

@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 rusackas added the validation:required A committer should validate the issue label May 31, 2024
@rusackas
Copy link
Member

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
Copy link
Member

sfirke commented May 31, 2024

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
Copy link

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
Copy link
Author

+1

@Vitor-Avila
Copy link
Contributor

@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
Copy link
Member

rusackas commented Jun 3, 2024

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
Copy link

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
Copy link
Member

rusackas commented Jun 5, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
validation:required A committer should validate the issue
Projects
None yet
Development

No branches or pull requests

7 participants