diff --git a/dashboard/src/components/CreateDropdown/CreateDropdown.tsx b/dashboard/src/components/CreateDropdown/CreateDropdown.tsx index cb32d4e2a93..81658bd0d24 100644 --- a/dashboard/src/components/CreateDropdown/CreateDropdown.tsx +++ b/dashboard/src/components/CreateDropdown/CreateDropdown.tsx @@ -152,6 +152,7 @@ const CreateDropdown = () => { setEntityModal(false)} + isAdd={true} /> )} {classificationModal && ( diff --git a/dashboard/src/components/CreateDropdown/__tests__/CreateDropdown.test.tsx b/dashboard/src/components/CreateDropdown/__tests__/CreateDropdown.test.tsx index fff608e378f..7eed8279ed7 100644 --- a/dashboard/src/components/CreateDropdown/__tests__/CreateDropdown.test.tsx +++ b/dashboard/src/components/CreateDropdown/__tests__/CreateDropdown.test.tsx @@ -29,9 +29,9 @@ jest.mock('react-router-dom', () => ({ jest.mock('@views/Entity/EntityForm', () => ({ __esModule: true, - default: ({ open, onClose }: { open: boolean; onClose: () => void }) => + default: ({ open, onClose, isAdd }: { open: boolean; onClose: () => void; isAdd?: boolean }) => open ? ( -
+
@@ -84,6 +84,7 @@ describe('CreateDropdown (header Create menu)', () => { fireEvent.click(screen.getByText('Entity')) expect(await screen.findByTestId('entity-form')).toBeInTheDocument() + expect(screen.getByTestId('entity-form')).toHaveAttribute('data-isadd', 'true') fireEvent.click(screen.getByText('Close entity')) await waitFor(() => { diff --git a/dashboard/src/views/Entity/EntityForm.tsx b/dashboard/src/views/Entity/EntityForm.tsx index 4cc40497f3d..d933b0ec143 100644 --- a/dashboard/src/views/Entity/EntityForm.tsx +++ b/dashboard/src/views/Entity/EntityForm.tsx @@ -78,15 +78,18 @@ export function reducer(state: State, action: Action): State { const EntityForm = ({ open, - onClose + onClose, + isAdd = false }: { open: boolean; onClose: () => void; + isAdd?: boolean; }) => { const key = "atlas.ui.editable.entity.types"; const dispatchApi = useAppDispatch(); const navigate = useNavigate(); - const { guid }: any = useParams(); + const { guid: urlGuid }: any = useParams(); + const guid = isAdd ? undefined : urlGuid; const [_searchParams, setSearchParams] = useSearchParams(); const { entityData = {} }: any = useAppSelector((state: any) => state.entity);