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

link to dashboard from sidebar does not work when httpNodeRoot is set #163

Closed
Steve-Mcl opened this issue Aug 31, 2023 · 1 comment · Fixed by #167
Closed

link to dashboard from sidebar does not work when httpNodeRoot is set #163

Steve-Mcl opened this issue Aug 31, 2023 · 1 comment · Fixed by #167
Assignees

Comments

@Steve-Mcl
Copy link
Contributor

Reported on forum: https://discourse.nodered.org/t/dashboard-2-0-pre-alpha-available/80142/86?u=steve-mcl

@Steve-Mcl
Copy link
Contributor Author

I have the fix for this as I needed to get it working to review #164

Main.js

/**
 * Configure SocketIO Client to Interact with Node-RED
 */
// inspect the current URL to determine the correct path to use
const url = new URL(window.location.href)
// determine the base path to use (everything before the first /dashboard) // TODO: determine what to do when /dashboard is called something else (support multiple dashboards github #1 )
const basePath = url.pathname.split('/dashboard')[0]
const path = basePath + '/dashboard/socket.io'
const socket = io({
    path
})

ui_base.html

    function uiLink (name, path) {
        const base = RED.settings.httpNodeRoot || '/'
        const basePart = base.endsWith('/') ? base : `${base}/`
        const dashPart = path.startsWith('/') ? path.slice(1) : path
        const fullPath = `${basePart}${dashPart}`
        return `<div class="red-ui-sidebar-header"><label>${name}</label><a id="open-dashboard" href="${fullPath}" target="nr-dashboard" class="editor-button editor-button-small nr-db-sb-list-header-button">Open Dashboard<i style="margin-left: 3px;" class="fa fa-external-link"></i></a></div>`
    }

@Steve-Mcl Steve-Mcl self-assigned this Sep 1, 2023
Steve-Mcl added a commit that referenced this issue Sep 1, 2023
@Steve-Mcl Steve-Mcl linked a pull request Sep 1, 2023 that will close this issue
11 tasks
@github-project-automation github-project-automation bot moved this from Backlog to Done in Dashboard Backlog Sep 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant