Skip to content

Commit

Permalink
Add import route and construct sharing url (#452)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmfalke authored Sep 8, 2023
1 parent be4c719 commit 6b78ea4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
17 changes: 17 additions & 0 deletions packages/libs/eda/src/lib/map/MapVeuContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import './MapVEu.scss';
import { SiteInformationProps } from '.';
import { StudyList } from './StudyList';
import { PublicAnalysesRoute } from '../workspace/PublicAnalysesRoute';
import { ImportAnalysis } from '../workspace/ImportAnalysis';

interface Props {
edaServiceUrl: string;
Expand Down Expand Up @@ -78,6 +79,22 @@ export function MapVeuContainer(mapVeuContainerProps: Props) {
/>
)}
/>
<Route
exact
path={`${path}/:analysisId/import`}
render={(
props: RouteComponentProps<{
analysisId: string;
}>
) => {
return (
<ImportAnalysis
{...props.match.params}
analysisClient={analysisClient}
/>
);
}}
/>
<Route
path={[`${path}/:studyId/new`, `${path}/:studyId/:analysisId`]}
render={(
Expand Down
9 changes: 7 additions & 2 deletions packages/libs/eda/src/lib/map/analysis/MapAnalysis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,12 @@ function MapAnalysisImpl(props: ImplProps) {
const {
appState,
analysisState,
analysisId,
setViewport,
setActiveVisualizationId,
setBoundsZoomLevel,
setSubsetVariableAndEntity,
sharingUrl,
// sharingUrl,
setIsSubsetPanelOpen = () => {},
setActiveMarkerConfigurationType,
setMarkerConfigurations,
Expand All @@ -259,6 +260,11 @@ function MapAnalysisImpl(props: ImplProps) {
const downloadClient = useDownloadClient();
const subsettingClient = useSubsettingClient();
const geoConfig = geoConfigs[0];
const history = useHistory();

// FIXME use the sharingUrl prop to construct this
const sharingUrl = new URL(`../${analysisId}/import`, window.location.href)
.href;

const getDefaultVariableDescriptor = useGetDefaultVariableDescriptor();

Expand Down Expand Up @@ -547,7 +553,6 @@ function MapAnalysisImpl(props: ImplProps) {
return !user.isGuest;
});

const history = useHistory();
function showLoginForm() {
const currentUrl = window.location.href;
const loginUrl = `${props.siteInformationProps.loginUrl}?destination=${currentUrl}`;
Expand Down

0 comments on commit 6b78ea4

Please sign in to comment.