Skip to content

Commit

Permalink
chore: always get dashboard_id on dashboard API get endpoint (#20894)
Browse files Browse the repository at this point in the history
* chore: always get dashboard_id on dashboard API get endpoint

* lint

* pylint

* fix pylint

* lint
  • Loading branch information
Lily Kuang authored Aug 4, 2022
1 parent e4fc556 commit c33af83
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions superset/dashboards/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,14 @@ def __repr__(self) -> str:
@protect()
@safe
@statsd_metrics
@event_logger.log_this_with_context(
action=lambda self, *args, **kwargs: f"{self.__class__.__name__}.get",
log_to_statsd=False,
)
@with_dashboard
# pylint: disable=arguments-renamed, arguments-differ
def get(self, dash: Dashboard) -> Response:
@event_logger.log_this_with_extra_payload
# pylint: disable=arguments-differ
def get(
self,
dash: Dashboard,
add_extra_log_payload: Callable[..., None] = lambda **kwargs: None,
) -> Response:
"""Gets a dashboard
---
get:
Expand Down Expand Up @@ -323,6 +324,9 @@ def get(self, dash: Dashboard) -> Response:
$ref: '#/components/responses/404'
"""
result = self.dashboard_get_response_schema.dump(dash)
add_extra_log_payload(
dashboard_id=dash.id, action=f"{self.__class__.__name__}.get"
)
return self.response(200, result=result)

@etag_cache(
Expand Down

0 comments on commit c33af83

Please sign in to comment.