Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wire up redirect from legacy map to new map #936

Merged
merged 6 commits into from
Mar 18, 2024
Merged

Conversation

jernestmyers
Copy link
Member

Resolves #925

@jernestmyers jernestmyers marked this pull request as ready for review March 15, 2024 19:09
@dmfalke
Copy link
Member

dmfalke commented Mar 15, 2024

I just started looking at this. I'm not seeing a modal, and it appears there are a couple of redirects going on. I see two POST requests to create an analysis, so I suspect that is why the modal isn't showing up. I will investigate more later.

@jernestmyers
Copy link
Member Author

Hmm, it works for me. I'm using these urls while testing:
localhost:8080/a/app/workspace/maps/legacy-redirect-handler?signposts_ss=Pathogen&view=smpl&zoom_level=3&center=23.07973176244989,3.5156250000000004&summarizeBy=Sample%20type&grid=true&shared_link=true&limitTerms=true

localhost:8080/a/app/workspace/maps/legacy-redirect-handler

http://localhost:8080/a/app/workspace/maps/legacy-redirect-handler?signposts_ss=Pathogen&projectID=VBP0000812&view=smpl&zoom_level=4&center=26.82407078047018,45.08789062500001&summarizeBy=Project&grid=true&shared_link=true&limitTerms=true

Copy link
Member

@dmfalke dmfalke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really great! See one suggestion I made below.

Also, this isn't directly related to your changes, but the fact that the side panel gets hidden automatically is less than ideal. It would be nice to see it when the modal is open, since the modal references it. I don't think anything needs to be changed in this branch, but I wanted to point it out, for future reference.

image

const { analysisId } = await analysisClient.createAnalysis(
makeNewAnalysis(MEGA_STUDY_ID, computation, additionalConfig)
);
setHasCreatedAnalysis(true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking this should be set before creating the analysis, so that the state us updated as soon as possible.

Copy link
Member

@dmfalke dmfalke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Copy link
Member

@dmfalke dmfalke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't mean to request changes!

@jernestmyers jernestmyers merged commit 4fb2be7 into main Mar 18, 2024
1 check passed
@jernestmyers jernestmyers deleted the SAM-map-redirects branch March 18, 2024 22:14
@@ -115,6 +123,8 @@ export function MapAnalysis(props: Props) {
);
const geoConfigs = useGeoConfig(useStudyEntities());
const location = useLocation();
const locationState = location.state as LegacyRedirectState;
const [showRedirectModal, setShowRedirectModal] = useState(!!locationState);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I looked at this yesterday and then had to do other things before I could comment.

Why don't we check that the contents of locationState are what is expected? Currently we're assuming that any history redirect with state metadata is a legacy redirect. It might not be in future?

@jernestmyers @dmfalke

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we should be checking for the presence and truthiness of locationState.showLegacyMapRedirectModal?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right. I sort of glossed over this section. All the code right now is good, in that we aren't in danger of hitting TypeError: undefined errors.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe in the future it should be more like this, with some io-ts magic?

const locationState = location.state;
const [showRedirectModal, setShowRedirectModal] = useState(LegacyRedirectState.is(locationState) && locationState.showLegacyMapRedirectModal);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've addressed this feedback in a new PR: #983

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SAM: Add route component to handle redirects from legacy map
3 participants