looker / lookerbot

Lookerbot lets you access all your Looker data from Slack! Super fun!
https://looker.com/lookerbot
MIT License
169 stars 141 forks source link

Allow user to pass multiple filters to custom slash commands / Show all filters in help menu #208

Open nikbapat opened 3 years ago

nikbapat commented 3 years ago

Before: When calling a dashboard using custom slash commands, lookerbot only allowed for the dashboard to have a single filter. Attempting to call a dashboard with multiple filters and using only one parameter would cause the parameter to be applied to both filters, even if it was only relevant to one. (see below call and resulting applied filters).

Slack: Single parameter, multiple filters

Before: Single parameter, multiple filters

Passing multiple parameters to a multi-filter dashboard would pass the literal entered string as a parameter to all filters, even if separated by a space or semicolon.

Before: Semicolon

Using a comma to separate them would lead to a logical "or" between the passed values, which was still applied to all filters. This would create an issue when filters have overlapping input spaces.

Before: Comma

After: This PR enables users to pass multiple parameters to the slack command, which will be applied to the filters one by one in the order the filters are listed. The parameters should be separated by semicolons to distinguish between filters. The comma still works as a logical "or" within a given parameter.

Slack: Semicolon and Comma, multiple filters

After: Semicolon and Comma, multiple filters

If there are fewer parameters passed than available filters, all subsequent filters will have no parameter passed (i.e. no restriction). To leave an earlier parameter blank but pass a value to a later parameter, use a semicolon to separate but do not enter a value.

Slack: Blank parameter

After: Blank parameter

The PR also makes changes to looker.ts to allow all filters to appear in the help menu in the order that parameters should be entered, with semicolons where appropriate.

After: Help Menu
nikbapat commented 3 years ago

Hi @annguy3n , would it be possible for you to review this PR when you get the chance? Thanks!

zeitgeistf commented 3 years ago

IMO, this is a great feature to have, even at my current company, we have been struggling to manually input all the filter conditions every time when someone tries to look up custom metrics from a shared dashboard that has many filters. Based on my understanding of the changes, now all of that can be simplified by using Slack command.

@wilg @annguy3n @namabile @reedloden @ronnieplooker @morganatlooker @arkarkark can you please take a look at this (or help to notify the maintainer that manages this project), really look forward to introduce this feature to my team, thanks!!

zeitgeistf commented 2 years ago

@wilg @annguy3n @namabile @reedloden @ronnieplooker @morganatlooker @arkarkark Hi team, any update on this? this is a really nice feature to have, can you please consider, thanks