fix(api): fixes perf on charts and introduces sorting by database on datasets (#10392)

This commit is contained in:
Daniel Vaz Gaspar 2020-07-23 19:19:05 +01:00 committed by GitHub
parent e0264060c3
commit 2fd37b18e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 12 deletions

View File

@ -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>;
@ -275,8 +278,7 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
},
{
Header: t('Source'),
accessor: 'database_name',
disableSortBy: true,
accessor: 'database.database_name',
size: 'lg',
},
{

View File

@ -493,10 +493,6 @@ class SqlaTable( # pylint: disable=too-many-public-methods,too-many-instance-at
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,

View File

@ -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",
@ -97,6 +97,7 @@ class DatasetRestApi(BaseSupersetModelRestApi):
"schema",
"changed_by.first_name",
"changed_on_delta_humanized",
"database.database_name",
]
show_columns = [
"database.database_name",

View File

@ -269,7 +269,7 @@ class Slice(
@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:

View File

@ -92,8 +92,7 @@ class TestDatasetApi(SupersetTestCase):
"changed_by_url",
"changed_on_delta_humanized",
"changed_on_utc",
"database_id",
"database_name",
"database",
"default_endpoint",
"explore_url",
"id",