-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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
Refactor the explore view #1252
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,7 +104,7 @@ def flat_form_fields(cls): | |
def reassignments(self): | ||
pass | ||
|
||
def get_url(self, for_cache_key=False, **kwargs): | ||
def get_url(self, for_cache_key=False, json_endpoint=False, **kwargs): | ||
"""Returns the URL for the viz | ||
|
||
:param for_cache_key: when getting the url as the identifier to hash | ||
|
@@ -140,8 +140,12 @@ def get_url(self, for_cache_key=False, **kwargs): | |
for item in v: | ||
od.add(key, item) | ||
|
||
base_endpoint = '/caravel/explore/' | ||
if json_endpoint: | ||
base_endpoint = '/caravel/explore_json/' | ||
|
||
href = Href( | ||
'/caravel/explore/{self.datasource.type}/' | ||
base_endpoint + '{self.datasource.type}/' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/ |
||
'{self.datasource.id}/'.format(**locals())) | ||
if for_cache_key and 'force' in od: | ||
del od['force'] | ||
|
@@ -373,7 +377,7 @@ def get_data(self): | |
|
||
@property | ||
def json_endpoint(self): | ||
return self.get_url(json="true") | ||
return self.get_url(json_endpoint=True) | ||
|
||
@property | ||
def cache_key(self): | ||
|
@@ -1261,7 +1265,6 @@ class HistogramViz(BaseViz): | |
} | ||
} | ||
|
||
|
||
def query_obj(self): | ||
"""Returns the query object for this visualization""" | ||
d = super(HistogramViz, self).query_obj() | ||
|
@@ -1272,7 +1275,6 @@ def query_obj(self): | |
d['columns'] = [numeric_column] | ||
return d | ||
|
||
|
||
def get_df(self, query_obj=None): | ||
"""Returns a pandas dataframe based on the query object""" | ||
if not query_obj: | ||
|
@@ -1289,7 +1291,6 @@ def get_df(self, query_obj=None): | |
df = df.fillna(0) | ||
return df | ||
|
||
|
||
def get_data(self): | ||
"""Returns the chart data""" | ||
df = self.get_df() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ export CARAVEL_CONFIG=tests.caravel_test_config | |
set -e | ||
caravel/bin/caravel version -v | ||
export SOLO_TEST=1 | ||
nosetests tests.core_tests:CoreTests.test_public_user_dashboard_access | ||
#nosetests tests.core_tests:CoreTests.test_slice_endpoint | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this commented out? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh this is just a little helper file to run a specific tests without re-running all the prep work (loading examples, init, ...). typically would just point it to whatever I'm iterating on at the time. I'll change it to receive an argument in the future. |
||
nosetests tests.druid_tests |
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.
should we add a schema here to the filter?
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.
risk of collisions in the context of unit tests is close to zero
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.
this code belongs to the views.py @mistercrunch
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.
oh right, I was just linting here, but we should tackle this