mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2026-01-08 13:36:32 +00:00
This commit is contained in:
parent
4e633877b3
commit
cc5128fcb3
@ -58,11 +58,13 @@ describe('Recently viwed data assets', () => {
|
||||
interceptURL(
|
||||
'GET',
|
||||
'/api/v1/feed?type=Announcement&activeAnnouncement=true',
|
||||
'getAnnoucemenets'
|
||||
'getAnnouncements'
|
||||
);
|
||||
interceptURL('GET', '/api/v1/users/*?fields=owns', 'ownerDetails');
|
||||
|
||||
cy.clickOnLogo();
|
||||
verifyResponseStatusCode('@getAnnoucemenets', 200);
|
||||
verifyResponseStatusCode('@ownerDetails', 200);
|
||||
verifyResponseStatusCode('@getAnnouncements', 200);
|
||||
|
||||
cy.get(
|
||||
`[data-testid="recently-viewed-container"] [title="${entity.displayName}"]`
|
||||
|
||||
@ -118,4 +118,12 @@ describe('EditTestCaseModal Component', () => {
|
||||
|
||||
expect(mockProps.onUpdate).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('displayName should be visible in input field', async () => {
|
||||
render(<EditTestCaseModal {...mockProps} />);
|
||||
const displayName = await screen.findByLabelText('label.display-name');
|
||||
|
||||
expect(displayName).toBeInTheDocument();
|
||||
expect(displayName).toHaveValue(MOCK_TEST_CASE[0].displayName);
|
||||
});
|
||||
});
|
||||
|
||||
@ -173,6 +173,7 @@ const EditTestCaseModal: React.FC<EditTestCaseModalProps> = ({
|
||||
form.setFieldsValue({
|
||||
name: testCase?.name,
|
||||
testDefinition: testCase?.testDefinition?.name,
|
||||
displayName: testCase?.displayName,
|
||||
params: getParamsValue(),
|
||||
table: getNameFromFQN(tableFqn),
|
||||
column: getNameFromFQN(
|
||||
|
||||
@ -344,6 +344,7 @@ export const MOCK_TEST_CASE = [
|
||||
{
|
||||
id: '5f83c798-91ac-4289-aeb0-99ef372e7e96',
|
||||
name: 'column_values_to_match_regex',
|
||||
displayName: 'column values to match regex',
|
||||
fullyQualifiedName:
|
||||
'sample_data.ecommerce_db.shopify.dim_address.last_name.column_values_to_match_regex',
|
||||
description: 'test value of a column match regex',
|
||||
|
||||
@ -116,9 +116,13 @@ const KPIList = ({ viewKPIPermission }: { viewKPIPermission: boolean }) => {
|
||||
title: t('label.target'),
|
||||
dataIndex: 'targetDefinition',
|
||||
key: 'targetDefinition',
|
||||
render: (targetDefinition: Kpi['targetDefinition']) => {
|
||||
render: (targetDefinition: Kpi['targetDefinition'], record: Kpi) => {
|
||||
const isPercentageMetric =
|
||||
record.metricType === KpiTargetType.Percentage;
|
||||
const targetValue = targetDefinition?.length
|
||||
? `${+targetDefinition[0].value * 100}%`
|
||||
? isPercentageMetric
|
||||
? `${+targetDefinition[0].value * 100}%`
|
||||
: targetDefinition[0].value
|
||||
: '-';
|
||||
|
||||
return <Typography.Text>{targetValue}</Typography.Text>;
|
||||
@ -242,9 +246,9 @@ const KPIList = ({ viewKPIPermission }: { viewKPIPermission: boolean }) => {
|
||||
<DeleteWidgetModal
|
||||
afterDeleteAction={handleAfterDeleteAction}
|
||||
allowSoftDelete={false}
|
||||
deleteMessage={`Are you sure you want to delete ${getEntityName(
|
||||
selectedKpi
|
||||
)}`}
|
||||
deleteMessage={t('message.are-you-sure-delete-entity', {
|
||||
entity: getEntityName(selectedKpi),
|
||||
})}
|
||||
entityId={selectedKpi.id}
|
||||
entityName={getEntityName(selectedKpi)}
|
||||
entityType={EntityType.KPI}
|
||||
|
||||
@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright 2023 Collate.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { DataInsightChartType } from 'generated/dataInsight/dataInsightChartResult';
|
||||
import { getGraphDataByEntityType } from './DataInsightUtils';
|
||||
const mockEntityDescriptionData = [
|
||||
{
|
||||
timestamp: 1693872000000,
|
||||
entityType: 'Table',
|
||||
completedDescriptionFraction: 0.11,
|
||||
completedDescription: 11,
|
||||
entityCount: 100,
|
||||
},
|
||||
];
|
||||
const mockServiceDescriptionData = [
|
||||
{
|
||||
timestamp: 1693872000000,
|
||||
serviceName: 'mySQL',
|
||||
hasOwnerFraction: 0.056179775280898875,
|
||||
hasOwner: 5,
|
||||
entityCount: 89,
|
||||
},
|
||||
];
|
||||
|
||||
const mockEntityOwnerData = [
|
||||
{
|
||||
timestamp: 1693872000000,
|
||||
entityType: 'Table',
|
||||
hasOwnerFraction: 0.08,
|
||||
hasOwner: 8,
|
||||
entityCount: 100,
|
||||
},
|
||||
];
|
||||
const mockServiceOwnerData = [
|
||||
{
|
||||
timestamp: 1693872000000,
|
||||
serviceName: 'mySQL',
|
||||
hasOwnerFraction: 0.056179775280898875,
|
||||
hasOwner: 5,
|
||||
entityCount: 89,
|
||||
},
|
||||
];
|
||||
|
||||
describe('DataInsightUtils', () => {
|
||||
it('getGraphDataByEntityType fn should provide result for entity type graph', () => {
|
||||
const entityDescription = getGraphDataByEntityType(
|
||||
mockEntityDescriptionData,
|
||||
DataInsightChartType.PercentageOfEntitiesWithDescriptionByType
|
||||
);
|
||||
const entityOwner = getGraphDataByEntityType(
|
||||
mockEntityOwnerData,
|
||||
DataInsightChartType.PercentageOfEntitiesWithOwnerByType
|
||||
);
|
||||
|
||||
expect(entityDescription).toStrictEqual({
|
||||
data: [
|
||||
{
|
||||
Table: 11,
|
||||
timestamp: 'Sep 05',
|
||||
timestampValue: 1693872000000,
|
||||
},
|
||||
],
|
||||
entities: ['Table'],
|
||||
isPercentageGraph: true,
|
||||
latestData: {
|
||||
Table: 11,
|
||||
timestamp: 'Sep 05',
|
||||
timestampValue: 1693872000000,
|
||||
},
|
||||
relativePercentage: 0,
|
||||
total: '11.00',
|
||||
});
|
||||
expect(entityOwner).toStrictEqual({
|
||||
data: [
|
||||
{
|
||||
Table: 8,
|
||||
timestamp: 'Sep 05',
|
||||
timestampValue: 1693872000000,
|
||||
},
|
||||
],
|
||||
entities: ['Table'],
|
||||
isPercentageGraph: true,
|
||||
latestData: {
|
||||
Table: 8,
|
||||
timestamp: 'Sep 05',
|
||||
timestampValue: 1693872000000,
|
||||
},
|
||||
relativePercentage: 0,
|
||||
total: '8.00',
|
||||
});
|
||||
});
|
||||
|
||||
it('getGraphDataByEntityType fn should provide result for service type graph', () => {
|
||||
const serviceDescription = getGraphDataByEntityType(
|
||||
mockServiceDescriptionData,
|
||||
DataInsightChartType.PercentageOfServicesWithDescription
|
||||
);
|
||||
const serviceOwner = getGraphDataByEntityType(
|
||||
mockServiceOwnerData,
|
||||
DataInsightChartType.PercentageOfServicesWithOwner
|
||||
);
|
||||
|
||||
expect(serviceDescription).toStrictEqual({
|
||||
data: [
|
||||
{
|
||||
mySQL: 0,
|
||||
timestamp: 'Sep 05',
|
||||
timestampValue: 1693872000000,
|
||||
},
|
||||
],
|
||||
entities: ['mySQL'],
|
||||
isPercentageGraph: true,
|
||||
latestData: {
|
||||
mySQL: 0,
|
||||
timestamp: 'Sep 05',
|
||||
timestampValue: 1693872000000,
|
||||
},
|
||||
relativePercentage: 0,
|
||||
total: '0.00',
|
||||
});
|
||||
expect(serviceOwner).toStrictEqual({
|
||||
data: [
|
||||
{
|
||||
mySQL: 5.617977528089887,
|
||||
timestamp: 'Sep 05',
|
||||
timestampValue: 1693872000000,
|
||||
},
|
||||
],
|
||||
entities: ['mySQL'],
|
||||
isPercentageGraph: true,
|
||||
latestData: {
|
||||
mySQL: 5.617977528089887,
|
||||
timestamp: 'Sep 05',
|
||||
timestampValue: 1693872000000,
|
||||
},
|
||||
relativePercentage: 0,
|
||||
total: '5.62',
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -283,11 +283,13 @@ const getLatestPercentage = (
|
||||
});
|
||||
switch (dataInsightChartType) {
|
||||
case DataInsightChartType.PercentageOfEntitiesWithDescriptionByType:
|
||||
case DataInsightChartType.PercentageOfServicesWithDescription:
|
||||
return ((totalEntityWithDescription / totalEntityCount) * 100).toFixed(
|
||||
2
|
||||
);
|
||||
|
||||
case DataInsightChartType.PercentageOfEntitiesWithOwnerByType:
|
||||
case DataInsightChartType.PercentageOfServicesWithOwner:
|
||||
return ((totalEntityWithOwner / totalEntityCount) * 100).toFixed(2);
|
||||
|
||||
default:
|
||||
@ -339,11 +341,13 @@ const getOldestPercentage = (
|
||||
});
|
||||
switch (dataInsightChartType) {
|
||||
case DataInsightChartType.PercentageOfEntitiesWithDescriptionByType:
|
||||
case DataInsightChartType.PercentageOfServicesWithDescription:
|
||||
return ((totalEntityWithDescription / totalEntityCount) * 100).toFixed(
|
||||
2
|
||||
);
|
||||
|
||||
case DataInsightChartType.PercentageOfEntitiesWithOwnerByType:
|
||||
case DataInsightChartType.PercentageOfServicesWithOwner:
|
||||
return ((totalEntityWithOwner / totalEntityCount) * 100).toFixed(2);
|
||||
|
||||
default:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user