Skip to content
Snippets Groups Projects
Commit a2d6a2fe authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch 'merge-18.0.5' into 'development'

Merge 18.0.5

See merge request !329
parents 90b79ac3 34512fba
No related branches found
No related tags found
1 merge request!329Merge 18.0.5
Pipeline #98650 passed
Showing
with 78 additions and 32 deletions
......@@ -8,6 +8,19 @@ minerva-front (19.0.0~alpha.0) stable; urgency=medium
-- Piotr Gawron <piotr.gawron@uni.lu> Fri, 18 Oct 2024 13:00:00 +0200
minerva-front (18.0.5) stable; urgency=medium
* Bug fix: anchor overlays were disappearing after clicking on anchor and
outside of the anchor (#319)
-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 27 Nov 2024 13:00:00 +0200
minerva-front (18.0.4) stable; urgency=medium
* Bug fix: link to search result from overview image caused map not to
load (#318)
* Bug fix: when compartment is missing "default" is added (#314)
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 11 Nov 2024 15:00:00 +0200
minerva-front (18.0.3) stable; urgency=medium
* Bug fix: Molart froze after clicking (#313)
* Bug fix: missing description and modifications added to element and
......
import { OverviewImageLinkImage, OverviewImageLinkModel } from '@/types/models';
import {
OverviewImageLinkImage,
OverviewImageLinkModel,
OverviewImageLinkSearch,
} from '@/types/models';
export interface OverviewImageSize {
width: number;
......@@ -26,3 +30,5 @@ export interface OverviewImageLinkConfig {
export type OverviewImageLinkImageHandler = (link: OverviewImageLinkImage) => void;
export type OverviewImageLinkModelHandler = (link: OverviewImageLinkModel) => void;
export type OverviewImageLinkSearchHandler = (link: OverviewImageLinkSearch) => void;
import { NOOP } from '@/constants/common';
import { NOOP, ZERO } from '@/constants/common';
import { useAppDispatch } from '@/redux/hooks/useAppDispatch';
import { useAppSelector } from '@/redux/hooks/useAppSelector';
import { mapOpenedMapsSelector } from '@/redux/map/map.selectors';
......@@ -8,9 +8,12 @@ import { currentModelIdSelector, modelsDataSelector } from '@/redux/models/model
import { projectOverviewImagesSelector } from '@/redux/project/project.selectors';
import { PluginsEventBus } from '@/services/pluginsManager/pluginsEventBus';
import { MapModel, OverviewImageLink, OverviewImageLinkModel } from '@/types/models';
import { getSearchData } from '@/redux/search/search.thunks';
import { openSearchDrawerWithSelectedTab } from '@/redux/drawer/drawer.slice';
import {
OverviewImageLinkImageHandler,
OverviewImageLinkModelHandler,
OverviewImageLinkSearchHandler,
} from '../OverviewImageModal.types';
interface UseOverviewImageLinkActionsResult {
......@@ -75,6 +78,16 @@ export const useOverviewImageLinkActions = (): UseOverviewImageLinkActionsResult
dispatch(closeModal());
};
const onSearchClick: OverviewImageLinkSearchHandler = link => {
const { query } = link;
const searchValues = query.split(',');
dispatch(getSearchData({ searchQueries: searchValues, isPerfectMatch: false }));
dispatch(openSearchDrawerWithSelectedTab(searchValues[ZERO]));
dispatch(closeModal());
};
const onImageClick: OverviewImageLinkImageHandler = link => {
const isImageAvailable = checkIfImageIsAvailable(link.linkedOverviewImage);
if (!isImageAvailable) {
......@@ -87,6 +100,7 @@ export const useOverviewImageLinkActions = (): UseOverviewImageLinkActionsResult
const handleLinkClick: UseOverviewImageLinkActionsResult['handleLinkClick'] = link => {
const isImageLink = 'linkedOverviewImage' in link;
const isModelLink = 'linkedModel' in link;
const isSearchLink = 'query' in link;
if (isImageLink) {
return onImageClick(link);
......@@ -96,6 +110,10 @@ export const useOverviewImageLinkActions = (): UseOverviewImageLinkActionsResult
return onSubmapClick(link);
}
if (isSearchLink) {
return onSearchClick(link);
}
return NOOP();
};
......
......@@ -49,7 +49,7 @@ describe('ClearAnchorsButton - component', () => {
{ payload: undefined, type: 'contextMenu/closeContextMenu' },
{ payload: undefined, type: 'reactions/resetReactionsData' },
{ payload: undefined, type: 'search/clearSearchData' },
{ payload: undefined, type: 'bioEntityContents/clearBioEntitiesData' },
{ payload: undefined, type: 'bioEntityContents/clearBioEntities' },
{ payload: undefined, type: 'drugs/clearDrugsData' },
{ payload: undefined, type: 'chemicals/clearChemicalsData' },
]);
......@@ -75,7 +75,7 @@ describe('ClearAnchorsButton - component', () => {
{ payload: undefined, type: 'contextMenu/closeContextMenu' },
{ payload: undefined, type: 'reactions/resetReactionsData' },
{ payload: undefined, type: 'search/clearSearchData' },
{ payload: undefined, type: 'bioEntityContents/clearBioEntitiesData' },
{ payload: undefined, type: 'bioEntityContents/clearBioEntities' },
{ payload: undefined, type: 'drugs/clearDrugsData' },
{ payload: undefined, type: 'chemicals/clearChemicalsData' },
]);
......
import { clearBioEntitiesData } from '@/redux/bioEntity/bioEntity.slice';
import { clearBioEntities } from '@/redux/bioEntity/bioEntity.slice';
import { clearChemicalsData } from '@/redux/chemicals/chemicals.slice';
import { closeContextMenu } from '@/redux/contextMenu/contextMenu.slice';
import { resultDrawerOpen } from '@/redux/drawer/drawer.selectors';
......@@ -31,7 +31,7 @@ export const ClearAnchorsButton = (): React.ReactNode => {
dispatch(clearSearchData());
// Reset old pins data
dispatch(clearBioEntitiesData());
dispatch(clearBioEntities());
dispatch(clearDrugsData());
dispatch(clearChemicalsData());
};
......
......@@ -62,14 +62,22 @@ export const BioEntityDrawer = (): React.ReactNode => {
/>
<div className="flex max-h-full flex-col gap-6 overflow-y-auto p-6">
<div className="text-sm font-normal">
Compartment: <b className="font-semibold">{bioEntityData.compartmentName}</b>
Compartment:{' '}
<b className="font-semibold">
{bioEntityData.compartmentName ? bioEntityData.compartmentName : 'default'}
</b>
</div>
{bioEntityData.fullName && (
<div className="text-sm font-normal">
Full name: <b className="font-semibold">{bioEntityData.fullName}</b>
</div>
)}
{bioEntityData.notes && <div className="text-sm font-normal">{bioEntityData.notes}</div>}
{bioEntityData.notes && (
<span>
<hr className="border-b border-b-divide" />
<div className="text-sm font-normal">{bioEntityData.notes}</div>
</span>
)}
{isModificationAvailable && (
<h3 className="font-semibold">Post-translational modifications:</h3>
)}
......
......@@ -80,7 +80,7 @@ describe('handleAliasResults - util', () => {
'project/getBioEntityById/fulfilled',
'entityNumber/addNumbersToEntityNumberData',
'project/getMultiBioEntity/fulfilled',
'bioEntityContents/clearBioEntitiesData',
'bioEntityContents/clearBioEntities',
]);
});
});
......@@ -121,7 +121,7 @@ describe('handleAliasResults - util', () => {
'entityNumber/addNumbersToEntityNumberData',
'project/getMultiBioEntity/fulfilled',
'drawer/closeDrawer',
'bioEntityContents/clearBioEntitiesData',
'bioEntityContents/clearBioEntities',
]);
});
});
......
......@@ -3,7 +3,7 @@ import { AppDispatch } from '@/redux/store';
import { searchFitBounds } from '@/services/pluginsManager/map/triggerSearch/searchFitBounds';
import { ElementSearchResult } from '@/types/models';
import { PluginsEventBus } from '@/services/pluginsManager/pluginsEventBus';
import { clearBioEntitiesData } from '@/redux/bioEntity/bioEntity.slice';
import { clearBioEntities } from '@/redux/bioEntity/bioEntity.slice';
import { Point } from '@/types/map';
import { getMultiBioEntityByIds } from '@/redux/bioEntity/thunks/getMultiBioEntity';
import { findClosestBioEntityPoint } from './findClosestBioEntityPoint';
......@@ -37,7 +37,7 @@ export const handleAliasResults =
dispatch(closeDrawer());
}
dispatch(clearBioEntitiesData());
dispatch(clearBioEntities());
return;
}
}
......
......@@ -206,7 +206,7 @@ describe('handleReactionResults - util', () => {
'reactions/getByIds/fulfilled',
'drawer/closeDrawer',
'reactions/resetReactionsData',
'bioEntityContents/clearBioEntitiesData',
'bioEntityContents/clearBioEntities',
]);
});
......@@ -229,7 +229,7 @@ describe('handleReactionResults - util', () => {
expect(dispatchSpy).toHaveBeenCalledWith({
payload: undefined,
type: 'bioEntityContents/clearBioEntitiesData',
type: 'bioEntityContents/clearBioEntities',
});
});
});
......
import { AppDispatch } from '@/redux/store';
import { closeDrawer } from '@/redux/drawer/drawer.slice';
import { resetReactionsData } from '@/redux/reactions/reactions.slice';
import { clearBioEntitiesData } from '@/redux/bioEntity/bioEntity.slice';
import { clearBioEntities } from '@/redux/bioEntity/bioEntity.slice';
export const handleReactionSearchClickFailure = (
dispatch: AppDispatch,
......@@ -11,5 +11,5 @@ export const handleReactionSearchClickFailure = (
dispatch(closeDrawer());
}
dispatch(resetReactionsData());
dispatch(clearBioEntitiesData());
dispatch(clearBioEntities());
};
......@@ -18,4 +18,16 @@ export const overviewImageLinkModel = z.object({
// type: z.string(),
});
export const overviewImageLink = z.union([overviewImageLinkImage, overviewImageLinkModel]);
export const overviewImageLinkSearch = z.object({
id: z.number(),
idObject: z.number(),
polygon: z.array(positionSchema),
query: z.string(),
type: z.string(),
});
export const overviewImageLink = z.union([
overviewImageLinkImage,
overviewImageLinkModel,
overviewImageLinkSearch,
]);
......@@ -108,13 +108,6 @@ export const getSubmapConnectionsBioEntityReducer = (
});
};
export const clearBioEntitiesDataReducer = (state: BioEntityContentsState): void => {
state.data = [];
state.loading = 'idle';
state.submapConnections = BIOENTITY_SUBMAP_CONNECTIONS_INITIAL_STATE;
};
export const clearBioEntitiesReducer = (state: BioEntityContentsState): void => {
state.data = [];
state.loading = 'idle';
......
import { createSlice } from '@reduxjs/toolkit';
import { BIOENTITY_INITIAL_STATE } from './bioEntity.constants';
import {
clearBioEntitiesDataReducer,
clearBioEntitiesReducer,
getBioEntityContentsReducer,
getMultiBioEntityContentsReducer,
......@@ -15,7 +14,6 @@ export const bioEntityContentsSlice = createSlice({
name: 'bioEntityContents',
initialState: BIOENTITY_INITIAL_STATE,
reducers: {
clearBioEntitiesData: clearBioEntitiesDataReducer,
clearBioEntities: clearBioEntitiesReducer,
toggleIsContentTabOpened: toggleIsContentTabOpenedReducer,
setBioEntityContents: setBioEntityContentsReducer,
......@@ -29,7 +27,6 @@ export const bioEntityContentsSlice = createSlice({
});
export const {
clearBioEntitiesData,
clearBioEntities,
toggleIsContentTabOpened,
setBioEntityContents,
......
......@@ -9,7 +9,6 @@ import { resetReactionsData } from '../reactions/reactions.slice';
import type { RootState } from '../store';
import { DATA_SEARCHING_ERROR_PREFIX } from './search.constants';
import { dispatchPluginsEvents } from './search.thunks.utils';
import { getSubmapConnectionsBioEntity } from '../bioEntity/thunks/getSubmapConnectionsBioEntity';
type GetSearchDataProps = PerfectMultiSearchParams;
......@@ -34,13 +33,11 @@ export const getSearchData = createAsyncThunk<
dispatch(getMultiBioEntity({ searchQueries, isPerfectMatch })),
dispatch(getMultiDrugs(searchQueries)),
dispatch(getMultiChemicals(searchQueries)),
dispatch(getSubmapConnectionsBioEntity()),
]);
} else {
await Promise.all([
dispatch(getMultiBioEntity({ searchQueries, isPerfectMatch })),
dispatch(getMultiDrugs(searchQueries)),
dispatch(getSubmapConnectionsBioEntity()),
]);
}
......
import { clearBioEntitiesData } from '@/redux/bioEntity/bioEntity.slice';
import { clearBioEntities } from '@/redux/bioEntity/bioEntity.slice';
import { clearChemicalsData } from '@/redux/chemicals/chemicals.slice';
import { clearDrugsData } from '@/redux/drugs/drugs.slice';
import { setMarkersData } from '@/redux/markers/markers.slice';
......@@ -10,7 +10,7 @@ export const clearAllElements = (elements: ElementName[]): void => {
const { dispatch } = store;
if (elements.includes('content')) {
dispatch(clearBioEntitiesData());
dispatch(clearBioEntities());
}
if (elements.includes('chemicals')) {
......
......@@ -44,6 +44,7 @@ import {
overviewImageLink,
overviewImageLinkImage,
overviewImageLinkModel,
overviewImageLinkSearch,
} from '@/models/overviewImageLink';
import { overviewImageView } from '@/models/overviewImageView';
import { pluginSchema } from '@/models/pluginSchema';
......@@ -89,6 +90,7 @@ export type OverviewImageView = z.infer<typeof overviewImageView>;
export type OverviewImageLink = z.infer<typeof overviewImageLink>;
export type OverviewImageLinkImage = z.infer<typeof overviewImageLinkImage>;
export type OverviewImageLinkModel = z.infer<typeof overviewImageLinkModel>;
export type OverviewImageLinkSearch = z.infer<typeof overviewImageLinkSearch>;
export type MapModel = z.infer<typeof mapModelSchema>;
export type BioShape = z.infer<typeof bioShapeSchema>;
export type LineType = z.infer<typeof lineTypeSchema>;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment