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

withFilters doesn't actually set initial filter values #81

Open
joeyorlando opened this issue Jul 9, 2021 · 7 comments
Open

withFilters doesn't actually set initial filter values #81

joeyorlando opened this issue Jul 9, 2021 · 7 comments

Comments

@joeyorlando
Copy link

const embedDashboard = await LookerEmbedSDK.createDashboardWithUrl(mySignedUrl)
            .appendTo(embedContainer.current)
            .withClassName('w-full', 'h-full')
            .withFilters({ 'License Num': '12345' })
            .withNext()
            .build()
            .connect();

I was poking around the source code a bit. It look like:

  1. EmbedBuilder.withFilters sets the passed in object to `this._params
  2. EmbedBuilder.build is called, which returns an EmbedClient object),
  3. EmbedClient.connect internally calls this.createIframe (since I'm using createDashboardWithUrl), which sets up a Chatty instance. I feel like the _params should be sent into the Chatty instance here but they are not?

Using version 1.6.0

@hitpopdimestop
Copy link

On version 1.6.1 this issue is still present, filters are not updated

@fabio-looker
Copy link
Contributor

Hi @joeyorlando and @hitpopdimestop - I believe this is working as intended. The createDashboardWithUrl method accepts a signed URL, and the target embed URL which is where the filters are specified is part of this signed value, so it can't be changed (as this would invalidate the signature)

Basically, unlike createDashboardWithId, the use case for createDashboardWithUrl is to let you provide a URL which could not be constructed using the out-of-the-box URL construction logic (where withFilters is part of that standard URL construction)

I'd be curious to better understand your use case. For example, what kind of URL are you trying to pass in as the mySignedUrl value?

@fabio-looker
Copy link
Contributor

Also pinging anyone who gave this a thumbs up to possibly provide more context? @dnaport22 @fantua @charmingelle @rbob86

@bogekt
Copy link

bogekt commented Jan 25, 2022

Hi @fabio-looker. If there is a limitation in using withfilters for createDashboardWithUrl then why there is nothing about it in docs? Also, there can be done next improvements:

  • create a special type for the result of createDashboardWithUrl, which will not expose withfilters method
  • implement withfilters even for createDashboardWithUrl, which will override filters from url

@nuwen
Copy link

nuwen commented Apr 7, 2022

Hello,

Just wanted to mention that I'm using the createDashboardWithId method and it appears to behave the same as @joeyorlando described in the original post. End Date Param appears in the eventual db object under _params once the dashboard is fully loaded, however the filter is not applied.

const db = LookerEmbedSDK.createDashboardWithId(dashboardId)
  .appendTo(el)
  .withParams({
    _theme: JSON.stringify({
      show_filters_bar: false,
    }),
  })
  .withNext() // Using Dashboard next
  .withFilters(
    {
      'End Date Param': '2022/04/07',
    }
  )
  .build()
  .connect()

Using version 1.6.1

@benwilson512
Copy link

Chiming in here, we have:

    console.log(filters)
    LookerEmbedSDK.createDashboardWithId(this.getDashboardId())
      .appendTo(this.el)
      .withFilters(filters)
      .withClassName('looker-dashboard-big')
      .build()
      .connect()

And the initial filters are not being set. If we do dashboard.updateFilters(same_exact_filters) and then a run() we can see the filters set, and then the dashboard updated.

Version 1.8.1

@ninabohm
Copy link

Hi @joeyorlando and @hitpopdimestop - I believe this is working as intended. The createDashboardWithUrl method accepts a signed URL, and the target embed URL which is where the filters are specified is part of this signed value, so it can't be changed (as this would invalidate the signature)

Basically, unlike createDashboardWithId, the use case for createDashboardWithUrl is to let you provide a URL which could not be constructed using the out-of-the-box URL construction logic (where withFilters is part of that standard URL construction)

I'd be curious to better understand your use case. For example, what kind of URL are you trying to pass in as the mySignedUrl value?

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants