mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-27 09:55:36 +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,
|
key,
|
||||||
'',
|
'',
|
||||||
JSON.stringify(combinedQueryFilter),
|
JSON.stringify(combinedQueryFilter),
|
||||||
independent
|
independent,
|
||||||
|
showDeleted
|
||||||
),
|
),
|
||||||
key === TIER_FQN_KEY
|
key === TIER_FQN_KEY
|
||||||
? getTags({ parent: 'Tier', limit: 50 })
|
? getTags({ parent: 'Tier', limit: 50 })
|
||||||
@ -159,7 +160,8 @@ const ExploreQuickFilters: FC<ExploreQuickFiltersProps> = ({
|
|||||||
key,
|
key,
|
||||||
value,
|
value,
|
||||||
JSON.stringify(combinedQueryFilter),
|
JSON.stringify(combinedQueryFilter),
|
||||||
independent
|
independent,
|
||||||
|
showDeleted
|
||||||
);
|
);
|
||||||
|
|
||||||
const buckets = res.data.aggregations[`sterms#${key}`].buckets;
|
const buckets = res.data.aggregations[`sterms#${key}`].buckets;
|
||||||
|
@ -168,7 +168,8 @@ export const getAggregateFieldOptions = (
|
|||||||
field: string,
|
field: string,
|
||||||
value: string,
|
value: string,
|
||||||
q: string,
|
q: string,
|
||||||
sourceFields?: string
|
sourceFields?: string,
|
||||||
|
deleted = false
|
||||||
) => {
|
) => {
|
||||||
const withWildCardValue = value
|
const withWildCardValue = value
|
||||||
? `.*${escapeESReservedCharacters(value)}.*`
|
? `.*${escapeESReservedCharacters(value)}.*`
|
||||||
@ -179,6 +180,7 @@ export const getAggregateFieldOptions = (
|
|||||||
value: withWildCardValue,
|
value: withWildCardValue,
|
||||||
q,
|
q,
|
||||||
sourceFields,
|
sourceFields,
|
||||||
|
deleted,
|
||||||
};
|
};
|
||||||
|
|
||||||
return APIClient.get<SearchResponse<ExploreSearchIndex>>(
|
return APIClient.get<SearchResponse<ExploreSearchIndex>>(
|
||||||
|
@ -200,41 +200,6 @@ export const extractTermKeys = (objects: QueryFieldInterface[]): string[] => {
|
|||||||
return termKeys;
|
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[]) => {
|
export const getExploreQueryFilterMust = (data: ExploreQuickFilterField[]) => {
|
||||||
const must = [] as Array<QueryFieldInterface>;
|
const must = [] as Array<QueryFieldInterface>;
|
||||||
|
|
||||||
@ -281,6 +246,41 @@ export const getExploreQueryFilterMust = (data: ExploreQuickFilterField[]) => {
|
|||||||
return must;
|
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 = (
|
export const updateTreeData = (
|
||||||
list: ExploreTreeNode[],
|
list: ExploreTreeNode[],
|
||||||
key: React.Key,
|
key: React.Key,
|
||||||
@ -360,11 +360,12 @@ export const getAggregationOptions = async (
|
|||||||
key: string,
|
key: string,
|
||||||
value: string,
|
value: string,
|
||||||
filter: string,
|
filter: string,
|
||||||
isIndependent: boolean
|
isIndependent: boolean,
|
||||||
|
deleted = false
|
||||||
) => {
|
) => {
|
||||||
return isIndependent
|
return isIndependent
|
||||||
? postAggregateFieldOptions(index, key, value, filter)
|
? postAggregateFieldOptions(index, key, value, filter)
|
||||||
: getAggregateFieldOptions(index, key, value, filter);
|
: getAggregateFieldOptions(index, key, value, filter, undefined, deleted);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const updateTreeDataWithCounts = (
|
export const updateTreeDataWithCounts = (
|
||||||
@ -412,7 +413,7 @@ export const isElasticsearchError = (error: unknown): boolean => {
|
|||||||
return false;
|
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;
|
const message = data.message as string;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user