diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/AddNewService/redshiftWithDBT.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/AddNewService/redshiftWithDBT.spec.js index cba322a26fe..9955507aa77 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/AddNewService/redshiftWithDBT.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/AddNewService/redshiftWithDBT.spec.js @@ -128,9 +128,10 @@ describe('RedShift Ingestion', () => { cy.get('[data-testid="list-item"]').contains('Add dbt Ingestion').click(); // Add DBT ingestion cy.contains('Add dbt Ingestion').should('be.visible'); - cy.get('[data-testid="dbt-source"]') - .should('be.visible') - .select('HTTP Config Source'); + cy.get('[data-testid="dbt-source"]').should('be.visible').click(); + cy.get('.ant-select-item-option-content') + .contains('HTTP Config Source') + .click(); cy.get('[data-testid="catalog-url"]') .scrollIntoView() .should('be.visible') diff --git a/openmetadata-ui/src/main/resources/ui/src/components/AddIngestion/AddIngestion.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/AddIngestion/AddIngestion.component.tsx index 5fdb54da019..e1997f260b1 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/AddIngestion/AddIngestion.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/AddIngestion/AddIngestion.component.tsx @@ -191,6 +191,8 @@ const AddIngestion = ({ stageFileLocation: sourceConfig?.stageFileLocation ?? '/tmp/query_log', resultLimit: sourceConfig?.resultLimit ?? 1000, metadataToESConfig: undefined, + dbtUpdateDescriptions: sourceConfig?.dbtUpdateDescriptions ?? false, + dbtClassificationName: sourceConfig?.dbtClassificationName ?? '', }), [] ); @@ -459,10 +461,14 @@ const AddIngestion = ({ case PipelineType.Dbt: { return { ...escapeBackwardSlashChar({ - dbtConfigSource: omit(dbtConfigSource, 'dbtUpdateDescriptions'), + dbtConfigSource: omit(dbtConfigSource, [ + 'dbtUpdateDescriptions', + 'dbtClassificationName', + ]), } as ConfigClass), type: ConfigType.Dbt, dbtUpdateDescriptions: dbtConfigSource?.dbtUpdateDescriptions, + dbtClassificationName: dbtConfigSource?.dbtClassificationName, }; } diff --git a/openmetadata-ui/src/main/resources/ui/src/components/AddIngestion/addIngestion.interface.ts b/openmetadata-ui/src/main/resources/ui/src/components/AddIngestion/addIngestion.interface.ts index f0172b986a4..44c72120b68 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/AddIngestion/addIngestion.interface.ts +++ b/openmetadata-ui/src/main/resources/ui/src/components/AddIngestion/addIngestion.interface.ts @@ -87,13 +87,15 @@ export type ScheduleIntervalProps = { // Todo: Need to refactor below type, as per schema change #9575 export type ModifiedDbtConfig = DbtConfig & - Pick; + Pick; export interface AddIngestionState { chartFilterPattern: FilterPattern; dashboardFilterPattern: FilterPattern; databaseFilterPattern: FilterPattern; databaseServiceNames: string[]; + dbtClassificationName: string; + dbtUpdateDescriptions: boolean; dbtConfigSource: ModifiedDbtConfig; dbtConfigSourceType: DBT_SOURCES; description: string; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTCloudConfig.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTCloudConfig.test.tsx index b6a1e9a7019..78b6a4d65b1 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTCloudConfig.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTCloudConfig.test.tsx @@ -21,6 +21,7 @@ const mockAccountIdChange = jest.fn(); const mockAuthTokenChange = jest.fn(); const mockUpdateDescriptions = jest.fn(); const mockDbtCloudProjectId = jest.fn(); +const mockUpdateDBTClassification = jest.fn(); const mockProps = { dbtCloudAccountId: '', @@ -34,10 +35,11 @@ const mockProps = { handleCloudAuthTokenChange: mockAuthTokenChange, handleUpdateDescriptions: mockUpdateDescriptions, handleDbtCloudProjectId: mockDbtCloudProjectId, + handleUpdateDBTClassification: mockUpdateDBTClassification, }; -jest.mock('./SwitchField.component', () => - jest.fn().mockImplementation(() =>
UpdateDescriptionSwitch
) +jest.mock('./DBTCommonFields.component', () => + jest.fn().mockImplementation(() =>
DBT Common Fields
) ); describe('Test DBT Cloud Config Form', () => { diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTCloudConfig.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTCloudConfig.tsx index 8831f589892..ddb8e8ace9a 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTCloudConfig.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTCloudConfig.tsx @@ -11,7 +11,7 @@ * limitations under the License. */ -import { Input } from 'antd'; +import { Button, Input } from 'antd'; import React, { Fragment, FunctionComponent, useState } from 'react'; import { DbtConfig } from '../../../generated/metadataIngestion/dbtPipeline'; import { @@ -20,20 +20,20 @@ import { requiredField, } from '../../../utils/CommonUtils'; import { validateDbtCloudConfig } from '../../../utils/DBTConfigFormUtil'; -import { Button } from '../../buttons/Button/Button'; import { Field } from '../../Field/Field'; +import DBTCommonFields from './DBTCommonFields.component'; import { DbtConfigCloud, DBTFormCommonProps, ErrorDbtCloud, } from './DBTConfigForm.interface'; -import SwitchField from './SwitchField.component'; interface Props extends DBTFormCommonProps, DbtConfigCloud { handleCloudAccountIdChange: (value: string) => void; handleCloudAuthTokenChange: (value: string) => void; handleUpdateDescriptions: (value: boolean) => void; handleDbtCloudProjectId: (value: string) => void; + handleUpdateDBTClassification: (value: string) => void; } export const DBTCloudConfig: FunctionComponent = ({ @@ -49,6 +49,8 @@ export const DBTCloudConfig: FunctionComponent = ({ handleCloudAuthTokenChange, handleUpdateDescriptions, handleDbtCloudProjectId, + dbtClassificationName, + handleUpdateDBTClassification, }: Props) => { const [errors, setErrors] = useState(); @@ -65,6 +67,7 @@ export const DBTCloudConfig: FunctionComponent = ({ dbtCloudAuthToken, dbtUpdateDescriptions, dbtCloudProjectId, + dbtClassificationName, }; if (validate(submitData)) { onSubmit(submitData); @@ -135,32 +138,31 @@ export const DBTCloudConfig: FunctionComponent = ({ {getSeparator('')} - {getSeparator('')} - + diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTCommonFields.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTCommonFields.component.tsx new file mode 100644 index 00000000000..d1020340e28 --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTCommonFields.component.tsx @@ -0,0 +1,87 @@ +/* + * Copyright 2022 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 { Input, Space, Switch, Typography } from 'antd'; +import React, { Fragment } from 'react'; +import { useTranslation } from 'react-i18next'; +import { Field } from '../../Field/Field'; + +interface Props { + dbtClassificationName: string | undefined; + descriptionId: string; + handleUpdateDBTClassification: (value: string) => void; + dbtUpdateDescriptions: boolean; + handleUpdateDescriptions: (value: boolean) => void; +} + +function DBTCommonFields({ + descriptionId, + dbtUpdateDescriptions, + dbtClassificationName, + handleUpdateDescriptions, + handleUpdateDBTClassification, +}: Props) { + const { t } = useTranslation(); + + return ( + + + + + + + + {t('message.optional-configuration-update-description-dbt')} + + + + + + + + {t('message.custom-classification-name-dbt-tags')} + + + handleUpdateDBTClassification(e.target.value)} + /> + + + ); +} + +export default DBTCommonFields; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/SwitchField.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTCommonFields.test.tsx similarity index 57% rename from openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/SwitchField.test.tsx rename to openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTCommonFields.test.tsx index d8c10fd947d..540c351b6af 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/SwitchField.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTCommonFields.test.tsx @@ -13,31 +13,43 @@ import { getByTestId, render } from '@testing-library/react'; import React from 'react'; -import SwitchField from './SwitchField.component'; +import DBTCommonFields from './DBTCommonFields.component'; const mockProps = { dbtUpdateDescriptions: false, - id: 'test-id', + descriptionId: 'test-id', + dbtClassificationName: 'DBT', handleUpdateDescriptions: jest.fn(), + handleUpdateDBTClassification: jest.fn(), }; -jest.mock('antd', () => ({ - Space: jest.fn().mockImplementation(({ children }) =>
{children}
), - Switch: jest - .fn() - .mockImplementation(() =>
Switch
), -})); - -describe('SwitchField', () => { +describe('DBTCommonFields', () => { it('Component should render properly', () => { - const { container } = render(); + const { container } = render(); const switchLabel = getByTestId(container, 'test-id'); - const switchButton = getByTestId(container, 'switch'); + const switchButton = getByTestId(container, 'description-switch'); const switchDescription = getByTestId(container, 'switch-description'); expect(switchLabel).toBeInTheDocument(); expect(switchButton).toBeInTheDocument(); expect(switchDescription).toBeInTheDocument(); + + const classificationLabel = getByTestId( + container, + 'dbt-classification-label' + ); + const classificationInput = getByTestId( + container, + 'dbt-classification-name' + ); + const classificationDescription = getByTestId( + container, + 'dbt-classification-description' + ); + + expect(classificationLabel).toBeInTheDocument(); + expect(classificationInput).toBeInTheDocument(); + expect(classificationDescription).toBeInTheDocument(); }); }); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTConfigForm.interface.ts b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTConfigForm.interface.ts index c54712cb196..7c77a30c475 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTConfigForm.interface.ts +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTConfigForm.interface.ts @@ -43,6 +43,7 @@ export type DbtConfigCloud = Pick< | 'dbtCloudAuthToken' | 'dbtUpdateDescriptions' | 'dbtCloudProjectId' + | 'dbtClassificationName' >; export type DbtConfigLocal = Pick< @@ -51,6 +52,7 @@ export type DbtConfigLocal = Pick< | 'dbtManifestFilePath' | 'dbtRunResultsFilePath' | 'dbtUpdateDescriptions' + | 'dbtClassificationName' >; export type DbtConfigHttp = Pick< @@ -59,11 +61,15 @@ export type DbtConfigHttp = Pick< | 'dbtManifestHttpPath' | 'dbtRunResultsHttpPath' | 'dbtUpdateDescriptions' + | 'dbtClassificationName' >; export type DbtConfigS3GCS = Pick< ModifiedDbtConfig, - 'dbtSecurityConfig' | 'dbtPrefixConfig' | 'dbtUpdateDescriptions' + | 'dbtSecurityConfig' + | 'dbtPrefixConfig' + | 'dbtUpdateDescriptions' + | 'dbtClassificationName' >; export type DbtS3Creds = Pick< diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTConfigFormBuilder.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTConfigFormBuilder.tsx index cfd96db0c90..86aaf375d27 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTConfigFormBuilder.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTConfigFormBuilder.tsx @@ -11,7 +11,7 @@ * limitations under the License. */ -import { Button } from 'antd'; +import { Button, Input, Select } from 'antd'; import React, { Fragment, FunctionComponent, @@ -55,7 +55,11 @@ const DBTConfigFormBuilder: FunctionComponent = ({ ingestionName: data.ingestionName, gcsConfigType: data.gcsConfigType, dbtConfigSourceType: data.dbtConfigSourceType, - dbtConfigSource: data.dbtConfigSource, + dbtConfigSource: { + ...data.dbtConfigSource, + dbtClassificationName: data.dbtClassificationName, + dbtUpdateDescriptions: data.dbtUpdateDescriptions, + }, }), [ data.ingestionName, @@ -81,6 +85,7 @@ const DBTConfigFormBuilder: FunctionComponent = ({ return ( = ({ handleDbtCloudProjectId={(val) => { updateDbtConfig('dbtCloudProjectId', val); }} + handleUpdateDBTClassification={(val) => { + updateDbtConfig('dbtClassificationName', val); + }} handleUpdateDescriptions={(val) => { updateDbtConfig('dbtUpdateDescriptions', val); }} @@ -109,6 +117,7 @@ const DBTConfigFormBuilder: FunctionComponent = ({ = ({ handleRunResultsFilePathChange={(val) => { updateDbtConfig('dbtRunResultsFilePath', val); }} + handleUpdateDBTClassification={(val) => { + updateDbtConfig('dbtClassificationName', val); + }} handleUpdateDescriptions={(val) => { updateDbtConfig('dbtUpdateDescriptions', val); }} @@ -136,6 +148,7 @@ const DBTConfigFormBuilder: FunctionComponent = ({ = ({ handleRunResultsHttpPathChange={(val) => { updateDbtConfig('dbtRunResultsHttpPath', val); }} + handleUpdateDBTClassification={(val) => { + updateDbtConfig('dbtClassificationName', val); + }} handleUpdateDescriptions={(val) => { updateDbtConfig('dbtUpdateDescriptions', val); }} @@ -162,6 +178,7 @@ const DBTConfigFormBuilder: FunctionComponent = ({ return ( = ({ handleSecurityConfigChange={(val) => { updateDbtConfig('dbtSecurityConfig', val); }} + handleUpdateDBTClassification={(val) => { + updateDbtConfig('dbtClassificationName', val); + }} handleUpdateDescriptions={(val) => { updateDbtConfig('dbtUpdateDescriptions', val); }} @@ -191,11 +211,9 @@ const DBTConfigFormBuilder: FunctionComponent = ({ ingestionName: event.target.value, }); - const handleDbtConfigSourceType = ( - event: React.ChangeEvent - ) => { + const handleDbtConfigSourceType = (value: DBT_SOURCES) => { onChange({ - dbtConfigSourceType: event.target.value as DBT_SOURCES, + dbtConfigSourceType: value as DBT_SOURCES, }); }; @@ -203,6 +221,7 @@ const DBTConfigFormBuilder: FunctionComponent = ({ return ( = ({ handleSecurityConfigChange={(val) => { updateDbtConfig('dbtSecurityConfig', val); }} + handleUpdateDBTClassification={(val) => { + updateDbtConfig('dbtClassificationName', val); + }} handleUpdateDescriptions={(val) => { updateDbtConfig('dbtUpdateDescriptions', val); }} @@ -284,13 +306,12 @@ const DBTConfigFormBuilder: FunctionComponent = ({

{t('message.instance-identifier')}

- @@ -303,22 +324,17 @@ const DBTConfigFormBuilder: FunctionComponent = ({

{t('message.fetch-dbt-files')}

- + onChange={handleDbtConfigSourceType} + />
{getSeparator('')} {getFields()} diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTFormConstants.ts b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTFormConstants.ts index 6ac5625d217..83db5a62b8c 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTFormConstants.ts +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTFormConstants.ts @@ -24,34 +24,34 @@ import { DBT_SOURCES, GCS_CONFIG } from './DBTFormEnum'; export const DBTSources: Array = [ { - name: 'Local Config Source', + label: 'Local Config Source', value: DBT_SOURCES.local, }, { - name: 'HTTP Config Source', + label: 'HTTP Config Source', value: DBT_SOURCES.http, }, { - name: 'Cloud Config Source', + label: 'Cloud Config Source', value: DBT_SOURCES.cloud, }, { - name: 'S3 Config Source', + label: 'S3 Config Source', value: DBT_SOURCES.s3, }, { - name: 'GCS Config Source', + label: 'GCS Config Source', value: DBT_SOURCES.gcs, }, ]; export const GCSCreds: Array = [ { - name: 'GCS Credentials Values', + label: 'GCS Credentials Values', value: GCS_CONFIG.GCSValues, }, { - name: 'GCS Credentials Path', + label: 'GCS Credentials Path', value: GCS_CONFIG.GCSCredentialsPath, }, ]; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTGCSConfig.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTGCSConfig.test.tsx index 9345981ad49..5ea92f6f094 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTGCSConfig.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTGCSConfig.test.tsx @@ -21,6 +21,7 @@ const mockSubmit = jest.fn(); const mockPrefixConfigChange = jest.fn(); const mockSecurityConfigChange = jest.fn(); const mockUpdateDescriptions = jest.fn(); +const mockUpdateDBTClassification = jest.fn(); const gsConfig = { authProviderX509CertUrl: 'url', @@ -54,10 +55,11 @@ const mockProps = { handlePrefixConfigChange: mockPrefixConfigChange, handleSecurityConfigChange: mockSecurityConfigChange, handleUpdateDescriptions: mockUpdateDescriptions, + handleUpdateDBTClassification: mockUpdateDBTClassification, }; -jest.mock('./SwitchField.component', () => - jest.fn().mockImplementation(() =>
UpdateDescriptionSwitch
) +jest.mock('./DBTCommonFields.component', () => + jest.fn().mockImplementation(() =>
DBT Common Fields
) ); describe('Test DBT GCS Config Form', () => { diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTGCSConfig.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTGCSConfig.tsx index 33c315c6e2b..bea93f69811 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTGCSConfig.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTGCSConfig.tsx @@ -11,7 +11,7 @@ * limitations under the License. */ -import { Input } from 'antd'; +import { Button, Input, Select } from 'antd'; import { isEmpty, isObject, isString } from 'lodash'; import React, { Fragment, @@ -28,8 +28,8 @@ import { } from '../../../generated/metadataIngestion/dbtPipeline'; import jsonData from '../../../jsons/en'; import { errorMsg, getSeparator } from '../../../utils/CommonUtils'; -import { Button } from '../../buttons/Button/Button'; import { Field } from '../../Field/Field'; +import DBTCommonFields from './DBTCommonFields.component'; import { DbtConfigS3GCS, DBTFormCommonProps, @@ -37,7 +37,6 @@ import { } from './DBTConfigForm.interface'; import { GCSCreds } from './DBTFormConstants'; import { GCS_CONFIG } from './DBTFormEnum'; -import SwitchField from './SwitchField.component'; interface Props extends DBTFormCommonProps, DbtConfigS3GCS { gcsType?: GCS_CONFIG; @@ -45,6 +44,7 @@ interface Props extends DBTFormCommonProps, DbtConfigS3GCS { handleSecurityConfigChange: (value?: SCredentials) => void; handlePrefixConfigChange: (value: DBTBucketDetails) => void; handleUpdateDescriptions: (value: boolean) => void; + handleUpdateDBTClassification: (value: string) => void; } export const DBTGCSConfig: FunctionComponent = ({ @@ -60,6 +60,8 @@ export const DBTGCSConfig: FunctionComponent = ({ handleSecurityConfigChange, handlePrefixConfigChange, handleUpdateDescriptions, + dbtClassificationName, + handleUpdateDBTClassification, }: Props) => { const isMounted = useRef(false); const updateGCSCredsConfig = ( @@ -116,6 +118,7 @@ export const DBTGCSConfig: FunctionComponent = ({ dbtSecurityConfig, dbtPrefixConfig, dbtUpdateDescriptions, + dbtClassificationName, }; if (validate(submitData)) { onSubmit(submitData); @@ -375,23 +378,17 @@ export const DBTGCSConfig: FunctionComponent = ({

Available sources to fetch dbt catalog and manifest files.

- + onChange={(value) => { + handleGcsTypeChange && handleGcsTypeChange(value as GCS_CONFIG); + }} + /> {gcsType === GCS_CONFIG.GCSValues ? gcsCredConfigs(dbtSecurityConfig?.gcsConfig as GCSCredentialsValues) @@ -437,32 +434,31 @@ export const DBTGCSConfig: FunctionComponent = ({ {getSeparator('')} - {getSeparator('')} - + diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTHttpConfig.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTHttpConfig.test.tsx index 01c2f58ae9b..9fda3f5cd51 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTHttpConfig.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTHttpConfig.test.tsx @@ -21,6 +21,11 @@ const mockCatalogChange = jest.fn(); const mockManifestChange = jest.fn(); const mockRunResultsHttpPathChange = jest.fn(); const mockUpdateDescriptions = jest.fn(); +const mockUpdateDBTClassification = jest.fn(); + +jest.mock('./DBTCommonFields.component', () => + jest.fn().mockImplementation(() =>
DBT Common Fields
) +); const mockProps = { dbtCatalogHttpPath: '', @@ -35,12 +40,9 @@ const mockProps = { handleManifestHttpPathChange: mockManifestChange, handleRunResultsHttpPathChange: mockRunResultsHttpPathChange, handleUpdateDescriptions: mockUpdateDescriptions, + handleUpdateDBTClassification: mockUpdateDBTClassification, }; -jest.mock('./SwitchField.component', () => - jest.fn().mockImplementation(() =>
UpdateDescriptionSwitch
) -); - describe('Test DBT Http Config Form', () => { it('Fields should render', async () => { const { container } = render(); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTHttpConfig.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTHttpConfig.tsx index c5ad1817e69..637964777b9 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTHttpConfig.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTHttpConfig.tsx @@ -11,6 +11,7 @@ * limitations under the License. */ +import { Button } from 'antd'; import React, { Fragment, FunctionComponent, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { DbtConfig } from '../../../generated/metadataIngestion/dbtPipeline'; @@ -20,20 +21,20 @@ import { requiredField, } from '../../../utils/CommonUtils'; import { validateDbtHttpConfig } from '../../../utils/DBTConfigFormUtil'; -import { Button } from '../../buttons/Button/Button'; import { Field } from '../../Field/Field'; +import DBTCommonFields from './DBTCommonFields.component'; import { DbtConfigHttp, DBTFormCommonProps, ErrorDbtHttp, } from './DBTConfigForm.interface'; -import SwitchField from './SwitchField.component'; interface Props extends DBTFormCommonProps, DbtConfigHttp { handleCatalogHttpPathChange: (value: string) => void; handleManifestHttpPathChange: (value: string) => void; handleRunResultsHttpPathChange: (value: string) => void; handleUpdateDescriptions: (value: boolean) => void; + handleUpdateDBTClassification: (value: string) => void; } export const DBTHttpConfig: FunctionComponent = ({ @@ -49,6 +50,8 @@ export const DBTHttpConfig: FunctionComponent = ({ handleManifestHttpPathChange, handleRunResultsHttpPathChange, handleUpdateDescriptions, + dbtClassificationName, + handleUpdateDBTClassification, }: Props) => { const [errors, setErrors] = useState(); const { t } = useTranslation(); @@ -66,6 +69,7 @@ export const DBTHttpConfig: FunctionComponent = ({ dbtManifestHttpPath, dbtRunResultsHttpPath, dbtUpdateDescriptions, + dbtClassificationName, }; if (validate(submitData)) { onSubmit(submitData); @@ -136,32 +140,31 @@ export const DBTHttpConfig: FunctionComponent = ({
{getSeparator('')} - {getSeparator('')} - + diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTLocalConfig.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTLocalConfig.test.tsx index 1347dec7d6a..00480390421 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTLocalConfig.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTLocalConfig.test.tsx @@ -21,6 +21,7 @@ const mockCatalogChange = jest.fn(); const mockManifestChange = jest.fn(); const mockRunResultsFilePathChange = jest.fn(); const mockUpdateDescriptions = jest.fn(); +const mockUpdateDBTClassification = jest.fn(); const mockProps = { dbtCatalogFilePath: '', @@ -35,10 +36,11 @@ const mockProps = { handleManifestFilePathChange: mockManifestChange, handleRunResultsFilePathChange: mockRunResultsFilePathChange, handleUpdateDescriptions: mockUpdateDescriptions, + handleUpdateDBTClassification: mockUpdateDBTClassification, }; -jest.mock('./SwitchField.component', () => - jest.fn().mockImplementation(() =>
UpdateDescriptionSwitch
) +jest.mock('./DBTCommonFields.component', () => + jest.fn().mockImplementation(() =>
DBT Common Fields
) ); describe('Test DBT Local Config Form', () => { diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTLocalConfig.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTLocalConfig.tsx index 39f348c9db0..35c2b05ebfc 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTLocalConfig.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTLocalConfig.tsx @@ -11,6 +11,7 @@ * limitations under the License. */ +import { Button } from 'antd'; import React, { Fragment, FunctionComponent, useState } from 'react'; import { DbtConfig } from '../../../generated/metadataIngestion/dbtPipeline'; import { @@ -19,20 +20,20 @@ import { requiredField, } from '../../../utils/CommonUtils'; import { validateDbtLocalConfig } from '../../../utils/DBTConfigFormUtil'; -import { Button } from '../../buttons/Button/Button'; import { Field } from '../../Field/Field'; +import DBTCommonFields from './DBTCommonFields.component'; import { DbtConfigLocal, DBTFormCommonProps, ErrorDbtLocal, } from './DBTConfigForm.interface'; -import SwitchField from './SwitchField.component'; interface Props extends DBTFormCommonProps, DbtConfigLocal { handleCatalogFilePathChange: (value: string) => void; handleManifestFilePathChange: (value: string) => void; handleRunResultsFilePathChange: (value: string) => void; handleUpdateDescriptions: (value: boolean) => void; + handleUpdateDBTClassification: (value: string) => void; } export const DBTLocalConfig: FunctionComponent = ({ @@ -48,6 +49,8 @@ export const DBTLocalConfig: FunctionComponent = ({ handleManifestFilePathChange, handleRunResultsFilePathChange, handleUpdateDescriptions, + dbtClassificationName, + handleUpdateDBTClassification, }: Props) => { const [errors, setErrors] = useState(); @@ -64,6 +67,7 @@ export const DBTLocalConfig: FunctionComponent = ({ dbtManifestFilePath, dbtRunResultsFilePath, dbtUpdateDescriptions, + dbtClassificationName, }; if (validate(submitData)) { onSubmit(submitData); @@ -136,32 +140,31 @@ export const DBTLocalConfig: FunctionComponent = ({
{getSeparator('')} - {getSeparator('')} - + diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTS3Config.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTS3Config.test.tsx index a943241fb06..3b60bdb84fd 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTS3Config.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTS3Config.test.tsx @@ -20,6 +20,7 @@ const mockSubmit = jest.fn(); const mockPrefixConfigChange = jest.fn(); const mockSecurityConfigChange = jest.fn(); const mockUpdateDescriptions = jest.fn(); +const mockUpdateDBTClassification = jest.fn(); const mockProps = { okText: 'Next', @@ -30,10 +31,11 @@ const mockProps = { handlePrefixConfigChange: mockPrefixConfigChange, handleSecurityConfigChange: mockSecurityConfigChange, handleUpdateDescriptions: mockUpdateDescriptions, + handleUpdateDBTClassification: mockUpdateDBTClassification, }; -jest.mock('./SwitchField.component', () => - jest.fn().mockImplementation(() =>
UpdateDescriptionSwitch
) +jest.mock('./DBTCommonFields.component', () => + jest.fn().mockImplementation(() =>
DBT Common Fields
) ); describe('Test DBT S3 Config Form', () => { diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTS3Config.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTS3Config.tsx index a647725fbd6..50e53bde75d 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTS3Config.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/DBTS3Config.tsx @@ -11,7 +11,7 @@ * limitations under the License. */ -import { Input } from 'antd'; +import { Button, Input } from 'antd'; import React, { Fragment, FunctionComponent, useState } from 'react'; import { DBTBucketDetails, @@ -27,25 +27,26 @@ import { checkDbtS3CredsConfigRules, validateDbtS3Config, } from '../../../utils/DBTConfigFormUtil'; -import { Button } from '../../buttons/Button/Button'; import { Field } from '../../Field/Field'; +import DBTCommonFields from './DBTCommonFields.component'; import { DbtConfigS3GCS, DBTFormCommonProps, ErrorDbtS3, } from './DBTConfigForm.interface'; -import SwitchField from './SwitchField.component'; interface Props extends DBTFormCommonProps, DbtConfigS3GCS { handleSecurityConfigChange: (value: SCredentials) => void; handlePrefixConfigChange: (value: DBTBucketDetails) => void; handleUpdateDescriptions: (value: boolean) => void; + handleUpdateDBTClassification: (value: string) => void; } export const DBTS3Config: FunctionComponent = ({ dbtSecurityConfig, dbtPrefixConfig, dbtUpdateDescriptions = false, + dbtClassificationName, okText, cancelText, onCancel, @@ -53,6 +54,7 @@ export const DBTS3Config: FunctionComponent = ({ handleSecurityConfigChange, handlePrefixConfigChange, handleUpdateDescriptions, + handleUpdateDBTClassification, }: Props) => { const updateS3Creds = (key: keyof SCredentials, val: string) => { const updatedCreds: SCredentials = { @@ -89,6 +91,7 @@ export const DBTS3Config: FunctionComponent = ({ dbtSecurityConfig, dbtPrefixConfig, dbtUpdateDescriptions, + dbtClassificationName, }; if (validate(submitData)) { onSubmit(submitData); @@ -231,32 +234,31 @@ export const DBTS3Config: FunctionComponent = ({
{getSeparator('')} - {getSeparator('')} - + diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/SwitchField.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/SwitchField.component.tsx deleted file mode 100644 index 9cc64af4a76..00000000000 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/DBTConfigFormBuilder/SwitchField.component.tsx +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2022 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 { Space, Switch } from 'antd'; -import React from 'react'; -import { Field } from '../../Field/Field'; - -interface Props { - dbtUpdateDescriptions: boolean; - id: string; - handleUpdateDescriptions: (value: boolean) => void; -} - -function SwitchField({ - dbtUpdateDescriptions, - id, - handleUpdateDescriptions, -}: Props) { - return ( - - - - - -

- Optional configuration to update the description from dbt or not -

-
- ); -} - -export default SwitchField; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/dropdown/types.ts b/openmetadata-ui/src/main/resources/ui/src/components/dropdown/types.ts index a276b5503e2..37a6bc0c375 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/dropdown/types.ts +++ b/openmetadata-ui/src/main/resources/ui/src/components/dropdown/types.ts @@ -20,7 +20,8 @@ export enum DropDownType { } export type DropDownListItem = { - name: string | React.ReactElement; + label?: string; + name?: string | React.ReactElement; value?: string; group?: string; to?: string; diff --git a/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json b/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json index 162104cf932..0fc078b92af 100644 --- a/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json +++ b/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json @@ -145,6 +145,7 @@ "date-filter": "Date Filter", "day-left": "{{day}} left", "days-change-lowercase": "{{days}}-days change", + "dbt-classification-name": "dbt Classification Name", "dbt-configuration-source": "dbt Configuration Source", "dbt-ingestion": "DBT Ingestion", "dbt-lowercase": "dbt", @@ -543,6 +544,7 @@ "unique": "Unique", "unpause": "UnPause", "update": "Update", + "update-description": "Update Description", "update-password": "Update Password", "update-request-tag-plural": "Update Request Tags", "updated": "Updated", @@ -622,6 +624,7 @@ "create-new-glossary-guide": "A Glossary is a controlled vocabulary used to define the concepts and terminology in an organization. Glossaries can be specific to a certain domain (for e.g., Business Glossary, Technical Glossary). In the glossary, the standard terms and concepts can be defined along with the synonyms, and related terms. Control can be established over how and who can add the terms in the glossary.", "create-or-update-email-account-for-bot": "Changing the account email will update or create a new bot user.", "created-this-task-lowercase": "created this task", + "custom-classification-name-dbt-tags": "Custom OpenMetadata Classification name for dbt tags ", "data-asset-has-been-action-type": "Data Asset has been {{actionType}}", "data-insight-page-views": "Displays the number of times a dataset type was viewed.", "data-insight-subtitle": "Get a single pane view of the health of all your data assets over time.", @@ -734,6 +737,7 @@ "no-version-type-available": "No {{type}} version available", "not-followed-anything": "You have not followed anything yet.", "om-description": "Centralized metadata store, to discover, collaborate and get your data right.", + "optional-configuration-update-description-dbt": "Optional configuration to update the description from dbt or not", "permanently-delete-metadata": "Permanently deleting this {{entityName}} will remove its metadata from OpenMetadata permanently.", "permanently-delete-metadata-and-dependents": "Permanently deleting this {{entityName}} will remove its metadata, as well as the metadata of {{dependents}} from OpenMetadata permanently.", "pipeline-description-message": "Description of the pipeline.",