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

fix(thumbnails): missing field, logging and new config var #10562

Merged
merged 7 commits into from
Aug 14, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 27 additions & 26 deletions superset/charts/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,57 +86,58 @@ class ChartRestApi(BaseSupersetModelRestApi):
}
class_permission_name = "SliceModelView"
show_columns = [
"slice_name",
"cache_timeout",
"dashboards.dashboard_title",
"dashboards.id",
"description",
"owners.id",
"owners.username",
"owners.first_name",
"owners.id",
"owners.last_name",
"dashboards.id",
"dashboards.dashboard_title",
"viz_type",
"owners.username",
"params",
"cache_timeout",
"slice_name",
"viz_type",
]
show_select_columns = show_columns + ["table.id"]
list_columns = [
"id",
"slice_name",
"url",
"description",
"changed_by_name",
"changed_by_url",
"cache_timeout",
"changed_by.first_name",
"changed_by.last_name",
"changed_on_utc",
"changed_by_name",
"changed_by_url",
"changed_on_delta_humanized",
"changed_on_utc",
"datasource_id",
"datasource_type",
"datasource_name_text",
"datasource_type",
"datasource_url",
"description",
"id",
"params",
"slice_name",
"table.default_endpoint",
"table.table_name",
"thumbnail_url",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorted and added a new field thumbnail_url

"url",
"viz_type",
"params",
"cache_timeout",
]
list_select_columns = list_columns + ["changed_on", "changed_by_fk"]
list_select_columns = list_columns + ["changed_by_fk", "changed_on"]
order_columns = [
"slice_name",
"viz_type",
"datasource_name",
"changed_by.first_name",
"changed_on_delta_humanized",
]
search_columns = (
"datasource_name",
"slice_name",
"description",
"viz_type",
"datasource_name",
]
search_columns = [
"datasource_id",
"datasource_name",
"datasource_type",
"description",
"owners",
)
"slice_name",
"viz_type",
]
base_order = ("changed_on", "desc")
base_filters = [["id", ChartFilter, lambda: []]]
search_filters = {"slice_name": [ChartNameOrDescriptionFilter]}
Expand Down
2 changes: 2 additions & 0 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,8 @@ class CeleryConfig: # pylint: disable=too-few-public-methods

# Any config options to be passed as-is to the webdriver
WEBDRIVER_CONFIGURATION: Dict[Any, Any] = {}
# The webdriver to use supports "chrome" and "firefox"
WEBDRIVER_TYPE = "firefox"
Copy link
Member

@bkyryliuk bkyryliuk Aug 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use EMAIL_REPORTS_WEBDRIVER or just converge those 2
easy solution would be:

WEBDRIVER_TYPE = EMAIL_REPORTS_WEBDRIVER

or

EMAIL_REPORTS_WEBDRIVER = WEBDRIVER_TYPE

Copy link
Member Author

@dpgaspar dpgaspar Aug 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe took it too far, but I actually removed it now. Tell me if it's ok by you @bkyryliuk


# The base URL to query for accessing the user interface
WEBDRIVER_BASEURL = "http://0.0.0.0:8080/"
Expand Down
2 changes: 1 addition & 1 deletion superset/tasks/thumbnails.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def cache_chart_thumbnail(
if not thumbnail_cache:
logger.warning("No cache set, refusing to compute")
return None
logging.info("Caching chart at {url}")
logger.info("Caching chart: %s", url)
screenshot = ChartScreenshot(url, digest)
user = security_manager.find_user(current_app.config["THUMBNAIL_SELENIUM_USER"])
screenshot.compute_and_cache(
Expand Down
2 changes: 1 addition & 1 deletion superset/utils/screenshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def get_screenshot(


class BaseScreenshot:
driver_type = current_app.config.get("EMAIL_REPORTS_WEBDRIVER", "chrome")
driver_type = current_app.config["WEBDRIVER_TYPE"]
thumbnail_type: str = ""
element: str = ""
window_size: WindowSize = (800, 600)
Expand Down