-
Notifications
You must be signed in to change notification settings - Fork 111
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
MSTR-228: Allow app custom routing #1005
Conversation
Are some changes in this PR missing maybe?
|
Sorry @azefiel , you are absolutely right, I forgot to commit the change for It should be up now. Thanks for the heads up. |
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 this is the best way to go about this, as we have a dedicated library to abstract routing concerns.
Adding a new route pattern seems like a straightforward solution in this case.
It looks like crossroads
's route registration facility has a flexible enough pattern matching mechanism to meet our needs (so called "rest segments" could be what we need here).
Happy to jump in a huddle any time to discuss this further if needed.
Hi @azefiel, I tried using the rest fragments, but it seems that Crossroads.js does not support having both an optional rest fragment and an optional query capturing group. So I ended up using a regular expression instead, and exposing the |
Use RegExp instead of pattern for app route, because Crossroads.js extracts the query string as part of the rest segment. This is because it does not support having both segments as optional. See: millermedeiros/crossroads.js#130
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.
Last nitpicking, just want to make sure this code is as understandable as possible for our future self 😅
This change allows to redirect to a registered app, if the first 2 parts of the hash route match a valid app, on load/re-load. For example:
apps/callcenter/queues/abc123/members
redirects toapps/callcenter
apps/cluster/tasks
redirects toapps/cluster
This enables Monster UI to load, reload or redirect to apps that use their own sub-routing system.
Normal routes (app/{appName}) and invalid routes should work as usual.