Skip to content

Commit 3677216

Browse files
committed
Fix slice & dashboard thumbnails async api
1 parent 3aee625 commit 3677216

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

spotrix/charts/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ def cache_screenshot(self, pk: int, **kwargs: Any) -> WerkzeugResponse:
863863
if not chart:
864864
return self.response_404()
865865

866-
chart_url = get_url_path("Superset.slice", slice_id=chart.id, standalone="true")
866+
chart_url = get_url_path("Spotrix.slice", slice_id=chart.id, standalone="true")
867867
screenshot_obj = ChartScreenshot(chart_url, chart.digest)
868868
cache_key = screenshot_obj.cache_key(window_size, thumb_size)
869869
image_url = get_url_path(
@@ -988,7 +988,7 @@ def thumbnail(self, pk: int, digest: str, **kwargs: Any) -> WerkzeugResponse:
988988
if not chart:
989989
return self.response_404()
990990

991-
url = get_url_path("Superset.slice", slice_id=chart.id, standalone="true")
991+
url = get_url_path("Spotrix.slice", slice_id=chart.id, standalone="true")
992992
if kwargs["rison"].get("force", False):
993993
logger.info(
994994
"Triggering thumbnail compute (chart id: %s) ASYNC", str(chart.id)

spotrix/dashboards/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def ensure_thumbnails_enabled(self) -> Optional[Response]:
216216

217217
def __repr__(self) -> str:
218218
"""Deterministic string representation of the API instance for etag_cache."""
219-
return "Superset.dashboards.api.DashboardRestApi@v{}{}".format(
219+
return "Spotrix.dashboards.api.DashboardRestApi@v{}{}".format(
220220
self.appbuilder.app.config["VERSION_STRING"],
221221
self.appbuilder.app.config["VERSION_SHA"],
222222
)
@@ -808,7 +808,7 @@ def thumbnail(self, pk: int, digest: str, **kwargs: Any) -> WerkzeugResponse:
808808
return self.response_404()
809809

810810
dashboard_url = get_url_path(
811-
"Superset.dashboard", dashboard_id_or_slug=dashboard.id
811+
"Spotrix.dashboard", dashboard_id_or_slug=dashboard.id
812812
)
813813
# If force, request a screenshot from the workers
814814
if kwargs["rison"].get("force", False):

spotrix/models/dashboard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ def position(self) -> Dict[str, Any]:
296296
return {}
297297

298298
def update_thumbnail(self) -> None:
299-
url = get_url_path("Superset.dashboard", dashboard_id_or_slug=self.id)
299+
url = get_url_path("Spotrix.dashboard", dashboard_id_or_slug=self.id)
300300
cache_dashboard_thumbnail.delay(url, self.digest, force=True)
301301

302302
@debounce(0.1)

spotrix/models/slice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def set_related_perm(_mapper: Mapper, _connection: Connection, target: Slice) ->
316316
def event_after_chart_changed(
317317
_mapper: Mapper, _connection: Connection, target: Slice
318318
) -> None:
319-
url = get_url_path("Superset.slice", slice_id=target.id, standalone="true")
319+
url = get_url_path("Spotrix.slice", slice_id=target.id, standalone="true")
320320
cache_chart_thumbnail.delay(url, target.digest, force=True)
321321

322322

spotrix/reports/commands/execute.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,13 @@ def _get_url(
151151
type=ChartDataResultType.POST_PROCESSED.value,
152152
)
153153
return get_url_path(
154-
"Superset.slice",
154+
"Spotrix.slice",
155155
user_friendly=user_friendly,
156156
slice_id=self._report_schedule.chart_id,
157157
**kwargs,
158158
)
159159
return get_url_path(
160-
"Superset.dashboard",
160+
"Spotrix.dashboard",
161161
user_friendly=user_friendly,
162162
dashboard_id_or_slug=self._report_schedule.dashboard_id,
163163
**kwargs,

tests/integration_tests/dashboard_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def test_dashboard(self):
129129
assert escape(title) in self.client.get(url).data.decode("utf-8")
130130

131131
def test_superset_dashboard_url(self):
132-
url_for("Superset.dashboard", dashboard_id_or_slug=1)
132+
url_for("Spotrix.dashboard", dashboard_id_or_slug=1)
133133

134134
def test_new_dashboard(self):
135135
self.login(username="admin")

tests/integration_tests/thumbnails_tests.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def test_screenshot_selenium_headstart(
7373
user = security_manager.get_user_by_username(
7474
app.config["THUMBNAIL_SELENIUM_USER"]
7575
)
76-
url = get_url_path("Superset.slice", slice_id=1, standalone="true")
76+
url = get_url_path("Spotrix.slice", slice_id=1, standalone="true")
7777
app.config["SCREENSHOT_SELENIUM_HEADSTART"] = 5
7878
webdriver.get_screenshot(url, "chart-container", user=user)
7979
assert mock_sleep.call_args_list[0] == call(5)
@@ -86,7 +86,7 @@ def test_screenshot_selenium_locate_wait(self, mock_webdriver, mock_webdriver_wa
8686
user = security_manager.get_user_by_username(
8787
app.config["THUMBNAIL_SELENIUM_USER"]
8888
)
89-
url = get_url_path("Superset.slice", slice_id=1, standalone="true")
89+
url = get_url_path("Spotrix.slice", slice_id=1, standalone="true")
9090
webdriver.get_screenshot(url, "chart-container", user=user)
9191
assert mock_webdriver_wait.call_args_list[0] == call(ANY, 15)
9292

@@ -98,7 +98,7 @@ def test_screenshot_selenium_load_wait(self, mock_webdriver, mock_webdriver_wait
9898
user = security_manager.get_user_by_username(
9999
app.config["THUMBNAIL_SELENIUM_USER"]
100100
)
101-
url = get_url_path("Superset.slice", slice_id=1, standalone="true")
101+
url = get_url_path("Spotrix.slice", slice_id=1, standalone="true")
102102
webdriver.get_screenshot(url, "chart-container", user=user)
103103
assert mock_webdriver_wait.call_args_list[1] == call(ANY, 15)
104104

@@ -112,7 +112,7 @@ def test_screenshot_selenium_animation_wait(
112112
user = security_manager.get_user_by_username(
113113
app.config["THUMBNAIL_SELENIUM_USER"]
114114
)
115-
url = get_url_path("Superset.slice", slice_id=1, standalone="true")
115+
url = get_url_path("Spotrix.slice", slice_id=1, standalone="true")
116116
app.config["SCREENSHOT_SELENIUM_ANIMATION_WAIT"] = 4
117117
webdriver.get_screenshot(url, "chart-container", user=user)
118118
assert mock_sleep.call_args_list[1] == call(4)

0 commit comments

Comments
 (0)