mirror of https://github.com/apache/superset.git
refactor: remove unnecessary dataset queries from dashboard requests (#16110)
* refactor: remove unnecessary dataset queries from dashboard requests * fix comments
This commit is contained in:
parent
22d8d582f8
commit
85329c374e
|
@ -113,8 +113,6 @@ fetchMock.get('http://localhost/api/v1/dashboard/26', {
|
|||
published: false,
|
||||
roles: [],
|
||||
slug: null,
|
||||
table_names:
|
||||
'[examples].[covid_vaccines], [examples].[covid_vaccines], [examples].[covid_vaccines], [examples].[covid_vaccines], [examples].[covid_vaccines], [examples].[covid_vaccines], [examples].[covid_vaccines], [examples].[covid_vaccines]',
|
||||
thumbnail_url:
|
||||
'/api/v1/dashboard/26/thumbnail/b24805e98d90116da8c0974d24f5c533/',
|
||||
url: '/superset/dashboard/26/',
|
||||
|
|
|
@ -145,7 +145,6 @@ class ChartEntityResponseSchema(Schema):
|
|||
cache_timeout = fields.Integer(description=cache_timeout_description)
|
||||
changed_on = fields.String(description=changed_on_description)
|
||||
modified = fields.String()
|
||||
datasource = fields.String(description=datasource_name_description)
|
||||
description = fields.String(description=description_description)
|
||||
description_markeddown = fields.String(
|
||||
description=description_markeddown_description
|
||||
|
|
|
@ -158,7 +158,6 @@ class DashboardGetResponseSchema(Schema):
|
|||
charts = fields.List(fields.String(description=charts_description))
|
||||
owners = fields.List(fields.Nested(UserSchema))
|
||||
roles = fields.List(fields.Nested(RolesSchema))
|
||||
table_names = fields.String() # legacy nonsense
|
||||
changed_on_humanized = fields.String(data_key="changed_on_delta_humanized")
|
||||
|
||||
|
||||
|
|
|
@ -161,11 +161,6 @@ class Dashboard( # pylint: disable=too-many-instance-attributes
|
|||
def __repr__(self) -> str:
|
||||
return f"Dashboard<{self.id or self.slug}>"
|
||||
|
||||
@property
|
||||
def table_names(self) -> str:
|
||||
# pylint: disable=no-member
|
||||
return ", ".join(str(s.datasource.full_name) for s in self.slices)
|
||||
|
||||
@property
|
||||
def url(self) -> str:
|
||||
return f"/superset/dashboard/{self.slug or self.id}/"
|
||||
|
|
|
@ -39,7 +39,7 @@ class DashboardMixin: # pylint: disable=too-few-public-methods
|
|||
"json_metadata",
|
||||
"published",
|
||||
]
|
||||
show_columns = edit_columns + ["table_names", "charts"]
|
||||
show_columns = edit_columns + ["charts"]
|
||||
search_columns = ("dashboard_title", "slug", "owners", "published")
|
||||
add_columns = edit_columns
|
||||
base_order = ("changed_on", "desc")
|
||||
|
@ -87,7 +87,6 @@ class DashboardMixin: # pylint: disable=too-few-public-methods
|
|||
"position_json": _("Position JSON"),
|
||||
"css": _("CSS"),
|
||||
"json_metadata": _("JSON Metadata"),
|
||||
"table_names": _("Underlying Tables"),
|
||||
}
|
||||
|
||||
def pre_delete(self, item: "DashboardMixin") -> None: # pylint: disable=no-self-use
|
||||
|
|
|
@ -339,7 +339,6 @@ class TestDashboardApi(SupersetTestCase, ApiOwnersTestCaseMixin, InsertChartMixi
|
|||
"published": False,
|
||||
"url": "/superset/dashboard/slug1/",
|
||||
"slug": "slug1",
|
||||
"table_names": "",
|
||||
"thumbnail_url": dashboard.thumbnail_url,
|
||||
}
|
||||
data = json.loads(rv.data.decode("utf-8"))
|
||||
|
|
Loading…
Reference in New Issue