diff --git a/CHANGELOG b/CHANGELOG index 37a544e7ec0678702589ddd135f91fa5d7e4b38e..257286238cd011071efdf9245b3198d6ea64141b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +minerva-front (18.0.7) stable; urgency=medium + * Bug fix: export to image did not include overlays (#326) + +-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 11 Dec 2024 13:00:00 +0200 + minerva-front (18.0.6) stable; urgency=medium * No changes in frontend diff --git a/src/components/Map/Drawer/ExportDrawer/ExportCompound/ExportCompound.component.tsx b/src/components/Map/Drawer/ExportDrawer/ExportCompound/ExportCompound.component.tsx index f5803c10f60e163d333a9eadc1fb8b6855d7486c..e33a99ed3c549cc4d256242adb67274ea1e21741 100644 --- a/src/components/Map/Drawer/ExportDrawer/ExportCompound/ExportCompound.component.tsx +++ b/src/components/Map/Drawer/ExportDrawer/ExportCompound/ExportCompound.component.tsx @@ -5,6 +5,7 @@ import { useAppDispatch } from '@/redux/hooks/useAppDispatch'; import { useAppSelector } from '@/redux/hooks/useAppSelector'; import { modelsDataSelector, modelsIdsSelector } from '@/redux/models/models.selectors'; import { ReactNode, useCallback, useMemo, useState } from 'react'; +import { activeOverlaysIdSelector } from '@/redux/overlayBioEntity/overlayBioEntity.selector'; import { CheckboxItem } from '../CheckboxFilter/CheckboxFilter.types'; import { Annotations } from './Annotations'; import { DownloadElements } from './DownloadElements/DownloadElements'; @@ -33,6 +34,7 @@ export const Export = ({ children }: ExportProps): JSX.Element => { const modelIds = useAppSelector(modelsIdsSelector); const currentModels = useAppSelector(modelsDataSelector); const currentBackground = useAppSelector(currentBackgroundSelector); + const overlays = useAppSelector(activeOverlaysIdSelector); const [annotations, setAnnotations] = useState<CheckboxItem[]>([]); const [includedCompartmentPathways, setIncludedCompartmentPathways] = useState<CheckboxItem[]>( [], @@ -76,6 +78,7 @@ export const Export = ({ children }: ExportProps): JSX.Element => { modelId: models?.[FIRST_ARRAY_ELEMENT]?.id, handler: imageFormats?.[FIRST_ARRAY_ELEMENT]?.id, zoom: getModelExportZoom(imageSize.width, model), + overlayIds: overlays.map(overlayId => `${overlayId}`), }); if (url) { diff --git a/src/components/Map/Drawer/ExportDrawer/ExportCompound/utils/getGraphicsDownloadUrl.test.ts b/src/components/Map/Drawer/ExportDrawer/ExportCompound/utils/getGraphicsDownloadUrl.test.ts index 2e6c4db9026bd78b950223fa64e5b3afe5161606..e621890aa478c403d21a2f4336abcc9222c5a465 100644 --- a/src/components/Map/Drawer/ExportDrawer/ExportCompound/utils/getGraphicsDownloadUrl.test.ts +++ b/src/components/Map/Drawer/ExportDrawer/ExportCompound/utils/getGraphicsDownloadUrl.test.ts @@ -3,10 +3,11 @@ import { GetGraphicsDownloadUrlProps, getGraphicsDownloadUrl } from './getGraphi describe('getGraphicsDownloadUrl - util', () => { const cases: [GetGraphicsDownloadUrlProps, string | undefined][] = [ - [{}, undefined], + [{ overlayIds: [] }, undefined], [ { backgroundId: 50, + overlayIds: [], }, undefined, ], @@ -14,6 +15,7 @@ describe('getGraphicsDownloadUrl - util', () => { { backgroundId: 50, modelId: '30', + overlayIds: [], }, undefined, ], @@ -22,6 +24,7 @@ describe('getGraphicsDownloadUrl - util', () => { backgroundId: 50, modelId: '30', handler: 'any.handler.image', + overlayIds: [], }, undefined, ], @@ -31,6 +34,7 @@ describe('getGraphicsDownloadUrl - util', () => { modelId: '30', handler: 'any.handler.image', zoom: 7, + overlayIds: [], }, `${BASE_API_URL}/projects/${PROJECT_ID}/models/30:downloadImage?backgroundOverlayId=50&handlerClass=any.handler.image&zoomLevel=7`, ], diff --git a/src/components/Map/Drawer/ExportDrawer/ExportCompound/utils/getGraphicsDownloadUrl.ts b/src/components/Map/Drawer/ExportDrawer/ExportCompound/utils/getGraphicsDownloadUrl.ts index c4020e9899f75685c7b732db23dd246077d433e7..169265eacb16fa65f80698c2768ebb4f359018a8 100644 --- a/src/components/Map/Drawer/ExportDrawer/ExportCompound/utils/getGraphicsDownloadUrl.ts +++ b/src/components/Map/Drawer/ExportDrawer/ExportCompound/utils/getGraphicsDownloadUrl.ts @@ -5,6 +5,7 @@ export interface GetGraphicsDownloadUrlProps { modelId?: string; handler?: string; zoom?: number; + overlayIds: string[]; } export const getGraphicsDownloadUrl = ({ @@ -12,6 +13,7 @@ export const getGraphicsDownloadUrl = ({ modelId, handler, zoom, + overlayIds, }: GetGraphicsDownloadUrlProps): string | undefined => { const isAllElementsTruthy = [backgroundId, modelId, handler, zoom].reduce( (a, b) => Boolean(a) && Boolean(b), @@ -22,5 +24,7 @@ export const getGraphicsDownloadUrl = ({ return undefined; } - return `${BASE_API_URL}/projects/${PROJECT_ID}/models/${modelId}:downloadImage?backgroundOverlayId=${backgroundId}&handlerClass=${handler}&zoomLevel=${zoom}`; + const overlays = overlayIds.join(','); + + return `${BASE_API_URL}/projects/${PROJECT_ID}/models/${modelId}:downloadImage?backgroundOverlayId=${backgroundId}&handlerClass=${handler}&zoomLevel=${zoom}&overlayIds=${overlays}`; };