mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-02 13:43:22 +00:00
minor: added entity type support in dq dashboard API (#18977)
This commit is contained in:
parent
5263858067
commit
83f094e286
@ -1,5 +1,3 @@
|
||||
import { TestSummary } from '../../generated/tests/testCase';
|
||||
|
||||
/*
|
||||
* Copyright 2023 Collate.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -12,6 +10,10 @@ import { TestSummary } from '../../generated/tests/testCase';
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { EntityType } from '../../enums/entity.enum';
|
||||
import { TestSummary } from '../../generated/tests/testCase';
|
||||
|
||||
export enum DataQualityPageTabs {
|
||||
TEST_SUITES = 'test-suites',
|
||||
TABLES = 'tables',
|
||||
@ -32,4 +34,5 @@ export type DataQualityDashboardChartFilters = {
|
||||
startTs?: number;
|
||||
endTs?: number;
|
||||
entityFQN?: string;
|
||||
entityType?: EntityType;
|
||||
};
|
||||
|
@ -12,6 +12,7 @@
|
||||
*/
|
||||
/* eslint-disable max-len */
|
||||
import { IncidentTimeMetricsType } from '../components/DataQuality/DataQuality.interface';
|
||||
import { EntityType } from '../enums/entity.enum';
|
||||
import { TestCaseStatus } from '../generated/tests/testCase';
|
||||
import { TestCaseResolutionStatusTypes } from '../generated/tests/testCaseResolutionStatus';
|
||||
import {
|
||||
@ -1209,5 +1210,84 @@ describe('dataQualityDashboardAPI', () => {
|
||||
'bucketName=byDay:aggType=date_histogram:field=timestamp&calendar_interval=day,bucketName=newIncidents:aggType=cardinality:field=testCase.fullyQualifiedName',
|
||||
});
|
||||
});
|
||||
|
||||
it('should call getDataQualityReport with provided entityType', async () => {
|
||||
const status = TestCaseStatus.Success;
|
||||
const filters = {
|
||||
entityType: EntityType.TABLE,
|
||||
entityFQN: 'entityFQN',
|
||||
startTs: 1729073964962,
|
||||
endTs: 1729678764965,
|
||||
};
|
||||
|
||||
await fetchTestCaseStatusMetricsByDays(status, filters);
|
||||
|
||||
expect(getDataQualityReport).toHaveBeenCalledWith({
|
||||
q: JSON.stringify({
|
||||
query: {
|
||||
bool: {
|
||||
must: [
|
||||
{ term: { testCaseStatus: status } },
|
||||
{
|
||||
range: {
|
||||
timestamp: {
|
||||
lte: filters.endTs,
|
||||
gte: filters.startTs,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
term: {
|
||||
'table.fullyQualifiedName.keyword': 'entityFQN',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
}),
|
||||
index: 'testCaseResult',
|
||||
aggregationQuery:
|
||||
'bucketName=byDay:aggType=date_histogram:field=timestamp&calendar_interval=day,bucketName=newIncidents:aggType=cardinality:field=testCase.fullyQualifiedName',
|
||||
});
|
||||
});
|
||||
|
||||
it('should call getDataQualityReport with normal entity fqn if entityType not provided', async () => {
|
||||
const status = TestCaseStatus.Success;
|
||||
const filters = {
|
||||
entityFQN: 'entityFQN',
|
||||
startTs: 1729073964962,
|
||||
endTs: 1729678764965,
|
||||
};
|
||||
|
||||
await fetchTestCaseStatusMetricsByDays(status, filters);
|
||||
|
||||
expect(getDataQualityReport).toHaveBeenCalledWith({
|
||||
q: JSON.stringify({
|
||||
query: {
|
||||
bool: {
|
||||
must: [
|
||||
{ term: { testCaseStatus: status } },
|
||||
{
|
||||
range: {
|
||||
timestamp: {
|
||||
lte: filters.endTs,
|
||||
gte: filters.startTs,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
term: {
|
||||
'testCase.entityFQN': 'entityFQN',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
}),
|
||||
index: 'testCaseResult',
|
||||
aggregationQuery:
|
||||
'bucketName=byDay:aggType=date_histogram:field=timestamp&calendar_interval=day,bucketName=newIncidents:aggType=cardinality:field=testCase.fullyQualifiedName',
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -317,7 +317,9 @@ export const fetchTestCaseStatusMetricsByDays = (
|
||||
if (filters?.entityFQN) {
|
||||
mustFilter.push({
|
||||
term: {
|
||||
'testCase.entityFQN': filters.entityFQN,
|
||||
[filters.entityType
|
||||
? `${filters.entityType}.fullyQualifiedName.keyword`
|
||||
: 'testCase.entityFQN']: filters.entityFQN,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user