feat(datasourcename):Allow specifying the datasourcename as a parameter (#3029)
This commit is contained in:
1 parent
bbfdda7fe7
commit
abd75b0ba1
6 files changed
+237
-27
No files matched your search
@@ -2,6 +2,8 @@ import React, { useEffect, useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useLocation } from 'react-router';
|
||||
|
||||
import {
|
||||
SidePanel,
|
||||
ErrorBoundary,
|
||||
@@ -11,7 +13,6 @@ import {
|
||||
useModal,
|
||||
LoadingIndicatorProgress,
|
||||
} from '@ohif/ui';
|
||||
|
||||
import i18n from '@ohif/i18n';
|
||||
import { hotkeys } from '@ohif/core';
|
||||
import { useAppConfig } from '@state';
|
||||
@@ -35,9 +36,19 @@ function ViewerLayout({
|
||||
}) {
|
||||
const [appConfig] = useAppConfig();
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
|
||||
const onClickReturnButton = () => {
|
||||
navigate('/');
|
||||
const { pathname } = location;
|
||||
const dataSourceIdx = pathname.indexOf('/', 1);
|
||||
const search =
|
||||
dataSourceIdx === -1
|
||||
? undefined
|
||||
: `datasourcename=${pathname.substring(dataSourceIdx + 1)}`;
|
||||
navigate({
|
||||
pathname: '/',
|
||||
search,
|
||||
});
|
||||
};
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
Reference in new issue
Block a user