Skip to content

Commit

Permalink
fix(api): fixes perf on charts and introduces sorting by database on …
Browse files Browse the repository at this point in the history
…datasets (#10392)
  • Loading branch information
dpgaspar authored Jul 23, 2020
1 parent e026406 commit 2fd37b1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
8 changes: 5 additions & 3 deletions superset-frontend/src/views/datasetList/DatasetList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ type Dataset = {
changed_by_url: string;
changed_by: string;
changed_on_delta_humanized: string;
database_name: string;
database: {
id: string;
database_name: string;
};
explore_url: string;
id: number;
owners: Array<Owner>;
Expand Down Expand Up @@ -275,8 +278,7 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
},
{
Header: t('Source'),
accessor: 'database_name',
disableSortBy: true,
accessor: 'database.database_name',
size: 'lg',
},
{
Expand Down
4 changes: 0 additions & 4 deletions superset/connectors/sqla/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,6 @@ def description_markeddown(self) -> str:
def datasource_name(self) -> str:
return self.table_name

@property
def database_name(self) -> str:
return self.database.name

@classmethod
def get_datasource_by_name(
cls,
Expand Down
5 changes: 3 additions & 2 deletions superset/datasets/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ class DatasetRestApi(BaseSupersetModelRestApi):
}
list_columns = [
"id",
"database_id",
"database_name",
"database.id",
"database.database_name",
"changed_by_name",
"changed_by_url",
"changed_by.first_name",
Expand All @@ -97,6 +97,7 @@ class DatasetRestApi(BaseSupersetModelRestApi):
"schema",
"changed_by.first_name",
"changed_on_delta_humanized",
"database.database_name",
]
show_columns = [
"database.database_name",
Expand Down
2 changes: 1 addition & 1 deletion superset/models/slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def slice_link(self) -> Markup:

@property
def changed_by_url(self) -> str:
return f"/superset/profile/{self.created_by.username}" # type: ignore
return f"/superset/profile/{self.changed_by.username}" # type: ignore

@property
def icons(self) -> str:
Expand Down
3 changes: 1 addition & 2 deletions tests/datasets/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ def test_get_dataset_list(self):
"changed_by_url",
"changed_on_delta_humanized",
"changed_on_utc",
"database_id",
"database_name",
"database",
"default_endpoint",
"explore_url",
"id",
Expand Down

0 comments on commit 2fd37b1

Please sign in to comment.