-
Notifications
You must be signed in to change notification settings - Fork 375
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
1757 new routing #3494
1757 new routing #3494
Conversation
Groups are also links now explorerPanelIsVisible now ties into location routing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really cool! Mostly nitpicky comments below, but there are some bigger-picture things to discuss as well:
- It has long been possible to deploy TerriaMap to a static web server, and we don't want to lose that ability. Does that mean providing an option to turn off the routing? Or making it (optionally?) use the hash portion of the URL instead of the path portion?
- The need to specify an
appBaseUrl
isn't great, and is a breaking change. The Investor Map staging site, for instance, is available at both https://inv-staging.nm.terria.io/ and https://inv-staging.nm.terria.io/investormap/. NEII has something similar happening. Why do we need to know the base URL? I thought it was for the sitemap, but a quick google seems to indicate sitemaps can use relative URLs too. - As mentioned briefly in the comments below, I don't want to see the routing become yet another "source of truth". We need to be clear about where the state (whether catalog is open, which item is selected) comes from. Maybe you are, but it wasn't clear to me while looking at the code.
- The
mobx
branch 😱. There will be conflicts. Some of this will be different there.
return ( | ||
this.props.item.uniqueId === | ||
URI.decode(this.props.match.params.catalogMemberId) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe there's a good reason for this that isn't apparent to me, but it seems to me the UI should determine which catalog item is selected based on the userDataPreviewedItem
or the previewedItem
properties, just as it did before. Routing should affect the values of those properties as necessary.
When the UI derives its state from multiple (potentially conflicting) places (e.g. routing and the view state), it can quickly get confusing which one is authoritative.
if (!bool && this.location && this.location.pathname !== "/") { | ||
setTimeout(() => { | ||
this.history.push("/"); | ||
}, 300); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this need a 300ms delay?
module.exports = DataCatalogItem; | ||
module.exports = { | ||
default: withRouter(DataCatalogItem), | ||
DataCatalogItem: withRouter(DataCatalogItem), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not a huge problem, but if I'm not mistaken calling withRouter
twice will create two separate but identical functions. Better to avoid that I think.
@@ -4,7 +4,7 @@ import React from "react"; | |||
import createReactClass from "create-react-class"; | |||
import PropTypes from "prop-types"; | |||
import ObserveModelMixin from "../ObserveModelMixin"; | |||
import DataCatalogItem from "./DataCatalogItem.jsx"; | |||
import { DataCatalogItem } from "./DataCatalogItem.jsx"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why you had to change this, since we're also exporting it as default. Maybe use ES exports for DataCatalogItem.jsx instead of mixing CJS and ES?
Thanks for bringing these up @kring
We have a couple of options. In fact with the PRs as they are, it is still possible to deploy this new configuration of TerriaMap to a static web server & have it work for basic catalogs that don't query a server for layers - it gets tricky once we start to support that too. I see a few options:
The
The new default added to
I haven't had much success without making the URL the absolute truth for these sort of things, & I tried to 'subscribe' to routing changes via
......yes 😵 |
Visibility was not toggled correctly when waiting for animation to finish
# Conflicts: # lib/ReactViewModels/ViewState.js # lib/ReactViews/DataCatalog/CatalogItem.jsx # lib/ReactViews/SidePanel/SidePanel.jsx # lib/ReactViews/StandardUserInterface/StandardUserInterface.jsx # package.json # test/ReactViews/StandardUserInterfaceSpec.jsx
# Conflicts: # doc/customizing/client-side-config.md # lib/ReactViewModels/ViewState.js # lib/ReactViews/DataCatalog/CatalogItem.jsx # lib/ReactViews/SidePanel/SidePanel.jsx # lib/ReactViews/StandardUserInterface/StandardUserInterface.jsx # package.json # test/ReactViews/StandardUserInterfaceSpec.jsx
At present time this is postponed indefinitely for pre-mobx(mastere), and will be fully re-implemented in mobx. |
(Barring merging it with even safer defaults of everything-off-by-default) |
Won't be merged/implemented in version 7. PR to implement functionality in version 8 is #4961. |
Adds routing such that catalog navigation can be traversed with browser history, and subsequently telling terriajshow to resolve URLs for a given catalog link
A demo of this in action with the 3 separate versions on one deployment is at (VPN required)
http://152.83.140.90:3001/catalog/54a553b4
Sitemap now autogenerated (after specifying appBaseUrl under config.json's
parameters
object)http://152.83.140.90:3001/sitemap.xml
Attempts to resolve #1757
Also see:
TerriaJS/terriajs-server#106
TerriaJS/TerriaMap#342