embed-sdk icon indicating copy to clipboard operation
embed-sdk copied to clipboard

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

Open nuwen opened this issue 1 year ago • 6 comments

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

nuwen avatar May 03 '23 13:05 nuwen

@nuwen - Did you ever figure this one out?

asdub avatar Oct 03 '23 13:10 asdub

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.

praveenkumar-bidgely avatar Nov 27 '23 12:11 praveenkumar-bidgely

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 avatar Jan 09 '24 08:01 eino

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

eino avatar Feb 15 '24 13:02 eino

PR #177 (released in @looker/[email protected]) 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.

brunouber avatar Aug 26 '24 08:08 brunouber

@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.. :-)

lambdamusic avatar Sep 02 '24 15:09 lambdamusic