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

Suggestion -- Location autocomplete/suggestions #32

Open
icsy7867 opened this issue Dec 28, 2022 · 3 comments
Open

Suggestion -- Location autocomplete/suggestions #32

icsy7867 opened this issue Dec 28, 2022 · 3 comments

Comments

@icsy7867
Copy link

icsy7867 commented Dec 28, 2022

I am about to tackle a large and messy storage room. I was trying to plan out the best way to do this. The location field seems to work well, but the idea of repetitively typing in similar location strings seems repetitive and superfluous.

I think an autocomplete suggestion solution would work very well here. I have used this library in the past:
https://tarekraafat.github.io/autoComplete.js/#/

Basically pulling all of the existing locations through couch db, and adding that as an array of strings to the autocomplete library, it would make inputting a lot of items a lot easier. For example, if i have multiple initial locations, and I am reorganizing a storage closet (Lets call it Storage Closet 1), simply typing "Storage Closet 1" would give me all of the possible locations in that specific location, and one could simply click it.

I dont do a whole lot in javascript, and even I found this library stupidly easy to use, and I think it could add a lot of utility to StoreDown with very minimal modifications. For my use case, I am importing a moderately large list of users from LDAP (About 1000), and I have an email/username autocomplete. I load the entire list from an API I made and load it into the website and it is quite snappy.

Also thinking about all of these containers and Items I am about to create and go through, having a "use last location" button or maybe after making an asset having a "Add another" which defaults to the previous location could be helpful as well.

@icsy7867
Copy link
Author

icsy7867 commented Dec 30, 2022

Looking at the couchdb a quick and dirty query will work:

curl -X POST https://couchdb.domain.com/storedown/_find \
  -H "Content-Type: application/json" -u 'couch:myP@ssw0rd' \
  --data-binary @- << EOF
{
    "selector": {},
    "fields": ["location"]
}
EOF

Was looking into doing the SQL equivalent of a "DISTINCT". It looks like couchdb supports a "group=true", but it looks like you would have to create a view for this, and the "find" method doesnt support that. This would need to be queried and cleaned up to only have unique. Looks like this isnt hard to do:
https://stackoverflow.com/questions/1960473/get-all-unique-values-in-a-javascript-array-remove-duplicates

However, if you have more than 10,000 locations or so, it might take some time. But any reasonable amount of "locations" should be pretty quick.

@FoxUSA
Copy link
Owner

FoxUSA commented Dec 31, 2022

Have you seen the prefix feature? That is how I solved this for my use cases

@icsy7867
Copy link
Author

I didn't! I will take a look at this, this weekend! Thanks

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

2 participants