Feat(ui): Add "Metric" as an Option for Entity Reference Type Dropdown (#22272)

* added matric to entity reference

* updated tests
This commit is contained in:
Dhruv Parmar 2025-07-11 12:47:30 +05:30 committed by GitHub
parent 9a364a5a8c
commit b397e8861a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 67 additions and 18 deletions

View File

@ -52,7 +52,7 @@ export const CUSTOM_PROPERTIES_ENTITIES = {
dateFormatConfig: 'yyyy-MM-dd',
dateTimeFormatConfig: 'yyyy-MM-dd HH:mm:ss',
timeFormatConfig: 'HH:mm:ss',
entityReferenceConfig: ['User', 'Team'],
entityReferenceConfig: ['User', 'Team', 'Metric'],
entityObj: {},
entityApiType: 'containers',
tableConfig: {
@ -73,7 +73,7 @@ export const CUSTOM_PROPERTIES_ENTITIES = {
dateFormatConfig: 'yyyy-MM-dd',
dateTimeFormatConfig: 'yyyy-MM-dd HH:mm:ss',
timeFormatConfig: 'HH:mm:ss',
entityReferenceConfig: ['User', 'Team'],
entityReferenceConfig: ['User', 'Team', 'Metric'],
entityObj: {},
entityApiType: 'dashboards',
tableConfig: {
@ -94,7 +94,7 @@ export const CUSTOM_PROPERTIES_ENTITIES = {
dateFormatConfig: 'yyyy-MM-dd',
dateTimeFormatConfig: 'yyyy-MM-dd HH:mm:ss',
timeFormatConfig: 'HH:mm:ss',
entityReferenceConfig: ['User', 'Team'],
entityReferenceConfig: ['User', 'Team', 'Metric'],
entityObj: {},
entityApiType: 'databases',
tableConfig: {
@ -115,7 +115,7 @@ export const CUSTOM_PROPERTIES_ENTITIES = {
dateFormatConfig: 'yyyy-MM-dd',
dateTimeFormatConfig: 'yyyy-MM-dd HH:mm:ss',
timeFormatConfig: 'HH:mm:ss',
entityReferenceConfig: ['User', 'Team'],
entityReferenceConfig: ['User', 'Team', 'Metric'],
entityObj: {},
entityApiType: 'databaseSchemas',
tableConfig: {
@ -136,7 +136,7 @@ export const CUSTOM_PROPERTIES_ENTITIES = {
dateFormatConfig: 'yyyy-MM-dd',
dateTimeFormatConfig: 'yyyy-MM-dd HH:mm:ss',
timeFormatConfig: 'HH:mm:ss',
entityReferenceConfig: ['User', 'Team'],
entityReferenceConfig: ['User', 'Team', 'Metric'],
entityObj: {},
entityApiType: 'glossaryTerm',
tableConfig: {
@ -157,7 +157,7 @@ export const CUSTOM_PROPERTIES_ENTITIES = {
dateFormatConfig: 'yyyy-MM-dd',
dateTimeFormatConfig: 'yyyy-MM-dd HH:mm:ss',
timeFormatConfig: 'HH:mm:ss',
entityReferenceConfig: ['User', 'Team'],
entityReferenceConfig: ['User', 'Team', 'Metric'],
entityObj: {},
entityApiType: 'mlmodels',
tableConfig: {
@ -178,7 +178,7 @@ export const CUSTOM_PROPERTIES_ENTITIES = {
dateFormatConfig: 'yyyy-MM-dd',
dateTimeFormatConfig: 'yyyy-MM-dd HH:mm:ss',
timeFormatConfig: 'HH:mm:ss',
entityReferenceConfig: ['User', 'Team'],
entityReferenceConfig: ['User', 'Team', 'Metric'],
entityObj: {},
entityApiType: 'pipelines',
tableConfig: {
@ -199,7 +199,7 @@ export const CUSTOM_PROPERTIES_ENTITIES = {
dateFormatConfig: 'yyyy-MM-dd',
dateTimeFormatConfig: 'yyyy-MM-dd HH:mm:ss',
timeFormatConfig: 'HH:mm:ss',
entityReferenceConfig: ['User', 'Team'],
entityReferenceConfig: ['User', 'Team', 'Metric'],
entityObj: {},
entityApiType: 'searchIndexes',
tableConfig: {
@ -220,7 +220,7 @@ export const CUSTOM_PROPERTIES_ENTITIES = {
dateFormatConfig: 'yyyy-MM-dd',
dateTimeFormatConfig: 'yyyy-MM-dd HH:mm:ss',
timeFormatConfig: 'HH:mm:ss',
entityReferenceConfig: ['User', 'Team'],
entityReferenceConfig: ['User', 'Team', 'Metric'],
entityObj: {},
entityApiType: 'storedProcedures',
tableConfig: {
@ -241,7 +241,7 @@ export const CUSTOM_PROPERTIES_ENTITIES = {
dateFormatConfig: 'yyyy-MM-dd',
dateTimeFormatConfig: 'yyyy-MM-dd HH:mm:ss',
timeFormatConfig: 'HH:mm:ss',
entityReferenceConfig: ['User', 'Team'],
entityReferenceConfig: ['User', 'Team', 'Metric'],
entityObj: {},
entityApiType: 'tables',
tableConfig: {
@ -262,7 +262,7 @@ export const CUSTOM_PROPERTIES_ENTITIES = {
dateFormatConfig: 'yyyy-MM-dd',
dateTimeFormatConfig: 'yyyy-MM-dd HH:mm:ss',
timeFormatConfig: 'HH:mm:ss',
entityReferenceConfig: ['User', 'Team'],
entityReferenceConfig: ['User', 'Team', 'Metric'],
entityObj: {},
entityApiType: 'topics',
tableConfig: {
@ -282,7 +282,7 @@ export const CUSTOM_PROPERTIES_ENTITIES = {
dateFormatConfig: 'yyyy-MM-dd',
dateTimeFormatConfig: 'yyyy-MM-dd HH:mm:ss',
timeFormatConfig: 'HH:mm:ss',
entityReferenceConfig: ['User', 'Team'],
entityReferenceConfig: ['User', 'Team', 'Metric'],
entityObj: {},
entityApiType: 'apiCollections',
tableConfig: {
@ -303,7 +303,7 @@ export const CUSTOM_PROPERTIES_ENTITIES = {
dateFormatConfig: 'yyyy-MM-dd',
dateTimeFormatConfig: 'yyyy-MM-dd HH:mm:ss',
timeFormatConfig: 'HH:mm:ss',
entityReferenceConfig: ['User', 'Team'],
entityReferenceConfig: ['User', 'Team', 'Metric'],
entityObj: {},
entityApiType: 'apiEndpoints',
tableConfig: {
@ -323,7 +323,7 @@ export const CUSTOM_PROPERTIES_ENTITIES = {
dateFormatConfig: 'yyyy-MM-dd',
dateTimeFormatConfig: 'yyyy-MM-dd HH:mm:ss',
timeFormatConfig: 'HH:mm:ss',
entityReferenceConfig: ['User', 'Team'],
entityReferenceConfig: ['User', 'Team', 'Metric'],
entityObj: {},
entityApiType: 'dataProducts',
tableConfig: {
@ -343,7 +343,7 @@ export const CUSTOM_PROPERTIES_ENTITIES = {
dateFormatConfig: 'yyyy-MM-dd',
dateTimeFormatConfig: 'yyyy-MM-dd HH:mm:ss',
timeFormatConfig: 'HH:mm:ss',
entityReferenceConfig: ['User', 'Team'],
entityReferenceConfig: ['User', 'Team', 'Metric'],
entityObj: {},
entityApiType: 'domains',
tableConfig: {
@ -363,7 +363,7 @@ export const CUSTOM_PROPERTIES_ENTITIES = {
dateFormatConfig: 'yyyy-MM-dd',
dateTimeFormatConfig: 'yyyy-MM-dd HH:mm:ss',
timeFormatConfig: 'HH:mm:ss',
entityReferenceConfig: ['User', 'Team'],
entityReferenceConfig: ['User', 'Team', 'Metric'],
entityObj: {},
entityApiType: 'dashboardDataModels',
tableConfig: {
@ -383,7 +383,7 @@ export const CUSTOM_PROPERTIES_ENTITIES = {
dateFormatConfig: 'yyyy-MM-dd',
dateTimeFormatConfig: 'yyyy-MM-dd HH:mm:ss',
timeFormatConfig: 'HH:mm:ss',
entityReferenceConfig: ['User', 'Team'],
entityReferenceConfig: ['User', 'Team', 'Metric'],
entityObj: {},
entityApiType: 'metrics',
tableConfig: {

View File

@ -784,7 +784,7 @@ export const editCreatedProperty = async (
page.locator(
`[data-row-key="${propertyName}"] [data-testid="${propertyName}-config"]`
)
).toContainText('["user","team","table"]');
).toContainText('["user","team","metric","table"]');
}
};

View File

@ -111,6 +111,11 @@ export const ENTITY_REFERENCE_OPTIONS = [
value: 'team',
label: 'Team',
},
{
key: 'metric',
value: 'metric',
label: 'Metric',
},
];
// supported date formats on backend

View File

@ -14,6 +14,7 @@ import {
DEFAULT_DATE_FORMAT,
DEFAULT_DATE_TIME_FORMAT,
DEFAULT_TIME_FORMAT,
ENTITY_REFERENCE_OPTIONS,
SUPPORTED_DATE_TIME_FORMATS_ANTD_FORMAT_MAPPING,
} from '../constants/CustomProperty.constants';
import {
@ -168,4 +169,47 @@ describe('CustomProperty.utils', () => {
expect(result).toBe(expectedFormat);
});
});
describe('Entity Reference Options', () => {
it('should have correct structure for metric option', () => {
const metricOption = ENTITY_REFERENCE_OPTIONS.find(
(option) => option.key === 'metric'
);
expect(metricOption).toMatchObject({
key: 'metric',
value: 'metric',
label: 'Metric',
});
});
it('should have all expected entity types including metric', () => {
const expectedEntityTypes = [
'table',
'storedProcedure',
'databaseSchema',
'database',
'dashboard',
'dashboardDataModel',
'pipeline',
'topic',
'container',
'searchIndex',
'mlmodel',
'glossaryTerm',
'tag',
'user',
'team',
'metric',
];
const actualEntityTypes = ENTITY_REFERENCE_OPTIONS.map(
(option) => option.key
);
expectedEntityTypes.forEach((entityType) => {
expect(actualEntityTypes).toContain(entityType);
});
});
});
});