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