diff --git a/public/config.js b/public/config.js index 51047de3538bcf7b82d3559bb9b25764705acdf9..4d245aa0d429a56c8c6eb2e3cf44078f4edef59e 100644 --- a/public/config.js +++ b/public/config.js @@ -6,6 +6,6 @@ window.config = { BASE_API_URL: `${root}/minerva/api`, BASE_NEW_API_URL: `${root}/minerva/new_api/`, BASE_MAP_IMAGES_URL: `${root}/`, - DEFAULT_PROJECT_ID: 'minervar_example', + DEFAULT_PROJECT_ID: 'sample', ADMIN_PANEL_URL: `${root}/minerva/admin.xhtml`, }; diff --git a/src/components/Map/MapViewer/MapViewerVector/listeners/mouseClick/clickHandleReaction.test.ts b/src/components/Map/MapViewer/MapViewerVector/listeners/mouseClick/clickHandleReaction.test.ts index bc97ee988bf06edff21883922842d542deb3176e..47b21acd073d2ff3528c5fe0fa8ec6d018662ed4 100644 --- a/src/components/Map/MapViewer/MapViewerVector/listeners/mouseClick/clickHandleReaction.test.ts +++ b/src/components/Map/MapViewer/MapViewerVector/listeners/mouseClick/clickHandleReaction.test.ts @@ -37,7 +37,7 @@ describe('clickHandleReaction', () => { modelId = newReactionFixture.model; mockedAxiosClient - .onGet(apiPath.getReactionByIdInNewApi(reactionId, modelId)) + .onGet(apiPath.getNewReaction(modelId, reactionId)) .reply(HttpStatusCode.Ok, bioEntityFixture); [ diff --git a/src/components/Map/MapViewer/utils/listeners/mapSingleClick/handleReactionResults.test.ts b/src/components/Map/MapViewer/utils/listeners/mapSingleClick/handleReactionResults.test.ts index 0d73fa70caa8ce6012aca42dabd3903c6279b150..f44aa7c86cfd4fc74609b1540a14c261fbc5bfcc 100644 --- a/src/components/Map/MapViewer/utils/listeners/mapSingleClick/handleReactionResults.test.ts +++ b/src/components/Map/MapViewer/utils/listeners/mapSingleClick/handleReactionResults.test.ts @@ -82,15 +82,6 @@ describe('handleReactionResults - util', () => { ) .reply(HttpStatusCode.Ok, bioEntityFixture); - mockedAxiosNewClient - .onGet( - apiPath.getReactionByIdInNewApi( - ELEMENT_SEARCH_RESULT_MOCK_REACTION.id, - ELEMENT_SEARCH_RESULT_MOCK_REACTION.modelId, - ), - ) - .reply(HttpStatusCode.Ok, reaction); - mockedAxiosNewClient .onGet( apiPath.getNewReaction( @@ -170,12 +161,12 @@ describe('handleReactionResults - util', () => { mockedAxiosNewClient .onGet( - apiPath.getReactionByIdInNewApi( - ELEMENT_SEARCH_RESULT_MOCK_REACTION.id, + apiPath.getNewReaction( ELEMENT_SEARCH_RESULT_MOCK_REACTION.modelId, + ELEMENT_SEARCH_RESULT_MOCK_REACTION.id, ), ) - .reply(HttpStatusCode.Ok, bioEntityFixture); + .reply(HttpStatusCode.Ok, reaction); mockedAxiosOldClient .onGet(apiPath.getReactionsWithIds([ELEMENT_SEARCH_RESULT_MOCK_REACTION.id])) @@ -245,7 +236,7 @@ describe('handleReactionResults - util', () => { describe('when search config provided and matching reaction found', () => { const point = { x: 1, y: 1 }; const maxZoom = 10; - const zoom = 5; + const zoom = ZOOM_RESCALING_FACTOR * 5; it('should open reaction drawer and fetch bio entities', async () => { const { store } = getReduxStoreWithActionsListener(); @@ -258,15 +249,6 @@ describe('handleReactionResults - util', () => { ) .reply(HttpStatusCode.Ok, []); - mockedAxiosNewClient - .onGet( - apiPath.getReactionByIdInNewApi( - ELEMENT_SEARCH_RESULT_MOCK_REACTION.id, - ELEMENT_SEARCH_RESULT_MOCK_REACTION.modelId, - ), - ) - .reply(HttpStatusCode.Ok, reaction); - mockedAxiosNewClient .onGet( apiPath.getNewReaction( @@ -292,13 +274,16 @@ describe('handleReactionResults - util', () => { 'reactions/getByIds/fulfilled', 'drawer/openReactionDrawerById', 'drawer/selectTab', + 'project/getMultiBioEntity/pending', + 'entityNumber/addNumbersToEntityNumberData', + 'project/getMultiBioEntity/fulfilled', ]); }); }); describe('when matching reaction found', () => { const point = { x: reaction.line.segments[0].x1, y: reaction.line.segments[0].y1 }; const maxZoom = 10; - const zoom = 5; + const zoom = ZOOM_RESCALING_FACTOR * 5; it('should dispatch onSearch event with reaction data', async () => { const { store } = getReduxStoreWithActionsListener(); @@ -311,15 +296,6 @@ describe('handleReactionResults - util', () => { ) .reply(HttpStatusCode.Ok, []); - mockedAxiosNewClient - .onGet( - apiPath.getReactionByIdInNewApi( - ELEMENT_SEARCH_RESULT_MOCK_REACTION.id, - ELEMENT_SEARCH_RESULT_MOCK_REACTION.modelId, - ), - ) - .reply(HttpStatusCode.Ok, bioEntityFixture); - mockedAxiosNewClient .onGet( apiPath.getNewReaction( @@ -338,7 +314,7 @@ describe('handleReactionResults - util', () => { })(ELEMENT_SEARCH_RESULT_MOCK_REACTION); expect(PluginsEventBus.dispatchEvent).toHaveBeenCalledWith('onSearch', { - results: [[{ bioEntity: bioEntityFixture, perfect: true }]], + results: [[{ bioEntity: reaction, perfect: true }]], searchValues: [ELEMENT_SEARCH_RESULT_MOCK_REACTION], type: 'reaction', }); diff --git a/src/components/Map/MapViewer/utils/listeners/mapSingleClick/handleReactionResults.ts b/src/components/Map/MapViewer/utils/listeners/mapSingleClick/handleReactionResults.ts index dd69ba18ed75ae3e8da52f63118437f58e0b0191..e326806c7278d206a711965ea8204c257fdab1a5 100644 --- a/src/components/Map/MapViewer/utils/listeners/mapSingleClick/handleReactionResults.ts +++ b/src/components/Map/MapViewer/utils/listeners/mapSingleClick/handleReactionResults.ts @@ -9,8 +9,8 @@ import { BioEntity, ElementSearchResult } from '@/types/models'; import { axiosInstanceNewAPI } from '@/services/api/utils/axiosInstance'; import { apiPath } from '@/redux/apiPath'; import { validateDataUsingZodSchema } from '@/utils/validateDataUsingZodSchema'; -import { bioEntitySchema } from '@/models/bioEntitySchema'; import { getMultiBioEntityByIds } from '@/redux/bioEntity/thunks/getMultiBioEntity'; +import { newReactionSchema } from '@/models/newReactionSchema'; import { handleReactionSearchClickFailure } from './handleReactionSearchClickFailure'; import { getBioEntitiesIdsFromReaction } from './getBioEntitiesIdsFromReaction'; import { findClosestReactionPoint } from './findClosestReactionPoint'; @@ -54,8 +54,8 @@ export const handleReactionResults = dispatch(selectTab('')); - const response = await axiosInstanceNewAPI.get<BioEntity>(apiPath.getReactionByIdInNewApi(reaction.id, reaction.model)); - const isDataValid = validateDataUsingZodSchema(response.data, bioEntitySchema); + const response = await axiosInstanceNewAPI.get<BioEntity>(apiPath.getNewReaction(reaction.model, reaction.id)); + const isDataValid = validateDataUsingZodSchema(response.data, newReactionSchema); if (isDataValid) { const reactionNewApi = response.data; diff --git a/src/redux/apiPath.ts b/src/redux/apiPath.ts index 1e58fd7d9d23a40102dbee6cde3c40ca9c9c77d0..5346ef4d1bb1aa5ae919214414dfc9cdd22b2891 100644 --- a/src/redux/apiPath.ts +++ b/src/redux/apiPath.ts @@ -22,8 +22,6 @@ const getPublicationsURLSearchParams = ( export const apiPath = { getElementById: (elementId: number, modelId: number): string => `projects/${PROJECT_ID}/models/${modelId}/bioEntities/elements/${elementId}`, - getReactionByIdInNewApi: (reactionId: number, modelId: number): string => - `projects/${PROJECT_ID}/models/${modelId}/bioEntities/reactions/${reactionId}`, getBioEntityContentsStringWithQuery: ({ searchQuery,