-
Notifications
You must be signed in to change notification settings - Fork 117
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
Fix dynamic base path resolving #1770
Fix dynamic base path resolving #1770
Conversation
Any updates to this or anything I can help with? 😀 |
Hey @oodamien - are there any information regarding this PR? We heavily relying on this issue, because of routing in cloud services. |
I appreciate your efforts if you find a way to do this. Unless I did something wrong by doing a real server build with UI having this PR, it's failing to load. Angular dev instance is a bit different way to run UI. We have had this issue on table a bit too long and it'd be nice to get it to work but path to make it work has been a little unclear. Angular do have build option to change context path but obviously it's no use if you want it to be dynamic. |
If I remove I'm not sure if removing base href is correct way to do it, if it is then I'd expect we have some of those hardcoded paths in app code itself. |
Now I see - when the ui is build the base href is injected in a static way during the build time - I will try to find a solution for that. The dev-Runtime uses node.js to serve the content which adjusts the base href regarding the base path the app is accessed. |
Yeah, if you do
That's where base ref is coming from and getting replaced if it's defined in index.html. |
Hey @jvalkeal - I provided a slightly bigger change to what I already did 😄- but it is working for me now. Steps I did to check if everything is working like expected:
server:
servlet:
context-path: /scdf
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dataflow-ui</artifactId>
<version>3.2.0-SNAPSHOT</version>
</dependency>
I only noticed some 404 during creation of a task but I guess this is correct because the input validates if a task is already present - right? I also checked Can you check if this is also working for you? |
Sorry for the noise - I moved /assets/ into the service and forgot to remove it in the component markup. |
Thx, I'll check it out. |
@klopfdreh: Thanks for picking up this ambiguous portion of the Dashboard! A few team members attempted to solve this, but it warranted breaking changes, so it is incredible to see the progress without dramatic refactoring - kudos to you! |
@sabbyanandan: I try my best and we also need to have the option to configure the context path. I hope I don't miss any other scenarios. |
I patched the Spring Cloud Data Flow Server (Version 2.9.0) and applied the Spring Cloud Data Flow UI (3.2.0-SNAPSHOT) of this PR to it. As of the Release Notes those Versions should be compatible. This patched version I deployed in a cloud environment and did some tests.
During the navigation I noticed no issues within the dev console of Chrome. But two little issues are:
If you navigate through the UI normally however there are no other issues I noticed, yet. |
I think we can fix this if we add a |
|
||
const routes: Routes = [ | ||
{ | ||
path: '', | ||
path: UrlUtilities.calculateBaseApiUrl(), |
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.
We don't have a "landing page" in UI and I think this was used to redirect to apps page which doesn't happen anymore.
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.
Can you take care of this? Just take the commits from my branch and apply the fixes to it.
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.
I can yes.
Right, we've moved repo main branches to next minor dev version(dataflow Anyway, thx a lot as this work allows some nice setups. I don't yet know if it's possible backport this to dataflow |
Hey, I just forgot to mention that we have OAuth Security enabled within our infrastructure. We use Authorization Code Flow and it redirects also to the right path based on the contextPath. So this is working, too. I keep an eye on your polish commits so that I see what I broke regarding the linting. During the build I didn’t saw any warnings - maybe it would be good to fail the build if linting reports issues. |
Ah good to know if you didn't things immediately break up with oauth. For linting I think we don't currently fail for it but moved to eslint so that we get better support to use prettier and format code but currently at main branch I get:
And that result some real linting errors with your PR. That's what I meant that eslint migration is a still in progress as we should fail PR checks if linter fails. We're trying to get into point were you can run |
Thanks a lot for information - if I provide any PR in future I am going to run the linting first. 👍 |
I polished this PR a little when merged:
|
@klopfdreh server:
port: 8337
servlet:
context-path: /scdf Though, the dashboard still breaks at my end? The JSON from
The jar has |
I just had a look into the 3.2.2 tag and didn't noticed any of my changes - I guess they are not released, yet. @oodamien - I hope I didn't miss anything. |
Yes, it's not release yet, it will be include in 2.10 release |
Addresses issue: #747
The context path is now preserved from the initial call so that if
server.servlet.context-path
is set the ui automatically adopts it.I did some initial tests, but would you be so kind and also test the functionality of the ui, so that there are no other issues I didn't figured out, yet.
As you can see in the following screenshots the "demoContext" base href is preserved while navigating.
This is a call against the dashboard uri:
This is a call against the tasks uri: