mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
fix: add sort option to filters, sort chart list filter options (#11370)
This commit is contained in:
parent
ec054e1fac
commit
094359cc5b
@ -119,6 +119,7 @@ function SelectFilter({
|
|||||||
setSelectedOption(matchingOption);
|
setSelectedOption(matchingOption);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
options: result,
|
options: result,
|
||||||
hasMore,
|
hasMore,
|
||||||
|
@ -61,7 +61,8 @@ const createFetchDatasets = (handleError: (err: Response) => void) => async (
|
|||||||
const queryParams = rison.encode({
|
const queryParams = rison.encode({
|
||||||
columns: ['datasource_name', 'datasource_id'],
|
columns: ['datasource_name', 'datasource_id'],
|
||||||
keys: ['none'],
|
keys: ['none'],
|
||||||
order_by: 'datasource_name',
|
order_column: 'table_name',
|
||||||
|
order_direction: 'asc',
|
||||||
...(pageIndex ? { page: pageIndex } : {}),
|
...(pageIndex ? { page: pageIndex } : {}),
|
||||||
...(pageSize ? { page_size: pageSize } : {}),
|
...(pageSize ? { page_size: pageSize } : {}),
|
||||||
...filters,
|
...filters,
|
||||||
@ -191,6 +192,7 @@ function ChartList(props: ChartListProps) {
|
|||||||
}: any) => <a href={dsUrl}>{dsNameTxt}</a>,
|
}: any) => <a href={dsUrl}>{dsNameTxt}</a>,
|
||||||
Header: t('Dataset'),
|
Header: t('Dataset'),
|
||||||
accessor: 'datasource_id',
|
accessor: 'datasource_id',
|
||||||
|
disableSortBy: true,
|
||||||
size: 'xl',
|
size: 'xl',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -352,7 +354,21 @@ function ChartList(props: ChartListProps) {
|
|||||||
unfilteredLabel: 'All',
|
unfilteredLabel: 'All',
|
||||||
selects: getChartMetadataRegistry()
|
selects: getChartMetadataRegistry()
|
||||||
.keys()
|
.keys()
|
||||||
.map(k => ({ label: k, value: k })),
|
.map(k => ({ label: k, value: k }))
|
||||||
|
.sort((a, b) => {
|
||||||
|
if (!a.label || !b.label) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a.label > b.label) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (a.label < b.label) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: t('Dataset'),
|
Header: t('Dataset'),
|
||||||
|
Loading…
Reference in New Issue
Block a user