mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-14 20:26:53 +00:00
fix(web) fallback to search to get count (#13556)
This commit is contained in:
parent
4f41832ca8
commit
bf174e47e7
@ -78,7 +78,7 @@ export default function IngestedAssets({ id, executionResult }: Props) {
|
||||
// First thing to do is to search for all assets with the id as the run id!
|
||||
// Execute search
|
||||
const { data, loading, error } = useGetSearchResultsForMultipleQuery({
|
||||
skip: totalEntitiesIngested === null || entitiesIngestedByTypeFromReport === null,
|
||||
skip: typeof totalEntitiesIngested === 'number' && !!entitiesIngestedByTypeFromReport?.length,
|
||||
variables: {
|
||||
input: {
|
||||
query: '*',
|
||||
|
@ -91,7 +91,7 @@ describe('getEntitiesIngestedByType', () => {
|
||||
};
|
||||
|
||||
const result = getEntitiesIngestedByType(mockExecutionRequestResult(structuredReport));
|
||||
expect(result).toEqual([]);
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
test('handles aspects with non-numeric values', () => {
|
||||
|
@ -352,6 +352,10 @@ export const getEntitiesIngestedByType = (result: Partial<ExecutionRequestResult
|
||||
entitiesIngestedByType[entityName] = Math.max(...(Object.values(aspects as object) as number[]));
|
||||
});
|
||||
|
||||
if (Object.keys(entitiesIngestedByType).length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Object.entries(entitiesIngestedByType).map(([entityName, count]) => ({
|
||||
count,
|
||||
displayName: entityName,
|
||||
|
@ -78,7 +78,7 @@ export default function IngestedAssets({ id, executionResult }: Props) {
|
||||
// First thing to do is to search for all assets with the id as the run id!
|
||||
// Execute search
|
||||
const { data, loading, error } = useGetSearchResultsForMultipleQuery({
|
||||
skip: totalEntitiesIngested === null || entitiesIngestedByTypeFromReport === null,
|
||||
skip: typeof totalEntitiesIngested === 'number' && !!entitiesIngestedByTypeFromReport?.length,
|
||||
variables: {
|
||||
input: {
|
||||
query: '*',
|
||||
|
@ -91,7 +91,7 @@ describe('getEntitiesIngestedByType', () => {
|
||||
};
|
||||
|
||||
const result = getEntitiesIngestedByType(mockExecutionRequestResult(structuredReport));
|
||||
expect(result).toEqual([]);
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
test('handles aspects with non-numeric values', () => {
|
||||
|
@ -343,6 +343,10 @@ export const getEntitiesIngestedByType = (result: Partial<ExecutionRequestResult
|
||||
entitiesIngestedByType[entityName] = Math.max(...(Object.values(aspects as object) as number[]));
|
||||
});
|
||||
|
||||
if (Object.keys(entitiesIngestedByType).length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Object.entries(entitiesIngestedByType).map(([entityName, count]) => ({
|
||||
count,
|
||||
displayName: entityName,
|
||||
|
Loading…
x
Reference in New Issue
Block a user