Unverified Commit 07a78aaf authored by Manoj Pandian Sakthivel's avatar Manoj Pandian Sakthivel Committed by GitHub

Ensure species is enabled (#398)

Fixed the issue mentioned in the ticket by ensuring that the species is enabled when it is accessed using the direct url
parent f1ad7aa6
Pipeline #112214 passed with stages
in 8 minutes and 14 seconds
......@@ -92,7 +92,9 @@ export const Browser = (props: BrowserProps) => {
if (!activeGenomeId) {
return;
}
fetchGenomeData(activeGenomeId);
analyticsTracking.setSpeciesDimension(activeGenomeId);
}, [props.activeGenomeId]);
......
......@@ -30,7 +30,7 @@ import browserMessagingService from 'src/content/app/browser/browser-messaging-s
import browserStorageService from './browser-storage-service';
import { fetchEnsObject } from 'src/shared/state/ens-object/ensObjectActions';
import { ensureSpeciesIsEnabled } from 'src/content/app/species-selector/state/speciesSelectorActions';
import {
getBrowserActiveGenomeId,
getBrowserActiveEnsObjectId,
......@@ -106,6 +106,7 @@ export const setDataFromUrlAndSave: ActionCreator<ThunkAction<
const { activeGenomeId, activeEnsObjectId, chrLocation } = payload;
dispatch(ensureSpeciesIsEnabled(payload.activeGenomeId));
browserStorageService.saveActiveGenomeId(payload.activeGenomeId);
chrLocation &&
browserStorageService.updateChrLocation({ [activeGenomeId]: chrLocation });
......
......@@ -31,7 +31,6 @@ import {
} from 'src/content/app/entity-viewer/state/general/entityViewerGeneralSelectors';
import { isEntityViewerSidebarOpen } from 'src/content/app/entity-viewer/state/sidebar/entityViewerSidebarSelectors';
import { fetchGenomeData } from 'src/shared/state/genome/genomeActions';
import { setDataFromUrl } from 'src/content/app/entity-viewer/state/general/entityViewerGeneralActions';
import { toggleSidebar } from 'src/content/app/entity-viewer/state/sidebar/entityViewerSidebarActions';
......@@ -56,7 +55,6 @@ type Props = {
viewportWidth: BreakpointWidth;
replace: Replace;
setDataFromUrl: (params: EntityViewerParams) => void;
fetchGenomeData: (genomeId: string) => void;
toggleSidebar: (status?: SidebarStatus) => void;
};
......@@ -136,7 +134,6 @@ const mapStateToProps = (state: RootState) => {
const mapDispatchToProps = {
replace,
setDataFromUrl,
fetchGenomeData,
toggleSidebar
};
......
......@@ -37,6 +37,7 @@ import {
import { getGenomeInfoById } from 'src/shared/state/genome/genomeSelectors';
import { fetchGenomeData } from 'src/shared/state/genome/genomeActions';
import { ensureSpeciesIsEnabled } from 'src/content/app/species-selector/state/speciesSelectorActions';
import { EntityViewerParams } from 'src/content/app/entity-viewer/EntityViewer';
import { RootState } from 'src/store';
......@@ -74,6 +75,8 @@ export const setDataFromUrl: ActionCreator<ThunkAction<
} else if (genomeIdFromUrl && genomeIdFromUrl !== activeGenomeId) {
dispatch(setActiveGenomeId(genomeIdFromUrl));
dispatch(fetchGenomeData(genomeIdFromUrl));
dispatch(ensureSpeciesIsEnabled(genomeIdFromUrl));
// TODO: when backend is ready, entity info may also need fetching
} else if (activeGenomeId) {
// TODO: when backend is ready, fetch entity info
......@@ -81,6 +84,7 @@ export const setDataFromUrl: ActionCreator<ThunkAction<
if (!genomeInfo) {
dispatch(fetchGenomeData(activeGenomeId));
}
dispatch(ensureSpeciesIsEnabled(activeGenomeId));
}
const entityId = params.entityId
......
......@@ -182,6 +182,22 @@ export const ensureSpeciesIsCommitted: ActionCreator<ThunkAction<
speciesSelectorStorageService.saveSelectedSpecies(newCommittedSpecies);
};
export const ensureSpeciesIsEnabled: ActionCreator<ThunkAction<
void,
any,
null,
Action<string>
>> = (genomeId: string) => (dispatch, getState: () => RootState) => {
const state = getState();
const currentSpecies = getCommittedSpeciesById(state, genomeId);
if (!currentSpecies || currentSpecies.isEnabled) {
return;
}
dispatch(toggleSpeciesUseAndSave(genomeId));
};
export const fetchAssemblies: ActionCreator<ThunkAction<
void,
any,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment