Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 021d6f2
Merge: a5fb901 182a10a
Author: boriskovar-m2ms <[email protected]>
Date:   Thu Dec 19 13:49:43 2024 +0100

    Merge branch '#1533-direct-links' of https://github.com/m2ms/fragalysis-frontend into #1533-direct-links

commit a5fb901
Author: Boris Kovar <[email protected]>
Date:   Tue Dec 17 16:56:49 2024 +0100

    - implements #1533

commit 182a10a
Author: Boris Kovar <[email protected]>
Date:   Tue Dec 17 16:56:49 2024 +0100

    - implements #1533
  • Loading branch information
boriskovar-m2ms committed Dec 19, 2024
1 parent cdb3f74 commit 43d015b
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 1,281 deletions.
3 changes: 2 additions & 1 deletion js/components/direct/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ export const URL_TOKENS = {
molecules: 'mols',
exact: 'exact',
tag: 'tag',
target_access_string: 'tas'
target_access_string: 'tas',
compound: 'compound'
};
20 changes: 16 additions & 4 deletions js/components/direct/directDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ export const DirectDisplay = memo(props => {
useEffect(() => {
// example url http://127.0.0.1:8080/viewer/react/preview/direct/target/MID2A/tas/lb00000/mols/X0301_0A/L/P/S/X0393_0B/L/P
// example url with 'exact' https://fragalysis-tibor-default.xchem-dev.diamond.ac.uk/viewer/react/preview/direct/target/NUDT7A_CRUDE/mols/NUDT7A_CRUDE-X0156_1/exact/L/P
// based on the issues #431, #448, #447
// in two cases above we are searching for molecules using shortcode
// Now the search term is looked up in the `shortcode`, `compound ID` and all of the `aliases` (I can change this pretty quickly)
// `http://127.0.0.1:8080/viewer/react/preview/direct/target/A71EV2A/tas/lb18145-1/compound/7516/L/S/nonsense-45/L/P/exact/Z4/L/C/A0853a/L/P`
// URL above shows `L` and `S` for observation which contains substring `7516`, `L` and `P` for observation which exactly has string `nonsense-45` as a shortcode,
// compound ID or one of the aliases, `L` and `C` for all observations which contain substring `Z4`, and `L` and `P` for observations which contains substring `A0853a`
const param = match.params[0];
if (!directAccessProcessed && param && param.startsWith(URL_TOKENS.target)) {
let withoutKeyword = param.split(URL_TOKENS.target);
Expand Down Expand Up @@ -63,7 +67,13 @@ export const DirectDisplay = memo(props => {
}
}
}
if (rest && rest.length > 1 && rest[0] === URL_TOKENS.molecules) {
if (rest && rest.length > 1 && (rest[0] === URL_TOKENS.molecules || rest[0] === URL_TOKENS.compound)) {
let searchSettings = { searchBy: {} };
if (rest[0] === URL_TOKENS.molecules) {
searchSettings = { searchBy: { shortcode: true, aliases: false, compoundId: false } };
} else if (rest[0] === URL_TOKENS.compound) {
searchSettings = { searchBy: { shortcode: true, aliases: true, compoundId: true } };
}
rest = rest.slice(1);
let i;
let currentMolecule;
Expand Down Expand Up @@ -105,7 +115,8 @@ export const DirectDisplay = memo(props => {
C: false,
S: false,
V: false,
exact: false
exact: false,
searchSettings: searchSettings
};
molecules.push(currentMolecule);
}
Expand All @@ -119,7 +130,8 @@ export const DirectDisplay = memo(props => {
C: false,
S: false,
V: false,
exact: false
exact: false,
searchSettings: searchSettings
};
molecules.push(currentMolecule);
}
Expand Down
1 change: 0 additions & 1 deletion js/components/preview/molecule/hitNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Created by abradley on 14/03/2018.
*/
import React, { memo } from 'react';
import { MoleculeList } from './moleculeList';
import { ObservationCmpList } from './observationCmpList';

const HitNavigator = memo(({ hideProjects }) => {
Expand Down
Loading

0 comments on commit 43d015b

Please sign in to comment.