From 9ee96deec4edab8ec6b9c03862735bcbe167d7e2 Mon Sep 17 00:00:00 2001 From: Shailesh Parmar Date: Tue, 20 Sep 2022 02:59:15 +0530 Subject: [PATCH] UI: Fixed issue: TestSuite descriptions are unable to update and also unable to create a test suite when edit tests permission is given#7507 (#7557) --- .../ui/cypress/constants/constants.js | 2 +- .../e2e/Pages/DataQualityAndProfiler.js | 13 ++++- .../component/DataQualityTab.tsx | 51 ++++++++++--------- .../TestSuiteDetails.component.tsx | 21 ++++---- 4 files changed, 51 insertions(+), 36 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.js b/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.js index 34275af64ee..3856139904a 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.js @@ -101,7 +101,7 @@ export const NEW_TEST_SUITE = { }; export const NEW_TABLE_TEST_CASE = { - type: 'TableColumnNameToExist', + type: 'tableColumnNameToExist', field: 'id', description: 'New table test case for TableColumnNameToExist', }; diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.js index 0d9eaff9e55..2ba440e5d1f 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.js @@ -22,7 +22,11 @@ const columnTestName = `${NEW_COLUMN_TEST_CASE.column}_${NEW_COLUMN_TEST_CASE.ty const goToProfilerTab = () => { // click on the 1st result and go to entity details page and follow the entity - interceptURL('GET', '/api/v1/feed*', 'getEntityDetails'); + interceptURL( + 'GET', + '/api/v1/tables/name/*?fields=columns,usageSummary,followers,joins,tags,owner,dataModel,profile,tests,tableConstraints,extension&include=all', + 'getEntityDetails' + ); cy.get('[data-testid="table-link"]') .first() .contains(TEAM_ENTITY, { matchCase: false }) @@ -162,11 +166,16 @@ describe('Data Quality and Profiler should work properly', () => { // wait for ingestion to run cy.clock(); cy.wait(10000); - + interceptURL( + 'GET', + '/api/v1/testCase?fields=testCaseResult,testDefinition,testSuite&testSuiteId=*&limit=10', + 'testCase' + ); cy.get('[data-testid="view-service-button"]') .should('be.visible') .click({ force: true }); + verifyResponseStatusCode('@testCase', 200); cy.contains(`${TEAM_ENTITY}_${NEW_TABLE_TEST_CASE.type}`).should( 'be.visible' ); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/component/DataQualityTab.tsx b/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/component/DataQualityTab.tsx index d6f9849d9ea..196efbdda7c 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/component/DataQualityTab.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/component/DataQualityTab.tsx @@ -19,9 +19,11 @@ import React, { useMemo, useState } from 'react'; import { Link } from 'react-router-dom'; import { ReactComponent as ArrowDown } from '../../../assets/svg/arrow-down.svg'; import { ReactComponent as ArrowRight } from '../../../assets/svg/arrow-right.svg'; +import { useAuthContext } from '../../../authentication/auth-provider/AuthProvider'; import { getTableTabPath } from '../../../constants/constants'; import { NO_PERMISSION_FOR_ACTION } from '../../../constants/HelperTextUtil'; import { TestCase, TestCaseResult } from '../../../generated/tests/testCase'; +import { useAuth } from '../../../hooks/authHooks'; import { getEntityName, getNameFromFQN } from '../../../utils/CommonUtils'; import { getTestSuitePath } from '../../../utils/RouterUtils'; import SVGIcons, { Icons } from '../../../utils/SvgUtils'; @@ -37,10 +39,13 @@ import TestSummary from './TestSummary'; const DataQualityTab: React.FC = ({ testCases, onTestUpdate, - hasAccess, }) => { const [selectedTestCase, setSelectedTestCase] = useState(); const [editTestCase, setEditTestCase] = useState(); + const { isAdminUser } = useAuth(); + const { isAuthDisabled } = useAuthContext(); + + const hasAccess = isAdminUser || isAuthDisabled; const columns: ColumnsType = useMemo(() => { return [ @@ -140,28 +145,6 @@ const DataQualityTab: React.FC = ({ render: (_, record) => { return ( - -