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

Merge branch '342-issueopen-link-assigned-to-an-element-on-click-in-new-frontend' into 'main'

Resolve "IssueOpen link assigned to an element on click in new frontend"

See merge request !372
parents 71c79bc3 580e8ac0
No related branches found
No related tags found
2 merge requests!374Merge 18.1.0,!372Resolve "IssueOpen link assigned to an element on click in new frontend"
Pipeline #100525 passed
minerva-front (18.0.8) stable; urgency=medium
* Small improvement: support for links that should be opened immediately
(#342)
* Bug fix: data overlay removal did not work (#333)
* Bug fix: submap download did not download selected map (#337)
......
// const root = 'https://minerva-dev.lcsb.uni.lu';
// const root = 'https://scimap.lcsb.uni.lu';
const root = 'https://lux1.atcomp.pl';
// const root = 'https://lux1.atcomp.pl';
const root = 'http://localhost:8080';
window.config = {
BASE_API_URL: `${root}/minerva/api`,
BASE_NEW_API_URL: `${root}/minerva/new_api/`,
BASE_MAP_IMAGES_URL: `${root}/`,
BASE_MAP_IMAGES_URL: `${root}`,
DEFAULT_PROJECT_ID: 'sample',
ADMIN_PANEL_URL: `${root}/minerva/admin.xhtml`,
};
......@@ -31,9 +31,6 @@ export const ProjectInfoDrawer = (): JSX.Element => {
const sourceDownloadLink = BASE_API_URL + apiPath.getSourceFile();
// eslint-disable-next-line no-console
console.log(sourceDownloadLink);
let licenseName: string = '';
if (project) {
licenseName = project.license ? project.license.name : project.customLicenseName;
......
import { FIRST_ARRAY_ELEMENT } from '@/constants/common';
import { FIRST_ARRAY_ELEMENT, ZERO } from '@/constants/common';
import { bioEntitiesContentFixture } from '@/models/fixtures/bioEntityContentsFixture';
import { MODELS_MOCK } from '@/models/mocks/modelsMock';
import { INITIAL_STORE_STATE_MOCK } from '@/redux/root/root.fixtures';
......@@ -110,7 +110,9 @@ describe('BioEntitiesAccordion - component', () => {
expect(screen.getByText(`Content (${countAll})`)).toBeInTheDocument();
expect(screen.getByText(`Core PD map (${countCore})`)).toBeInTheDocument();
expect(screen.getByText(`Histamine signaling (${countHistamine})`)).toBeInTheDocument();
if (countHistamine > ZERO) {
expect(screen.getByText(`Histamine signaling (${countHistamine})`)).toBeInTheDocument();
}
expect(screen.getByText(`PRKN substrates (${countPrkn})`)).toBeInTheDocument();
});
......
......@@ -25,7 +25,10 @@ const CHEMICALS_PIN = {
};
const PIN_NUMBER = 10;
const BIO_ENTITY = bioEntitiesContentFixture[0].bioEntity;
const BIO_ENTITY = {
...bioEntitiesContentFixture[0].bioEntity,
model: 5053,
};
const INITIAL_STORE_STATE: InitialStoreState = {
models: MODELS_DATA_MOCK_WITH_MAIN_MAP,
......
......@@ -6,6 +6,8 @@ import { PluginsEventBus } from '@/services/pluginsManager/pluginsEventBus';
import { clearBioEntities } from '@/redux/bioEntity/bioEntity.slice';
import { Point } from '@/types/map';
import { getMultiBioEntityByIds } from '@/redux/bioEntity/thunks/getMultiBioEntity';
import { handleOpenImmediateLink } from '@/components/Map/MapViewer/utils/listeners/mapSingleClick/handleOpenImmediateLink';
import { ZERO } from '@/constants/common';
import { findClosestBioEntityPoint } from './findClosestBioEntityPoint';
type SearchConfig = {
......@@ -40,12 +42,13 @@ export const handleAliasResults =
dispatch(clearBioEntities());
return;
}
handleOpenImmediateLink(bioEntities[ZERO]);
}
dispatch(selectTab(`${id}`));
dispatch(openBioEntityDrawerById(id));
PluginsEventBus.dispatchEvent('onSearch', {
type: 'bioEntity',
searchValues: [closestSearchResult],
......
import { BioEntity } from '@/types/models';
import { showToast } from '@/utils/showToast';
export const handleOpenImmediateLink = (bioEntity: BioEntity): void => {
const link = bioEntity.immediateLink;
if (link !== null) {
const tab = window.open(link, '_blank');
if (tab) {
tab.focus();
} else {
showToast({
type: 'error',
message: `Browser prevented minerva from opening link: <a href="${link}" target="_blank">${link}</a>`,
});
}
}
};
......@@ -13,6 +13,7 @@ import { submodelSchema } from './submodelSchema';
export const bioEntitySchema = z.object({
id: z.union([z.number().int().positive(), z.string()]),
stringType: z.string(),
immediateLink: z.string().nullable(),
name: z.string(),
elementId: z.string(),
model: z.number(),
......
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