Fix incorrect namespace rendering in node Overview page#80
Merged
bburda merged 2 commits intoMay 19, 2026
Merged
Conversation
Display the actual ROS 2 node namespace in the Overview page instead of always rendering "/" for namespaced nodes. This keeps the node details view consistent with the namespace grouping shown in the sidebar/entity tree.
There was a problem hiding this comment.
Pull request overview
Fixes the node Overview page so it shows the actual ROS 2 namespace instead of always rendering / for namespaced nodes (closes #79). The fix derives namespace/node_name from the node's FQN when the API hasn't pre-populated them, and enriches app tree nodes loaded as function hosts with fqn/namespace/node_name derived from the x-medkit.ros2.node extension.
Changes:
- In
handleAppSelection, derivenamespaceandnode_namefromfqn(ornode.name) whenappData.namespace/node_nameare missing. - In
loadChildrenfor theisFunctionbranch, parsex-medkit.ros2.nodeand attach{ fqn, namespace, node_name }to each app host'sdata. - Update the host object type/comment to reflect the
x-medkitshape.
Comments suppressed due to low confidence (1)
src/lib/store.ts:1169
- The PR description states that
loadChildren()is updated "for component hosts", but the enrichment withx-medkit.ros2.node,fqn,namespace, andnode_nameis only applied in theisFunctionbranch (apps loaded via/functions/{function_id}/hosts). TheisComponentOrSubcomponentbranch above (line 1090) still maps apps viatoTreeNodewithout setting adatafield, so app tree nodes loaded as component children do not get the same enrichment. For those,handleAppSelectionwill seenode.dataasundefinedand have to fall back tonode.name, which is not guaranteed to contain the namespace. Either also enrich apps in the component-hosts branch (to match the description and behavior), or update the PR description to clarify that only function-hosts are enriched and that the component-hosts case relies on thehandleAppSelectionfallback.
// Hosts response contains objects with {id, name, href, x-medkit: {ros2: {node: "/ns/name"}}}
loadedEntities = hosts.map((host: unknown) => {
const hostObj = host as {
id?: string;
name?: string;
href?: string;
'x-medkit'?: { ros2?: { node?: string }; is_online?: boolean };
};
const hostId = hostObj.id || '';
const hostName = hostObj.name || hostObj.id || '';
const fqn = hostObj['x-medkit']?.ros2?.node || '';
// Derive namespace from FQN: "/namespace/app_name" -> namespace: "namespace"
const lastSlash = fqn.lastIndexOf('/');
const namespace = lastSlash > 0 ? fqn.substring(0, lastSlash) : '/';
const nodeName = lastSlash >= 0 ? fqn.substring(lastSlash + 1) : hostName;
return {
id: hostId,
name: hostName,
type: 'app',
href: hostObj.href || `${path}/${hostId}`,
path: `${path}/${hostId}`,
hasChildren: false,
isLoading: false,
isExpanded: false,
data: { fqn, namespace, node_name: nodeName },
};
});
bburda
reviewed
May 17, 2026
Contributor
bburda
left a comment
There was a problem hiding this comment.
One blocking issue: the namespace fix only covers the Functions-view path, not the main Component > App navigation. Details inline.
bburda
approved these changes
May 19, 2026
Contributor
bburda
left a comment
There was a problem hiding this comment.
LGTM! Thanks for contribution!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Display the actual ROS 2 node namespace in the Overview page instead of always rendering "/" for namespaced nodes.
This keeps the node details view consistent with the namespace grouping shown in the sidebar/entity tree.
Pull Request
Summary
Fix incorrect namespace rendering in the node Overview page.
Previously, the node details view could show
/as the namespace even when the node was actually running under a custom namespace. This happened because the app selection path was only usingappData.namespaceandappData.fqnwhen they were already populated, and the host data loaded from the backend was not always enriched with ROS 2 node namespace information.This PR fixes the root cause in two places:
handleAppSelection(), the namespace is now derived from the FQN whennamespaceis missing.loadChildren()for component hosts, the host data is now enriched withx-medkit.ros2.node, and the app node stores derivedfqn,namespace, andnode_namevalues.As a result, the Overview page now displays the actual ROS 2 node namespace instead of always rendering
/, and the node details view stays consistent with the namespace grouping shown in the sidebar/entity tree.Issue
Link the related issue (required):
Type
Testing
Tested locally in the provided VSCode devcontainer environment with ROS 2 Jazzy on Ubuntu using Google Chrome.
Verification steps:
ros2_medkit_gatewayros2_medkit_web_ui/for namespaced nodesAdditionally verified with:
npm run lintnpm run buildnpm run devChecklist
npm run lint)npm run build)