Unverified Commit a2ec5172 authored by Andrey Azov's avatar Andrey Azov Committed by GitHub

Fix routes (#345)

parent 30ece0a2
Pipeline #97821 passed with stages
in 5 minutes and 12 seconds
......@@ -71,7 +71,7 @@ const AppInner = (props: AppProps) => {
component={EntityViewer}
/>
<ErrorBoundary fallbackComponent={NewTechError}>
<Route path={`/browser/:genomeId?`} component={Browser} />
<Route path={`/genome-browser/:genomeId?`} component={Browser} />
</ErrorBoundary>
</Switch>
</Suspense>
......
......@@ -32,7 +32,7 @@ describe('<Launchbar />', () => {
it('disables Genome Browser button when there are no committed species', () => {
const wrapper = mount(<Launchbar {...defaultProps} />);
const genomeBrowserButton = wrapper.findWhere(
(wrapper) => wrapper.prop('app') === 'browser'
(wrapper) => wrapper.prop('app') === 'genome-browser'
);
expect(genomeBrowserButton.prop('enabled')).toBe(false);
......@@ -45,7 +45,7 @@ describe('<Launchbar />', () => {
};
const wrapper = mount(<Launchbar {...props} />);
const genomeBrowserButton = wrapper.findWhere(
(wrapper) => wrapper.prop('app') === 'browser'
(wrapper) => wrapper.prop('app') === 'genome-browser'
);
expect(genomeBrowserButton.prop('enabled')).toBe(true);
......
......@@ -62,7 +62,7 @@ const Launchbar = (props: LaunchbarProps) => {
</div>
<div className={styles.category}>
<LaunchbarButton
app="browser"
app="genome-browser"
description="Genome browser"
icon={BrowserIcon}
enabled={props.committedSpecies.length > 0}
......
......@@ -16,8 +16,8 @@
import queryString from 'query-string';
export const speciesSelector = () => '/app/species-selector';
export const customDownload = () => '/app/custom-download';
export const speciesSelector = () => '/species-selector';
export const customDownload = () => '/custom-download';
type BrowserUrlParams = {
genomeId?: string | null;
......@@ -32,8 +32,9 @@ type EntityViewerUrlParams = {
};
export const browser = (params?: BrowserUrlParams) => {
const browserRootPath = '/genome-browser';
if (params) {
const path = `/browser/${params.genomeId}`;
const path = `${browserRootPath}/${params.genomeId}`;
// NOTE: if a parameter passed to queryString is null, it will still get into query;
// so assign it to undefined in order to omit it from the query
const query = queryString.stringify(
......@@ -47,7 +48,7 @@ export const browser = (params?: BrowserUrlParams) => {
);
return query ? `${path}?${query}` : path;
} else {
return `/browser/`;
return browserRootPath;
}
};
......
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