Fix dashboard not working when custom httpNodeRoot
path is set
#167
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #163
Description
This is a temporary* fix to get dashboard2 working when the user has set
httpNodePath
to move the express endpoints.I needed to fix this to review #164 - so raised it while fresh in mind.
*temporary
There is currently no way to know (in main.js) what the base path of the Node-RED instance is but we need this to setup the socket.io.
While #23 is unresolved, this is not an issue since the dashboard is hard coded to be
/dashboard
so we will always be able to determine the base path by grabbing everything before/dashboard
from the pages href. But when #23 is implemented, we will need a way to distinguish the following possible URLshttp://xxxxx:port/nr/api/v1/section1/page2
// dashboard was namedsection1
so base URL ishttp://xxxxx:port/nr/api/v1
http://xxxxx:port/nr/api/v1/section1/page2
// dashboard was namedv1
so base URL ishttp://xxxxx:port/nr/api/
http://xxxxx:port/nr/api/v1/page/2
// dashboard was namedv1
so base URL ishttp://xxxxx:port/nr/api/
http://xxxxx:port/nr/api/v1/pages/2
// dashboard was namedpages
so base URL ishttp://xxxxx:port/nr/api/v1
Related Issue(s)
#163
Checklist
flowforge.yml
?flowforge/helm
to update ConfigMap Templateflowforge/CloudProject
to update values for Staging/ProductionLabels
backport
labelarea:migration
label