mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-11 08:23:40 +00:00
UI : Sorted tier filters in explore Leftpanel (#10434)
* Sorted tier filters in explore leftpanel * fix unit test issue
This commit is contained in:
parent
5be1a77f94
commit
9866d355ff
@ -37,7 +37,7 @@ const aggregations: Aggregations = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
tier: {
|
'tier.tagFQN': {
|
||||||
buckets: [],
|
buckets: [],
|
||||||
},
|
},
|
||||||
'service.name.keyword': {
|
'service.name.keyword': {
|
||||||
@ -98,6 +98,10 @@ const aggregations: Aggregations = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
jest.mock('utils/EntityUtils', () => ({
|
||||||
|
getSortedTierBucketList: jest.fn().mockReturnValue([]),
|
||||||
|
}));
|
||||||
|
|
||||||
const filters = {
|
const filters = {
|
||||||
serviceType: ['BigQuery', 'Glue'],
|
serviceType: ['BigQuery', 'Glue'],
|
||||||
'service.name.keyword': ['bigquery_gcp', 'glue'],
|
'service.name.keyword': ['bigquery_gcp', 'glue'],
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import { AggregationEntry } from 'interface/search.interface';
|
|||||||
import { isEmpty, isNil } from 'lodash';
|
import { isEmpty, isNil } from 'lodash';
|
||||||
import React, { useEffect, useMemo, useState } from 'react';
|
import React, { useEffect, useMemo, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { getSortedTierBucketList } from 'utils/EntityUtils';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
compareAggregationKey,
|
compareAggregationKey,
|
||||||
@ -45,7 +46,14 @@ const FacetFilter: React.FC<FacetFilterProps> = ({
|
|||||||
*/
|
*/
|
||||||
const aggregationEntries = useMemo(() => {
|
const aggregationEntries = useMemo(() => {
|
||||||
if (isNil(filters) || isEmpty(filters)) {
|
if (isNil(filters) || isEmpty(filters)) {
|
||||||
return Object.entries(aggregations)
|
const { 'tier.tagFQN': tier, ...restProps } = aggregations;
|
||||||
|
|
||||||
|
const sortedTiersList = {
|
||||||
|
...tier,
|
||||||
|
buckets: getSortedTierBucketList(tier.buckets),
|
||||||
|
};
|
||||||
|
|
||||||
|
return Object.entries({ ...restProps, 'tier.tagFQN': sortedTiersList })
|
||||||
.filter(([, { buckets }]) => buckets.length)
|
.filter(([, { buckets }]) => buckets.length)
|
||||||
.sort(([key1], [key2]) => compareAggregationKey(key1, key2));
|
.sort(([key1], [key2]) => compareAggregationKey(key1, key2));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -582,3 +582,6 @@ export const getFrequentlyJoinedColumns = (
|
|||||||
</div>
|
</div>
|
||||||
) : null;
|
) : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getSortedTierBucketList = (buckets: Bucket[]): Bucket[] =>
|
||||||
|
buckets.sort((a, b) => Number(a.key.slice(-1)) - Number(b.key.slice(-1)));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user