-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
rd_ui: sync filters with location.search [closes #146] #253
Conversation
var once = true; | ||
|
||
function fromLocation() { | ||
var searchFilters = angular.fromJson($location.search().filters); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why JSON and not separate parameters? Separate parameters will be more user friendly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to serialize and deserialize information like
filters = {
filter1: val1,
filter2: val2
}
what do you suggest instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe prefix filter names with filter_
(so filter named country
will become filter_country
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(you need to use the filter.name sans the ::filter
part, you can use the QueryResult.getColumnNameWithoutType
function for this)
_.each(filters, function(filter) { | ||
if (filter.current) { | ||
current[filter.friendlyName] = | ||
_.isArray(filter.current) ? filter.current[0] : filter.current; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arikfr not sure about this. will probably fail for multi-filters. ideas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed will fail for multi-filters. how about serializing the array as:
serialize: ','.join(filter.current)
deserialize: filter.current.split(',')
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
obviously not bullet proof (or comma proof), but can take us very far :)
@amirnissim why taking it further and release each part of eme_services as reusable package that others can use too? or the stuff there are too specific for our needs? |
* modified: jQuery.isArray => angular.isArray | ||
* modified: jQuery.isPlainObject => angular.isObject | ||
*/ | ||
extend: function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use _.extend
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ranbena?
I think jquery's version is the only one with 'deep' extend
I reverted the PR back to pre URLService. |
@amirnissim I thought about going with JSON and then changing, but then we will have broken links. Why did you feel it was becoming "hairy"? |
why broken links? I tests with filters and multifilters and it worked (angular URLencodes the value you pass to $location.search) the util I copied to support URL params does not support arrays. adding good support is not trivial (see https://github.com/EverythingMe/redash/tree/URLService) |
I meant that when we move to friendlier implementation, these links will break. But yalla, let's deal with it then. |
rd_ui: sync filters with location.search [closes #146]
convert angle brackets in strings to html entities (re getredash#222)
closes #146