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: dashboard endpoint sig changed #10220

Merged
merged 4 commits into from Jul 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion superset/cli.py
Expand Up @@ -530,7 +530,7 @@ def compute_generic_thumbnail(
"Superset.slice", slice_id=model.id, standalone="true"
)
else:
url = get_url_path("Superset.dashboard", dashboard_id=model.id)
url = get_url_path("Superset.dashboard", dashboard_id_or_slug=model.id)
func(url, model.digest, force=force)

if not charts_only:
Expand Down
4 changes: 3 additions & 1 deletion superset/dashboards/api.py
Expand Up @@ -510,7 +510,9 @@ def thumbnail(
if not dashboard:
return self.response_404()

dashboard_url = get_url_path("Superset.dashboard", dashboard_id=dashboard.id)
dashboard_url = get_url_path(
"Superset.dashboard", dashboard_id_or_slug=dashboard.id
)
# If force, request a screenshot from the workers
if kwargs["rison"].get("force", False):
cache_dashboard_thumbnail.delay(dashboard_url, dashboard.digest, force=True)
Expand Down
2 changes: 1 addition & 1 deletion superset/models/dashboard.py
Expand Up @@ -481,7 +481,7 @@ def export_dashboards( # pylint: disable=too-many-locals
def event_after_dashboard_changed( # pylint: disable=unused-argument
mapper: Mapper, connection: Connection, target: Dashboard
) -> None:
url = get_url_path("Superset.dashboard", dashboard_id=target.id)
url = get_url_path("Superset.dashboard", dashboard_id_or_slug=target.id)
cache_dashboard_thumbnail.delay(url, target.digest, force=True)


Expand Down
7 changes: 4 additions & 3 deletions tests/dashboard_tests.py
Expand Up @@ -20,17 +20,15 @@
import unittest
from random import random

from flask import escape
from flask import escape, url_for
from sqlalchemy import func
from typing import Dict

import tests.test_app
from superset import db, security_manager
from superset.connectors.sqla.models import SqlaTable
from superset.models import core as models
from superset.models.dashboard import Dashboard
from superset.models.slice import Slice
from superset.views import core as views

from .base_tests import SupersetTestCase

Expand All @@ -57,6 +55,9 @@ def test_dashboard(self):
for title, url in urls.items():
assert escape(title) in self.client.get(url).data.decode("utf-8")

def test_superset_dashboard_url(self):
url_for("Superset.dashboard", dashboard_id_or_slug=1)

def test_new_dashboard(self):
self.login(username="admin")
dash_count_before = db.session.query(func.count(Dashboard.id)).first()[0]
Expand Down