Skip to content

Commit

Permalink
fix(thumbnails): missing field, logging and new config var (apache#10562
Browse files Browse the repository at this point in the history
)

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

* deprecate EMAIL_REPORTS_WEBDRIVER

* fix after merge and conflicts

* fix tests

* black
  • Loading branch information
dpgaspar authored and Ofeknielsen committed Oct 5, 2020
1 parent 59132dd commit 8f01149
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 32 deletions.
2 changes: 2 additions & 0 deletions UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ assists people when migrating to a new version.

## Next

* [10562](https://github.com/apache/incubator-superset/pull/10562): EMAIL_REPORTS_WEBDRIVER is deprecated use WEBDRIVER_TYPE instead.

* [10567](https://github.com/apache/incubator-superset/pull/10567): Default WEBDRIVER_OPTION_ARGS are Chrome-specific. If you're using FF, should be `--headless` only

* [10241](https://github.com/apache/incubator-superset/pull/10241): change on Alpha role, users started to have access to "Annotation Layers", "Css Templates" and "Import Dashboards".
Expand Down
53 changes: 27 additions & 26 deletions superset/charts/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,63 +86,64 @@ 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",
"viz_type",
"url",
"params",
"cache_timeout",
"owners.id",
"owners.username",
"owners.first_name",
"owners.last_name",
]
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",
"datasource_id",
"changed_by.first_name",
"changed_on_delta_humanized",
]
search_columns = (
"datasource_id",
"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: 1 addition & 1 deletion superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ class CeleryConfig: # pylint: disable=too-few-public-methods
# chrome:
# Requires: headless chrome
# Limitations: unable to generate screenshots of elements
EMAIL_REPORTS_WEBDRIVER = "firefox"
WEBDRIVER_TYPE = "firefox"

# Window size - this will impact the rendering of the data
WEBDRIVER_WINDOW = {"dashboard": (1600, 2000), "slice": (3000, 1200)}
Expand Down
4 changes: 1 addition & 3 deletions superset/tasks/schedules.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,7 @@ def _get_url_path(view: str, user_friendly: bool = False, **kwargs: Any) -> str:


def create_webdriver() -> WebDriver:
return WebDriverProxy(driver_type=config["EMAIL_REPORTS_WEBDRIVER"]).auth(
get_reports_user()
)
return WebDriverProxy(driver_type=config["WEBDRIVER_TYPE"]).auth(get_reports_user())


def get_reports_user() -> "User":
Expand Down
2 changes: 1 addition & 1 deletion superset/tasks/thumbnails.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,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 @@ -37,7 +37,7 @@


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

0 comments on commit 8f01149

Please sign in to comment.