Skip to content

Conversation

twolfson
Copy link
Contributor

@twolfson twolfson commented Oct 7, 2015

We at Underdog.io are loving redash for setting up internal dashboards. We have 1 minor pain point which is redash:metadata is always selected as the first data source for a new query. While we could delete the redash:metadata, it would be really kicking the can down the road and not solving the problem.

We had an idea to re-use the selection that a user had from the last time they change the data source (e.g. if I use "db-a", then I will see "db-a" selected the next time I create a new query). This PR is working solution for that. In this PR:

  • Added load/save last_selected_data_source_id in localStorage as part of dataSourceId interactions

Notes:

I am not too familiar with Angular so I wasn't sure if localStorage should be injected as a dependency. If you have any requests for how the code should be organized or about using library (e.g. ded/kizzy), please let me know.

@landscape-bot
Copy link

Code Health
Code quality remained the same when pulling d692ffd on underdogio:dev/select.last.data.source.sqwished into a15d796 on EverythingMe:master.

@arikfr
Copy link
Member

arikfr commented Oct 7, 2015

This is so great and much needed. Thanks!

Two small things:

  1. I try to use camelCasing for the frontend stuff (aside from objects that come back from the server). So let's use lastSelectedDataSourceId as the key for localStorage.
  2. It's a rare edge case, but the data source might not exist anymore so worth checking that it does (you can use _.some function for that).

@twolfson
Copy link
Contributor Author

twolfson commented Oct 7, 2015

Sure thing, taking a look at adding those now.

@twolfson twolfson force-pushed the dev/select.last.data.source.sqwished branch from d692ffd to fc44dba Compare October 7, 2015 16:43
@twolfson
Copy link
Contributor Author

twolfson commented Oct 7, 2015

Alright, the PR has been updated to use lastSelectedDataSourceId and handle non-existant data sources.

arikfr added a commit that referenced this pull request Oct 7, 2015
…qwished

Added "Select last used data source" to query view
@arikfr arikfr merged commit 515c457 into getredash:master Oct 7, 2015
@arikfr
Copy link
Member

arikfr commented Oct 7, 2015

Merged. Thanks!

@twolfson
Copy link
Contributor Author

twolfson commented Oct 7, 2015

Awesome, thanks for the quick turnaround =)

@twolfson twolfson deleted the dev/select.last.data.source.sqwished branch October 23, 2015 23:12
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

Successfully merging this pull request may close these issues.

3 participants