looker-open-source / embed-sdk

The Looker browser embedding SDK
MIT License
72 stars 47 forks source link

"hide_filter" property in withParams method on embed builder only hides one filter #159

Open nuwen opened 1 year ago

nuwen commented 1 year ago

Hello

I have have an embedded dashboard using createDashboardWithId that has many filters, but I need to hide a few specific filters from the dashboard.

I am trying to hide the filters "Date selector" and "Date filter", code example below.

const options = {
  hide_filter: "Date selector"
}

const db = LookerEmbedSDK.createDashboardWithId("123")
  .withParams(options)
  .withNext('') 
  .appendTo(el)
  .build()
  .connect()
  .then((d) => {
    setupDashboard(d);
   })

I have tried

const options = {
  hide_filter: "Date selector",
  hide_filter: "Date filter"
}

Ends up only hiding "Date filter", because it does not allow repeat properties

const options = {
  hide_filter: "Date selector,Date filter",
}

Does not work, results in showing both filters

const options = {
  hide_filter: ["Date selector","Date filter"],
}

Obviously doesn't work because it expects a string.

Thanks for looking!

Link to hide_filter docs https://cloud.google.com/looker/docs/filters-user-defined-dashboards#hiding_dashboard_filters

asdub commented 1 year ago

@nuwen - Did you ever figure this one out?

praveenkumar-bidgely commented 11 months ago

Hi @bryans99 , Can you please look into this issue and help with some workaround or solution? Is there any way to prioritise this bug? It would be great help.

eino commented 10 months ago

Hello, this would be really helpful indeed.

And it should be doable as it's possible when embedding without the SDK. Do you think I could propose a PR @bryans99?

eino commented 8 months ago

Hello, I opened PR #177 to fix it, I hope it will suit

brunouber commented 2 months ago

PR #177 (released in @looker/embed-sdk@1.8.6) fixes the signature of withParams, and now we are allowed to pass a list of string:

.withParams({ hide_filter: ["filter_1", "filter_2"] })

but even with this change looker only hide one filter: the last one in the array.

Given how the parameters are stringified here

https://github.com/looker-open-source/embed-sdk/blob/23e6ab9650c5e3b045cfda57ad7e16def0b093ec/src/embed_builder.ts#L50

It seems to me the server can't handle querystring with repeated parameters ?hide_filter=filter1&hide_filter=filter2.

lambdamusic commented 2 months ago

@nuwen did you get a chance to test the new release of withParams ?

As @brunouber mentioned, this is still not usable cause the Looker back end does not handle the multiple parameters at all - or at least so it seems...

Wonder if anybody has a workaround for this or who to ping to get some feedback.. :-)