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

when fetching overlay dont fetch data for connected submaps, but compute them

parent d80a2513
No related branches found
No related tags found
Loading
Pipeline #94521 passed
......@@ -63,7 +63,7 @@ export const apiPath = {
getConfigurationOptions: (): string => 'configuration/options/',
getConfiguration: (): string => 'configuration/',
getOverlayBioEntity: ({ overlayId, modelId }: { overlayId: number; modelId: number }): string =>
`projects/${PROJECT_ID}/overlays/${overlayId}/models/${modelId}/bioEntities/?includeIndirect=true`,
`projects/${PROJECT_ID}/overlays/${overlayId}/models/${modelId}/bioEntities/`,
createOverlay: (projectId: string): string => `projects/${projectId}/overlays/`,
createOverlayFile: (): string => `files/`,
uploadOverlayFileContent: (fileId: number): string => `files/${fileId}:uploadContent`,
......
import { OverlayBioEntityRender } from '@/types/OLrendering';
import { createSelector } from '@reduxjs/toolkit';
import { allSubmapConnectionsBioEntitySelector } from '@/redux/bioEntity/bioEntity.selectors';
import { currentSearchedBioEntityId } from '../drawer/drawer.selectors';
import { currentModelIdSelector } from '../models/models.selectors';
import {
......@@ -34,7 +35,8 @@ export const overlayBioEntitiesForCurrentModelSelector = createSelector(
overlayBioEntityDataSelector,
activeOverlaysIdSelector,
currentModelIdSelector,
(data, activeOverlaysIds, currentModelId) => {
allSubmapConnectionsBioEntitySelector,
(data, activeOverlaysIds, currentModelId, submapConnections) => {
const result: OverlayBioEntityRender[] = [];
activeOverlaysIds.forEach(overlayId => {
......@@ -43,6 +45,37 @@ export const overlayBioEntitiesForCurrentModelSelector = createSelector(
}
});
submapConnections.forEach(submapConnection => {
if (submapConnection.model === currentModelId) {
const submapId = submapConnection?.submodel?.mapId;
if (submapId) {
activeOverlaysIds.forEach(overlayId => {
if (data[overlayId]?.[submapId]) {
data[overlayId][submapId].forEach(overlayBioEntityRender => {
const newOverlayBioEntityRender = {
id: submapConnection.id,
modelId: submapConnection.model,
x1: submapConnection.x,
y2: submapConnection.y,
x2: submapConnection.x + submapConnection.width,
y1: submapConnection.y + submapConnection.height,
width: submapConnection.width,
height: submapConnection.height,
value: overlayBioEntityRender.value,
overlayId: overlayBioEntityRender.overlayId,
color: overlayBioEntityRender.color,
hexColor: overlayBioEntityRender.hexColor,
type: overlayBioEntityRender.type,
geneVariants: overlayBioEntityRender.geneVariants,
name: overlayBioEntityRender.name,
};
result.push(newOverlayBioEntityRender);
});
}
});
}
}
});
return result;
},
);
......
......@@ -14,6 +14,7 @@ import {
} from '@/redux/autocomplete/autocomplete.thunks';
import { openSelectProjectModal } from '@/redux/modal/modal.slice';
import { getProjects } from '@/redux/projects/projects.thunks';
import { getSubmapConnectionsBioEntity } from '@/redux/bioEntity/thunks/getSubmapConnectionsBioEntity';
import { getAllBackgroundsByProjectId } from '../backgrounds/backgrounds.thunks';
import { getConfiguration, getConfigurationOptions } from '../configuration/configuration.thunks';
import {
......@@ -98,6 +99,8 @@ export const fetchInitialAppData = createAsyncThunk<
dispatch(getDrugAutocomplete());
dispatch(getChemicalAutocomplete());
dispatch(getSubmapConnectionsBioEntity());
/** Trigger search */
if (queryData.searchValue) {
dispatch(setPerfectMatch(queryData.perfectMatch));
......
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