diff --git a/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/BarMenu/bar-menu.less b/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/BarMenu/bar-menu.less index 1dcb7bcef7c..779e072c701 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/BarMenu/bar-menu.less +++ b/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/BarMenu/bar-menu.less @@ -21,6 +21,7 @@ border-top-right-radius: 4px; background-color: @menu-bg-color; display: flex; + flex-wrap: wrap; flex-direction: row; padding: 8px; border-bottom: 1px solid @format-group-separator-color; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/Extensions/BlockAndDragDrop/BlockAndDragHandle.ts b/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/Extensions/BlockAndDragDrop/BlockAndDragHandle.ts index a807211858c..57bcaee06f2 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/Extensions/BlockAndDragDrop/BlockAndDragHandle.ts +++ b/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/Extensions/BlockAndDragDrop/BlockAndDragHandle.ts @@ -197,42 +197,63 @@ export const BlockAndDragHandle = (options: BlockAndDragHandleOptions) => { return new Plugin({ view: (view) => { - // drag handle initialization - dragHandleElement = document.createElement('div'); - dragHandleElement.draggable = true; - dragHandleElement.dataset.dragHandle = ''; - dragHandleElement.title = 'Drag to move\nClick to open menu'; - dragHandleElement.classList.add('om-drag-handle'); - dragHandleElement.addEventListener('dragstart', (e) => { - handleDragStart(e, view); - }); - dragHandleElement.addEventListener('click', (e) => { - handleDragClick(e, view); - }); + try { + const isBarMenu = + view.dom?.parentElement?.parentElement?.classList.contains( + 'block-editor-wrapper--bar-menu' + ); - hideDragHandle(); + if (isBarMenu) { + return { + destroy: () => { + // do nothing + }, + }; + } - // block handle initialization - blockHandleElement = document.createElement('div'); - blockHandleElement.draggable = false; - blockHandleElement.dataset.blockHandle = ''; - blockHandleElement.title = 'Add new node'; - blockHandleElement.classList.add('om-block-handle'); + // drag handle initialization + dragHandleElement = document.createElement('div'); + dragHandleElement.draggable = true; + dragHandleElement.dataset.dragHandle = ''; + dragHandleElement.title = 'Drag to move\nClick to open menu'; + dragHandleElement.classList.add('om-drag-handle'); + dragHandleElement.addEventListener('dragstart', (e) => { + handleDragStart(e, view); + }); + dragHandleElement.addEventListener('click', (e) => { + handleDragClick(e, view); + }); - hideBlockHandle(); + hideDragHandle(); - view?.dom?.parentElement?.appendChild(dragHandleElement); - view?.dom?.parentElement?.appendChild(blockHandleElement); + // block handle initialization + blockHandleElement = document.createElement('div'); + blockHandleElement.draggable = false; + blockHandleElement.dataset.blockHandle = ''; + blockHandleElement.title = 'Add new node'; + blockHandleElement.classList.add('om-block-handle'); - return { - destroy: () => { - dragHandleElement?.remove?.(); - dragHandleElement = null; + hideBlockHandle(); - blockHandleElement?.remove?.(); - blockHandleElement = null; - }, - }; + view?.dom?.parentElement?.appendChild(dragHandleElement); + view?.dom?.parentElement?.appendChild(blockHandleElement); + + return { + destroy: () => { + dragHandleElement?.remove?.(); + dragHandleElement = null; + + blockHandleElement?.remove?.(); + blockHandleElement = null; + }, + }; + } catch (error) { + return { + destroy: () => { + // do nothing + }, + }; + } }, props: { handleDOMEvents: { diff --git a/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/block-editor.less b/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/block-editor.less index 6dfb77acf42..d9c0dc8b125 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/block-editor.less +++ b/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/block-editor.less @@ -207,11 +207,17 @@ &.block-editor-wrapper--bar-menu { border: 1px solid #dadde6; border-radius: 4px; + + // do not show drag handle and block handle in bar menu mode + .om-drag-handle, + .om-block-handle { + display: none; + } .om-block-editor { max-height: 300px; overflow: auto; - padding-left: 50px; - padding-right: 50px; + padding-left: 24px; + padding-right: 24px; padding-top: 8px; &:focus-visible { outline: none; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/AddDataQualityTest/EditTestCaseModal.tsx b/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/AddDataQualityTest/EditTestCaseModal.tsx index d81dd6a4077..9999c1e63f8 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/AddDataQualityTest/EditTestCaseModal.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/AddDataQualityTest/EditTestCaseModal.tsx @@ -48,7 +48,6 @@ import { generateFormFields } from '../../../utils/formUtils'; import { isValidJSONString } from '../../../utils/StringsUtils'; import { showErrorToast, showSuccessToast } from '../../../utils/ToastUtils'; import Loader from '../../common/Loader/Loader'; -import RichTextEditor from '../../common/RichTextEditor/RichTextEditor'; import { EditTestCaseModalProps } from './AddDataQualityTest.interface'; import ParameterForm from './components/ParameterForm'; @@ -214,6 +213,24 @@ const EditTestCaseModal: React.FC = ({ } }; + const descriptionField: FieldProp = useMemo( + () => ({ + name: 'description', + required: false, + label: t('label.description'), + id: 'root/description', + type: FieldTypes.DESCRIPTION, + props: { + 'data-testid': 'description', + initialValue: testCase?.description ?? '', + style: { + margin: 0, + }, + }, + }), + [testCase?.description] + ); + useEffect(() => { if (testCase) { fetchTestDefinitionById(); @@ -317,18 +334,7 @@ const EditTestCaseModal: React.FC = ({ {!showOnlyParameter && ( <> - - - + {generateFormFields([descriptionField])} {isComputeRowCountFieldVisible ? generateFormFields(formFields) : null} diff --git a/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/AddDataQualityTest/components/TestCaseForm.tsx b/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/AddDataQualityTest/components/TestCaseForm.tsx index 7de1ef7e6bd..c4f3add108e 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/AddDataQualityTest/components/TestCaseForm.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/AddDataQualityTest/components/TestCaseForm.tsx @@ -63,7 +63,6 @@ import { getEntityName } from '../../../../utils/EntityUtils'; import { generateFormFields } from '../../../../utils/formUtils'; import { generateEntityLink } from '../../../../utils/TableUtils'; import { showErrorToast } from '../../../../utils/ToastUtils'; -import RichTextEditor from '../../../common/RichTextEditor/RichTextEditor'; import { TestCaseFormProps, TestCaseFormType, @@ -249,6 +248,24 @@ const TestCaseForm: React.FC = ({ ); }; + const descriptionField: FieldProp = useMemo( + () => ({ + name: 'description', + required: false, + label: t('label.description'), + id: 'root/description', + type: FieldTypes.DESCRIPTION, + props: { + 'data-testid': 'description', + initialValue: initialValue?.description ?? '', + style: { + margin: 0, + }, + }, + }), + [initialValue?.description] + ); + useEffect(() => { const selectedColumn = table.columns.find( (column) => column.name === columnName @@ -418,17 +435,8 @@ const TestCaseForm: React.FC = ({ getFieldValue('useDynamicAssertion') ? null : generateParamsField } - - - + + {generateFormFields([descriptionField])} {isComputeRowCountFieldVisible ? generateFormFields(formFields) : null} diff --git a/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/TestCaseStatusModal/TestCaseStatusModal.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/TestCaseStatusModal/TestCaseStatusModal.component.tsx index 1f41d22aa0b..6680398a831 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/TestCaseStatusModal/TestCaseStatusModal.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/TestCaseStatusModal/TestCaseStatusModal.component.tsx @@ -15,7 +15,6 @@ import { AxiosError } from 'axios'; import { startCase, unionBy } from 'lodash'; import React, { useEffect, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; -import RichTextEditor from '../../../components/common/RichTextEditor/RichTextEditor'; import { EntityType } from '../../../enums/entity.enum'; import { CreateTestCaseResolutionStatus } from '../../../generated/api/tests/createTestCaseResolutionStatus'; import { TestCaseFailureReasonType } from '../../../generated/tests/resolved'; @@ -29,6 +28,8 @@ import { showErrorToast } from '../../../utils/ToastUtils'; import { VALIDATION_MESSAGES } from '../../../constants/constants'; import { useApplicationStore } from '../../../hooks/useApplicationStore'; +import { FieldProp, FieldTypes } from '../../../interface/FormUtils.interface'; +import { generateFormFields } from '../../../utils/formUtils'; import { TestCaseStatusModalProps } from './TestCaseStatusModal.interface'; export const TestCaseStatusModal = ({ @@ -125,6 +126,36 @@ export const TestCaseStatusModal = ({ } }; + const descriptionField: FieldProp = useMemo( + () => ({ + name: ['testCaseResolutionStatusDetails', 'testCaseFailureComment'], + required: true, + label: t('label.comment'), + id: 'root/description', + type: FieldTypes.DESCRIPTION, + rules: [ + { + required: true, + }, + ], + props: { + 'data-testid': 'description', + initialValue: + data?.testCaseResolutionStatusDetails?.testCaseFailureComment ?? '', + placeHolder: t('message.write-your-text', { + text: t('label.comment'), + }), + + onTextChange: (value: string) => + form.setFieldValue( + ['testCaseResolutionStatusDetails', 'testCaseFailureComment'], + value + ), + }, + }), + [data?.testCaseResolutionStatusDetails?.testCaseFailureComment] + ); + useEffect(() => { const assignee = data?.testCaseResolutionStatusDetails?.assignee; if ( @@ -202,36 +233,7 @@ export const TestCaseStatusModal = ({ ))} - - - form.setFieldValue( - [ - 'testCaseResolutionStatusDetails', - 'testCaseFailureComment', - ], - value - ) - } - /> - + {generateFormFields([descriptionField])} )} {statusType === TestCaseResolutionStatusTypes.Assigned && ( diff --git a/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/TestSuite/AddTestSuiteForm/AddTestSuiteForm.tsx b/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/TestSuite/AddTestSuiteForm/AddTestSuiteForm.tsx index 2b587d39bd5..2800555ceb9 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/TestSuite/AddTestSuiteForm/AddTestSuiteForm.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/TestSuite/AddTestSuiteForm/AddTestSuiteForm.tsx @@ -12,7 +12,7 @@ */ import { Button, Form, Input, Space } from 'antd'; -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useHistory } from 'react-router-dom'; import { @@ -22,11 +22,15 @@ import { import { NAME_FIELD_RULES } from '../../../../constants/Form.constants'; import { TabSpecificField } from '../../../../enums/entity.enum'; import { TestSuite } from '../../../../generated/tests/testSuite'; +import { + FieldProp, + FieldTypes, +} from '../../../../interface/FormUtils.interface'; import { DataQualityPageTabs } from '../../../../pages/DataQuality/DataQualityPage.interface'; import { getListTestSuites } from '../../../../rest/testAPI'; +import { getField } from '../../../../utils/formUtils'; import { getDataQualityPagePath } from '../../../../utils/RouterUtils'; import Loader from '../../../common/Loader/Loader'; -import RichTextEditor from '../../../common/RichTextEditor/RichTextEditor'; import { AddTestSuiteFormProps } from '../TestSuiteStepper/TestSuiteStepper.interface'; const AddTestSuiteForm: React.FC = ({ @@ -58,6 +62,21 @@ const AddTestSuiteForm: React.FC = ({ history.push(getDataQualityPagePath(DataQualityPageTabs.TEST_SUITES)); }; + const descriptionField: FieldProp = useMemo( + () => ({ + name: 'description', + required: false, + label: `${t('label.description')}:`, + id: 'root/description', + type: FieldTypes.DESCRIPTION, + props: { + 'data-testid': 'test-suite-description', + initialValue: testSuite?.description ?? '', + }, + }), + [testSuite?.description] + ); + useEffect(() => { fetchTestSuites(); }, []); @@ -101,14 +120,7 @@ const AddTestSuiteForm: React.FC = ({ })} /> - - form.setFieldsValue({ description: value })} - /> - - + {getField(descriptionField)}