mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-07-25 18:30:00 +00:00
parent
0983ec7f1f
commit
eb7b4cd79b
@ -34,11 +34,6 @@ const FacetFilter: FunctionComponent<FacetProp> = ({
|
||||
const [showAllTags, setShowAllTags] = useState<boolean>(false);
|
||||
const [showAllServices, setShowAllServices] = useState<boolean>(false);
|
||||
const [showAllTier, setShowAllTier] = useState<boolean>(false);
|
||||
const sortAggregations = () => {
|
||||
return aggregations.sort((a, b) =>
|
||||
a.buckets.length > b.buckets.length ? 1 : -1
|
||||
);
|
||||
};
|
||||
const getLinkText = (
|
||||
length: number,
|
||||
state: boolean,
|
||||
@ -128,7 +123,7 @@ const FacetFilter: FunctionComponent<FacetProp> = ({
|
||||
|
||||
return (
|
||||
<>
|
||||
{sortAggregations().map((aggregation: AggregationType, index: number) => {
|
||||
{aggregations.map((aggregation: AggregationType, index: number) => {
|
||||
return (
|
||||
<Fragment key={index}>
|
||||
{aggregation.buckets.length > 0 ? (
|
||||
|
@ -54,6 +54,8 @@ export const tiers = [
|
||||
{ key: 'Tier.Tier5', doc_count: 0 },
|
||||
];
|
||||
|
||||
export const visibleFilters = ['service', 'tier', 'tags'];
|
||||
|
||||
export const tableSortingFields = [
|
||||
{
|
||||
name: 'Last Updated',
|
||||
|
@ -43,7 +43,7 @@ export const getBucketList = (buckets: Array<Bucket>) => {
|
||||
export const getAggrWithDefaultValue = (
|
||||
aggregations: Array<AggregationType>,
|
||||
visibleAgg: Array<string> = []
|
||||
) => {
|
||||
): Array<AggregationType> => {
|
||||
const aggregation = aggregations.find(
|
||||
(aggregation) => aggregation.title === 'Tier'
|
||||
);
|
||||
@ -55,9 +55,19 @@ export const getAggrWithDefaultValue = (
|
||||
aggregations[index].buckets = getBucketList(aggregations[index].buckets);
|
||||
}
|
||||
|
||||
return !allowedAgg.length
|
||||
const visibleAggregations = !allowedAgg.length
|
||||
? aggregations
|
||||
: aggregations.filter((item) => allowedAgg.includes(lowerCase(item.title)));
|
||||
|
||||
return allowedAgg
|
||||
.map((agg) => {
|
||||
const aggregation = visibleAggregations.find(
|
||||
(a) => lowerCase(a.title) === agg
|
||||
);
|
||||
|
||||
return aggregation;
|
||||
})
|
||||
.filter(Boolean) as Array<AggregationType>;
|
||||
};
|
||||
|
||||
export const tabsInfo = [
|
||||
|
@ -38,6 +38,7 @@ import {
|
||||
getExplorePathWithSearch,
|
||||
PAGE_SIZE,
|
||||
tableSortingFields,
|
||||
visibleFilters,
|
||||
} from '../../constants/constants';
|
||||
import { SearchIndex } from '../../enums/search.enum';
|
||||
import { usePrevious } from '../../hooks/usePrevious';
|
||||
@ -51,8 +52,6 @@ import SVGIcons from '../../utils/SvgUtils';
|
||||
import { getAggrWithDefaultValue, tabsInfo } from './explore.constants';
|
||||
import { Params } from './explore.interface';
|
||||
|
||||
const visibleFilters = ['tags', 'service', 'tier'];
|
||||
|
||||
const getQueryParam = (urlSearchQuery = ''): FilterObject => {
|
||||
const arrSearchQuery = urlSearchQuery
|
||||
? urlSearchQuery.startsWith('?')
|
||||
|
Loading…
x
Reference in New Issue
Block a user