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

For ID based dashboard filters, provide a search widget for the target record's name #2739

Closed
salsakran opened this issue Jun 13, 2016 · 10 comments · Fixed by #4241
Closed

Comments

@salsakran
Copy link
Contributor

salsakran commented Jun 13, 2016

When a dashboard creator wires up a foreign key ID as the dimension to be filtered on, we current ask people to input the actual ID.

This is often not widely known and it would be much more useful to search for Acme Co instead of entering the company ID.

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

@salsakran salsakran added this to the 0.19.0 (tentative) milestone Jun 13, 2016
@salsakran
Copy link
Contributor Author

I believe @mazameli 's design has the UI elements spec'd already.

@mazameli
Copy link
Contributor

I couldn't find where or if I did this somewhere in Sketch previously, but this is what I was thinking. Sameer, WDYT about displaying the ID subtly on the right in the dropdown list and in the selected state? I'm thinking you could of course also search by the ID in case you happen to know it, too (e.g. if I work in Support and I'm using a category filter to look up a specific Customer ID from a support ticket), in which case the ID part of the dropdown would be bold instead.

-id widget

@tlrobinson
Copy link
Contributor

Makes sense from a UX perspective.

From an implementation standpoint I imagine the performance will depend a lot on the database, number of rows, whether an index is present on the name column, whether we want to only support starts-with or also contains, case sensitivity, etc.

@federicokeen
Copy link

Killer feature, can't wait to see it live!

@salsakran
Copy link
Contributor Author

I'd say we should start with starts-with or whatever is easiest to get out the door.

@salsakran salsakran modified the milestones: 0.20.0, 0.21.0 Oct 11, 2016
@tlrobinson
Copy link
Contributor

tlrobinson commented Oct 14, 2016

A couple things to think through:

  • What conditions need to be met for this functionality be enabled for a particular ID widget? e.x.
    • if it's wired to a PK which belongs to (or FK which points to?) a table which also has an entity name field?
    • Only on tables with fewer than a certain number of rows?
    • Only if the entity name has an index? (can we tell that?)
    • What if a widget is wired to two different PKs?
    • Can an admin disable this functionality on a per-field/table/db basis if we guess wrong?
  • Is it actual typeahead or triggered by hitting enter? There might performance implications of typeahead.
    • In particular, with typeahead we'd want to debounce/throttle requests. How long should the delay be? Minimum number of letters to search for?
    • After the first request we could cache the results and filter them down on the client.
  • It might be a good idea to implement query cancelling (Allow users to cancel a query execution at the database #2399) first so a user doesn't accidentally issue dozens of pending queries to a db? Maybe disable by default for dbs which don't support canceling queries?
  • Would there still be a way to enter a raw id?
  • This same widget could be used in the query builder for filters on PK/FKs. Should we do that?

@salsakran
Copy link
Contributor Author

What conditions need to be met for this functionality be enabled for a particular ID widget?
it's wired to a PK or FK to a table that has an entity name.
It's very unlikely the entity name will be indexed

What if a widget is wired to two different PKs?
Let's just use the first PK for now. If the user has drastically different Tables wired up they should be mostly equivalent or this is kind of a silly thing to do.

Can an admin disable this functionality?
I like the idea of having a master per-table control to "enable Smart Naming" that also affects #2657

Is it actual typeahead or triggered by hitting enter?
Let's do enter for v1. Agreed that actual typeahead on a big table would be batshit crazy performance-wise

Would there still be a way to enter a raw id?
I'd vote no.

This same widget could be used in the query builder for filters on PK/FKs. Should we do that?
If we do that, we should probably also allow raw ids. =/

An addendum, I think we should try to be smart here and cache the valid values if possible.

@vkovalskiy
Copy link

So what is the actual state of this? Can we use entity names somehow instead of IDs in those filters? I think that forcing the uses to paste IDs everytime is a pretty awkward approach...

@jornh
Copy link
Contributor

jornh commented Feb 14, 2018

@vkovalskiy if I'm not completely mistaken it looks like it's being actively worked on in PR #4241 linked to just a few lines above your comment - so still WIP ...

@mazameli
Copy link
Contributor

Yep, #4241 is coming along nicely and will be part of version 0.29 if everything goes according to plan.

@salsakran salsakran added this to the 0.29 milestone Mar 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants