Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

supported cypress for stored procedure and data models #13312

Merged
merged 7 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion openmetadata-ui/src/main/resources/ui/cypress/common/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,16 @@ export const visitEntityDetailsPage = (
dataTestId,
entityType
) => {
interceptURL('GET', '/api/v1/*/name/*', 'getEntityDetails');
if (entity === 'dashboardDataModel') {
interceptURL(
'GET',
'/api/v1/dashboard/datamodels/name/*',
'getEntityDetails'
);
} else {
interceptURL('GET', '/api/v1/*/name/*', 'getEntityDetails');
}

interceptURL(
'GET',
`/api/v1/search/query?q=*&index=${SEARCH_INDEX[entity]}&from=*&size=**`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const DASHBOARD_NAME = `cypress_version_dashboard-${uuid()}`;
const PIPELINE_NAME = `cypress_version_pipeline-${uuid()}`;
const ML_MODEL_NAME = `cypress_version_ml_model-${uuid()}`;
const CONTAINER_NAME = `cypress_version_container-${uuid()}`;
const STORED_PROCEDURE_NAME = `cypress_version_stored_procedure-${uuid()}`;
const DATA_MODEL_NAME = `cypress_version_data_model_${uuid()}`;

const TABLE_DETAILS_FOR_VERSION_TEST = {
name: TABLE_NAME,
Expand Down Expand Up @@ -510,90 +512,39 @@ const CONTAINER_PATCH_PAYLOAD = [
},
];

export const ENTITY_DETAILS_FOR_VERSION_TEST = {
Table: {
name: TABLE_NAME,
serviceName: 'sample_data',
entity: 'tables',
entityCreationDetails: TABLE_DETAILS_FOR_VERSION_TEST,
entityPatchPayload: TABLE_PATCH_PAYLOAD,
isChildrenExist: true,
childSelector: 'data-row-key',
entityAddedDescription: `Description for ${TABLE_NAME}`,
updatedTagEntityChildName: 'user_id',
entityChildRemovedDescription: 'First name of the staff member.',
entityChildAddedDescription: 'Last name of the staff member.',
},
Topic: {
name: TOPIC_NAME,
serviceName: 'sample_kafka',
entity: 'topics',
entityCreationDetails: TOPIC_DETAILS_FOR_VERSION_TEST,
entityPatchPayload: TOPIC_PATCH_PAYLOAD,
isChildrenExist: true,
childSelector: 'data-row-key',
entityAddedDescription: `Description for ${TOPIC_NAME}`,
updatedTagEntityChildName: 'default',
entityChildRemovedDescription: 'Description for schema field first_name',
entityChildAddedDescription: 'Description for schema field last_name',
},
// TODO - Remove the comment after this issue is resolved https://github.com/open-metadata/OpenMetadata/issues/12924
// Dashboard: {
// name: DASHBOARD_NAME,
// serviceName: 'sample_superset',
// entity: 'dashboards',
// entityCreationDetails: DASHBOARD_DETAILS_FOR_VERSION_TEST,
// entityPatchPayload: DASHBOARD_PATCH_PAYLOAD,
// isChildrenExist: false,
// entityAddedDescription: `Description for ${DASHBOARD_NAME}`,
// },
Pipeline: {
name: PIPELINE_NAME,
serviceName: 'sample_airflow',
entity: 'pipelines',
entityCreationDetails: PIPELINE_DETAILS_FOR_VERSION_TEST,
entityPatchPayload: PIPELINE_PATCH_PAYLOAD,
isChildrenExist: true,
childSelector: 'data-row-key',
entityAddedDescription: `Description for ${PIPELINE_NAME}`,
updatedTagEntityChildName: 'cypress_task_1',
entityChildRemovedDescription: 'Description for task cypress_task_2',
entityChildAddedDescription: 'Description for task cypress_task_3',
},
'ML Model': {
name: ML_MODEL_NAME,
serviceName: 'mlflow_svc',
entity: 'mlmodels',
entityCreationDetails: ML_MODEL_DETAILS_FOR_VERSION_TEST,
entityPatchPayload: ML_MODEL_PATCH_PAYLOAD,
isChildrenExist: true,
childSelector: 'data-testid',
entityAddedDescription: `Description for ${ML_MODEL_NAME}`,
updatedTagEntityChildName: 'feature-card-feature_1',
entityChildRemovedDescription: 'Description for mlFeature feature_2',
entityChildAddedDescription: 'Description for mlFeature feature_3',
},
Container: {
name: CONTAINER_NAME,
serviceName: 's3_storage_sample',
entity: 'containers',
entityCreationDetails: CONTAINER_DETAILS_FOR_VERSION_TEST,
entityPatchPayload: CONTAINER_PATCH_PAYLOAD,
isChildrenExist: true,
childSelector: 'data-row-key',
entityAddedDescription: `Description for ${CONTAINER_NAME}`,
updatedTagEntityChildName: 'column_1',
entityChildRemovedDescription: 'Description for column column_2',
entityChildAddedDescription: 'Description for column column_3',
const STORED_PROCEDURE_DETAILS_FOR_VERSION_TEST = {
name: STORED_PROCEDURE_NAME,
databaseSchema: 'sample_data.ecommerce_db.shopify',
storedProcedureCode: {
langauge: 'SQL',
code: 'CREATE OR REPLACE PROCEDURE output_message(message VARCHAR)\nRETURNS VARCHAR NOT NULL\nLANGUAGE SQL\nAS\n$$\nBEGIN\n RETURN message;\nEND;\n$$\n;',
},
tags: [],
};

export const DATA_MODEL_NAME = `cypress_version_data_model_${uuid()}`;
const STORED_PROCEDURE_PATCH_PAYLOAD = [
{
op: 'add',
path: '/tags/0',
value: {
labelType: 'Manual',
state: 'Confirmed',
source: 'Classification',
tagFQN: 'PersonalData.SpecialCategory',
},
},
{
op: 'add',
path: '/description',
value: `Description for ${STORED_PROCEDURE_NAME}`,
},
];

export const DATA_MODEL_DETAILS_FOR_VERSION_TEST = {
name: DATA_MODEL_NAME,
service: 'sample_looker',
dataModelType: 'LookMlExplore',
tags: [],
columns: [
{
name: 'column_1',
Expand Down Expand Up @@ -673,6 +624,96 @@ export const DATA_MODEL_PATCH_PAYLOAD = [
value: `Description for ${DATA_MODEL_NAME}`,
},
];
export const ENTITY_DETAILS_FOR_VERSION_TEST = {
Table: {
name: TABLE_NAME,
serviceName: 'sample_data',
entity: 'tables',
entityCreationDetails: TABLE_DETAILS_FOR_VERSION_TEST,
entityPatchPayload: TABLE_PATCH_PAYLOAD,
isChildrenExist: true,
childSelector: 'data-row-key',
entityAddedDescription: `Description for ${TABLE_NAME}`,
updatedTagEntityChildName: 'user_id',
entityChildRemovedDescription: 'First name of the staff member.',
entityChildAddedDescription: 'Last name of the staff member.',
},
Topic: {
name: TOPIC_NAME,
serviceName: 'sample_kafka',
entity: 'topics',
entityCreationDetails: TOPIC_DETAILS_FOR_VERSION_TEST,
entityPatchPayload: TOPIC_PATCH_PAYLOAD,
isChildrenExist: true,
childSelector: 'data-row-key',
entityAddedDescription: `Description for ${TOPIC_NAME}`,
updatedTagEntityChildName: 'default',
entityChildRemovedDescription: 'Description for schema field first_name',
entityChildAddedDescription: 'Description for schema field last_name',
},
// TODO - Remove the comment after this issue is resolved https://github.com/open-metadata/OpenMetadata/issues/12924
// Dashboard: {
// name: DASHBOARD_NAME,
// serviceName: 'sample_superset',
// entity: 'dashboards',
// entityCreationDetails: DASHBOARD_DETAILS_FOR_VERSION_TEST,
// entityPatchPayload: DASHBOARD_PATCH_PAYLOAD,
// isChildrenExist: false,
// entityAddedDescription: `Description for ${DASHBOARD_NAME}`,
// },
Pipeline: {
name: PIPELINE_NAME,
serviceName: 'sample_airflow',
entity: 'pipelines',
entityCreationDetails: PIPELINE_DETAILS_FOR_VERSION_TEST,
entityPatchPayload: PIPELINE_PATCH_PAYLOAD,
isChildrenExist: true,
childSelector: 'data-row-key',
entityAddedDescription: `Description for ${PIPELINE_NAME}`,
updatedTagEntityChildName: 'cypress_task_1',
entityChildRemovedDescription: 'Description for task cypress_task_2',
entityChildAddedDescription: 'Description for task cypress_task_3',
},
'ML Model': {
name: ML_MODEL_NAME,
serviceName: 'mlflow_svc',
entity: 'mlmodels',
entityCreationDetails: ML_MODEL_DETAILS_FOR_VERSION_TEST,
entityPatchPayload: ML_MODEL_PATCH_PAYLOAD,
isChildrenExist: true,
childSelector: 'data-testid',
entityAddedDescription: `Description for ${ML_MODEL_NAME}`,
updatedTagEntityChildName: 'feature-card-feature_1',
entityChildRemovedDescription: 'Description for mlFeature feature_2',
entityChildAddedDescription: 'Description for mlFeature feature_3',
},
Container: {
name: CONTAINER_NAME,
serviceName: 's3_storage_sample',
entity: 'containers',
entityCreationDetails: CONTAINER_DETAILS_FOR_VERSION_TEST,
entityPatchPayload: CONTAINER_PATCH_PAYLOAD,
isChildrenExist: true,
childSelector: 'data-row-key',
entityAddedDescription: `Description for ${CONTAINER_NAME}`,
updatedTagEntityChildName: 'column_1',
entityChildRemovedDescription: 'Description for column column_2',
entityChildAddedDescription: 'Description for column column_3',
},
'Stored Procedure': {
name: STORED_PROCEDURE_NAME,
serviceName: 'sample_data',
entity: 'storedProcedures',
entityCreationDetails: STORED_PROCEDURE_DETAILS_FOR_VERSION_TEST,
entityPatchPayload: STORED_PROCEDURE_PATCH_PAYLOAD,
isChildrenExist: false,
childSelector: 'data-row-key',
entityAddedDescription: `Description for ${STORED_PROCEDURE_NAME}`,
updatedTagEntityChildName: '',
entityChildRemovedDescription: '',
entityChildAddedDescription: '',
},
};

export const DATA_MODEL_DETAILS = {
name: DATA_MODEL_NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export const MYDATA_SUMMARY_OPTIONS = {
containers: 'containers',
glossaryTerms: 'glossary-terms',
tags: 'tags',
storedProcedures: 'storedProcedures',
dataModel: 'dashboardDataModel',
};

export const SEARCH_INDEX = {
Expand Down Expand Up @@ -156,6 +158,38 @@ export const SEARCH_ENTITY_MLMODEL = {
},
};

export const SEARCH_ENTITY_STORED_PROCEDURE = {
stored_procedure_1: {
term: 'update_dim_address_table',
entity: MYDATA_SUMMARY_OPTIONS.storedProcedures,
serviceName: 'sample_data',
entityType: 'Stored Procedure',
},
stored_procedure_2: {
term: 'update_dim_address_table',
entity: MYDATA_SUMMARY_OPTIONS.storedProcedures,
serviceName: 'sample_data',
displayName: 'update_dim_address_table',
entityType: 'Stored Procedure',
},
};

export const SEARCH_ENTITY_DATA_MODEL = {
data_model_1: {
term: 'operations_view',
entity: MYDATA_SUMMARY_OPTIONS.dataModel,
serviceName: 'sample_looker',
entityType: 'Data Model',
},
data_model_2: {
term: 'orders_view',
entity: MYDATA_SUMMARY_OPTIONS.dataModel,
serviceName: 'sample_looker',
displayName: 'Orders View',
entityType: 'Data Model',
},
};

export const DELETE_ENTITY = {
table: {
term: 'dim.shop',
Expand Down Expand Up @@ -323,6 +357,7 @@ export const SERVICE_TYPE = {
Pipeline: 'Pipeline',
MLModels: 'ML Models',
Storage: 'Storage',
StoredProcedure: 'StoredProcedure',
};

export const ENTITIES = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,20 @@ export const TAGS_ADD_REMOVE_ENTITIES = [
tags: ['PersonalData.Personal', 'PII.Sensitive'],
permissionApi: '/api/v1/permissions/*/*',
},
{
term: 'update_orders_table',
displayName: 'update_orders_table',
entity: 'storedProcedures',
serviceName: 'sample_data',
tags: ['PersonalData.Personal', 'PII.Sensitive'],
permissionApi: '/api/v1/permissions/*/name/*',
},
{
term: 'orders_view',
displayName: 'orders_view',
entity: 'dashboardDataModel',
serviceName: 'sample_looker',
tags: ['PersonalData.Personal', 'PII.Sensitive'],
permissionApi: '/api/v1/permissions/*/name/*',
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,18 @@ export const ENTITIES_DISPLAY_NAME = {
serviceName: SERVICES.storageServices.name,
breadcrumb: [SERVICES.storageServices.displayName],
},
storedProcedure: {
name: 'update_dim_address_table',
oldDisplayName: 'update_dim_address_table',
displayName: 'Update_Dim_Address_Table',
entity: MYDATA_SUMMARY_OPTIONS.storedProcedures,
serviceName: 'sample_data',
breadcrumb: [
DATABASE_AND_SCHEMA.schemaDisplayName,
DATABASE_AND_SCHEMA.databaseDisplayName,
SERVICES.databaseServices.displayName,
],
},
};
export const DASHBOARD_DATA_MODEL = {
service: SERVICES.dashboardServices,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,18 @@ export const VOTING_ENTITIES = [
fieldName: 'sales',
permissionApi: '/api/v1/permissions/*/*',
},
{
term: 'update_orders_table',
displayName: 'update_orders_table',
entity: 'storedProcedures',
serviceName: 'sample_data',
permissionApi: '/api/v1/permissions/*/name/*',
},
{
term: 'orders_view',
displayName: 'orders_view',
entity: 'dashboardDataModel',
serviceName: 'sample_looker',
permissionApi: '/api/v1/permissions/*/name/*',
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ import {
} from '../../common/common';
import {
SEARCH_ENTITY_DASHBOARD,
SEARCH_ENTITY_DATA_MODEL,
SEARCH_ENTITY_MLMODEL,
SEARCH_ENTITY_PIPELINE,
SEARCH_ENTITY_STORED_PROCEDURE,
SEARCH_ENTITY_TABLE,
SEARCH_ENTITY_TOPIC,
} from '../../constants/constants';
Expand All @@ -33,11 +35,29 @@ const FOLLOWING_ENTITIES = [
SEARCH_ENTITY_TOPIC.topic_1,
SEARCH_ENTITY_PIPELINE.pipeline_1,
SEARCH_ENTITY_MLMODEL.mlmodel_2,
SEARCH_ENTITY_STORED_PROCEDURE.stored_procedure_2,
SEARCH_ENTITY_DATA_MODEL.data_model_2,
];

const followEntity = ({ term, serviceName, entity }, isUnfollow) => {
visitEntityDetailsPage(term, serviceName, entity);

if (entity === 'dashboardDataModel') {
interceptURL(
isUnfollow ? 'DELETE' : 'PUT',
isUnfollow
? '/api/v1/dashboard/datamodels/*/followers/*'
: '/api/v1/dashboard/datamodels/*/followers',
'waitAfterFollow'
);
} else {
interceptURL(
isUnfollow ? 'DELETE' : 'PUT',
isUnfollow ? '/api/v1/*/*/followers/*' : '/api/v1/*/*/followers',
'waitAfterFollow'
);
}

interceptURL(
isUnfollow ? 'DELETE' : 'PUT',
isUnfollow ? '/api/v1/*/*/followers/*' : '/api/v1/*/*/followers',
Expand Down
Loading
Loading