mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-26 09:22:14 +00:00
refactor: update ExploreQuickFilters and ExploreUtils to include showDeleted and deleted parameters
This commit is contained in:
parent
2b9c6afe2c
commit
d2ee0aa767
@ -94,7 +94,8 @@ const ExploreQuickFilters: FC<ExploreQuickFiltersProps> = ({
|
||||
key,
|
||||
'',
|
||||
JSON.stringify(combinedQueryFilter),
|
||||
independent
|
||||
independent,
|
||||
showDeleted
|
||||
),
|
||||
key === TIER_FQN_KEY
|
||||
? getTags({ parent: 'Tier', limit: 50 })
|
||||
@ -159,7 +160,8 @@ const ExploreQuickFilters: FC<ExploreQuickFiltersProps> = ({
|
||||
key,
|
||||
value,
|
||||
JSON.stringify(combinedQueryFilter),
|
||||
independent
|
||||
independent,
|
||||
showDeleted
|
||||
);
|
||||
|
||||
const buckets = res.data.aggregations[`sterms#${key}`].buckets;
|
||||
|
@ -168,7 +168,8 @@ export const getAggregateFieldOptions = (
|
||||
field: string,
|
||||
value: string,
|
||||
q: string,
|
||||
sourceFields?: string
|
||||
sourceFields?: string,
|
||||
deleted = false
|
||||
) => {
|
||||
const withWildCardValue = value
|
||||
? `.*${escapeESReservedCharacters(value)}.*`
|
||||
@ -179,6 +180,7 @@ export const getAggregateFieldOptions = (
|
||||
value: withWildCardValue,
|
||||
q,
|
||||
sourceFields,
|
||||
deleted,
|
||||
};
|
||||
|
||||
return APIClient.get<SearchResponse<ExploreSearchIndex>>(
|
||||
|
@ -200,41 +200,6 @@ export const extractTermKeys = (objects: QueryFieldInterface[]): string[] => {
|
||||
return termKeys;
|
||||
};
|
||||
|
||||
export const getSubLevelHierarchyKey = (
|
||||
isDatabaseHierarchy = false,
|
||||
filterField?: ExploreQuickFilterField[],
|
||||
key?: EntityFields,
|
||||
value?: string
|
||||
) => {
|
||||
const queryFilter = {
|
||||
query: { bool: {} },
|
||||
};
|
||||
|
||||
if ((key && value) || filterField) {
|
||||
(queryFilter.query.bool as EsBoolQuery).must = isUndefined(filterField)
|
||||
? { term: { [key ?? '']: value } }
|
||||
: getExploreQueryFilterMust(filterField);
|
||||
}
|
||||
|
||||
const bucketMapping = isDatabaseHierarchy
|
||||
? {
|
||||
[EntityFields.SERVICE_TYPE]: EntityFields.SERVICE,
|
||||
[EntityFields.SERVICE]: EntityFields.DATABASE_DISPLAY_NAME,
|
||||
[EntityFields.DATABASE_DISPLAY_NAME]:
|
||||
EntityFields.DATABASE_SCHEMA_DISPLAY_NAME,
|
||||
[EntityFields.DATABASE_SCHEMA_DISPLAY_NAME]: EntityFields.ENTITY_TYPE,
|
||||
}
|
||||
: {
|
||||
[EntityFields.SERVICE_TYPE]: EntityFields.SERVICE,
|
||||
[EntityFields.SERVICE]: EntityFields.ENTITY_TYPE,
|
||||
};
|
||||
|
||||
return {
|
||||
bucket: bucketMapping[key as DatabaseFields] ?? EntityFields.SERVICE_TYPE,
|
||||
queryFilter,
|
||||
};
|
||||
};
|
||||
|
||||
export const getExploreQueryFilterMust = (data: ExploreQuickFilterField[]) => {
|
||||
const must = [] as Array<QueryFieldInterface>;
|
||||
|
||||
@ -281,6 +246,41 @@ export const getExploreQueryFilterMust = (data: ExploreQuickFilterField[]) => {
|
||||
return must;
|
||||
};
|
||||
|
||||
export const getSubLevelHierarchyKey = (
|
||||
isDatabaseHierarchy = false,
|
||||
filterField?: ExploreQuickFilterField[],
|
||||
key?: EntityFields,
|
||||
value?: string
|
||||
) => {
|
||||
const queryFilter = {
|
||||
query: { bool: {} },
|
||||
};
|
||||
|
||||
if ((key && value) || filterField) {
|
||||
(queryFilter.query.bool as EsBoolQuery).must = isUndefined(filterField)
|
||||
? { term: { [key ?? '']: value } }
|
||||
: getExploreQueryFilterMust(filterField);
|
||||
}
|
||||
|
||||
const bucketMapping = isDatabaseHierarchy
|
||||
? {
|
||||
[EntityFields.SERVICE_TYPE]: EntityFields.SERVICE,
|
||||
[EntityFields.SERVICE]: EntityFields.DATABASE_DISPLAY_NAME,
|
||||
[EntityFields.DATABASE_DISPLAY_NAME]:
|
||||
EntityFields.DATABASE_SCHEMA_DISPLAY_NAME,
|
||||
[EntityFields.DATABASE_SCHEMA_DISPLAY_NAME]: EntityFields.ENTITY_TYPE,
|
||||
}
|
||||
: {
|
||||
[EntityFields.SERVICE_TYPE]: EntityFields.SERVICE,
|
||||
[EntityFields.SERVICE]: EntityFields.ENTITY_TYPE,
|
||||
};
|
||||
|
||||
return {
|
||||
bucket: bucketMapping[key as DatabaseFields] ?? EntityFields.SERVICE_TYPE,
|
||||
queryFilter,
|
||||
};
|
||||
};
|
||||
|
||||
export const updateTreeData = (
|
||||
list: ExploreTreeNode[],
|
||||
key: React.Key,
|
||||
@ -360,11 +360,12 @@ export const getAggregationOptions = async (
|
||||
key: string,
|
||||
value: string,
|
||||
filter: string,
|
||||
isIndependent: boolean
|
||||
isIndependent: boolean,
|
||||
deleted = false
|
||||
) => {
|
||||
return isIndependent
|
||||
? postAggregateFieldOptions(index, key, value, filter)
|
||||
: getAggregateFieldOptions(index, key, value, filter);
|
||||
: getAggregateFieldOptions(index, key, value, filter, undefined, deleted);
|
||||
};
|
||||
|
||||
export const updateTreeDataWithCounts = (
|
||||
@ -412,7 +413,7 @@ export const isElasticsearchError = (error: unknown): boolean => {
|
||||
return false;
|
||||
}
|
||||
|
||||
const data = axiosError.response.data as Record<string, any>;
|
||||
const data = axiosError.response.data as Record<string, unknown>;
|
||||
const message = data.message as string;
|
||||
|
||||
return (
|
||||
|
Loading…
x
Reference in New Issue
Block a user