-
Notifications
You must be signed in to change notification settings - Fork 0
Enh/nxt 4296 Component search #28
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
base: master
Are you sure you want to change the base?
Conversation
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.
Pull request overview
This PR refactors port type handling by removing the type field from the internal data model and introducing a dedicated adapter (toNodePreviewPorts) to map kind to type only at component boundaries. The main changes include:
- Removed the
includeTypeparameter fromtoExtendedPortObjectfunction - Created a new
nodePreviewAdapter.tsutility to handle thekind→typemapping for NodePreview components - Updated all NodePreview component usages to apply the adapter at the boundary
- Removed
typefield from test expectations and theExtendedPortTypeinterface
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
org.knime.ui.js/src/util/portDataMapper.ts |
Removed includeType parameter and associated logic that added type field to port objects |
org.knime.ui.js/src/util/nodePreviewAdapter.ts |
New utility function to adapt ports by adding type as alias for kind |
org.knime.ui.js/src/util/fuzzyPortTypeSearch.js |
Updated toExtendedPortObject calls to remove includeType argument |
org.knime.ui.js/src/test/utils/withPorts.js |
Removed type field assignment in port mapping |
org.knime.ui.js/src/store/nodeDescription/__tests__/nodeDescription.test.ts |
Removed type field from test expectations |
org.knime.ui.js/src/components/workflowMonitor/__tests__/WorkflowMonitorMessage.test.ts |
Added toNodePreviewPorts adapter to test expectations |
org.knime.ui.js/src/components/workflowMonitor/WorkflowMonitorMessage.vue |
Applied toNodePreviewPorts adapter when passing ports to NodePreview |
org.knime.ui.js/src/components/workflowMetadata/__tests__/WorkflowMetadata.test.ts |
Removed type field from test expectations |
org.knime.ui.js/src/components/workflowMetadata/ComponentMetadata.vue |
Applied toNodePreviewPorts adapter when constructing node preview data |
org.knime.ui.js/src/components/spaces/SpaceExplorer.vue |
Applied toNodePreviewPorts adapter to port props |
org.knime.ui.js/src/components/nodeRepository/NodeTemplate/NodeTemplate.vue |
Applied toNodePreviewPorts adapter to port props |
org.knime.ui.js/src/api/gateway-api/generated-api.ts |
Added new API types and methods for component search functionality |
org.knime.ui.js/src/api/custom-types.ts |
Removed type field from ExtendedPortType interface |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
12d8e31 to
424a027
Compare
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.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
|
|
||
| /** | ||
| * ... |
Copilot
AI
Dec 17, 2025
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.
The JSDoc comment for ComponentSearchItem contains only '...' as a description. Please provide a meaningful description explaining what a ComponentSearchItem represents, such as 'Represents a component in search results with metadata including name, type, ports, and visual information.'
| * ... | |
| * Represents a component entry returned in search results, including its name, description, type, ports, and icon information. |
| */ | ||
| inPorts?: Array<ComponentSearchItemPort>; | ||
| /** | ||
| * The node's output ports. |
Copilot
AI
Dec 17, 2025
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.
The comment refers to 'node's output ports' but this is in the ComponentSearchItem interface which represents a component, not a node. The comment should say 'The component's output ports.' for consistency with the inPorts comment on line 1247.
| * The node's output ports. | |
| * The component's output ports. |
| */ | ||
| name: string; | ||
| /** | ||
| * The description of the component as given by the component creator. |
Copilot
AI
Dec 17, 2025
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.
The comment says 'The description of the component' but this field is in ComponentSearchItemPort and should refer to the port description, not the component description. It should say 'The description of the port as given by the component creator.'
| * The description of the component as given by the component creator. | |
| * The description of the port as given by the component creator. |
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
be3930e to
7f89cab
Compare
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Reasoning behind the PR size:With these changes I've tried to tackle multiple problems that started surfacing with the component search feature. Most of which can be boiled down to "logic/features that we already have that are very similar but not quite the same". Therefore, I tried to improve composition for reusability. Some examples:
All of these things required moving files around a fair bit. Hope this helps with review |
NXT-4296 (Gateway API for component search (use HubClient SDK to call Search Service; aggregate and map entities for FE; error handling))
NXT-4296 (Gateway API for component search (use HubClient SDK to call Search Service; aggregate and map entities for FE; error handling))
NXT-4296 (Gateway API for component search (use HubClient SDK to call Search Service; aggregate and map entities for FE; error handling))
NXT-4296 (Gateway API for component search (use HubClient SDK to call Search Service; aggregate and map entities for FE; error handling))
7921794 to
cf2d489
Compare
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.
Pull request overview
Copilot reviewed 48 out of 48 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <div class="actions"> | ||
| <ValueSwitch | ||
| compact | ||
| :disabled="!nodeRepositoryLoaded" |
Copilot
AI
Dec 18, 2025
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.
The ValueSwitch component is disabled when nodeRepositoryLoaded is false, but this may create an accessibility issue. Users may not understand why the control is disabled. Consider adding a tooltip or aria-label to explain the disabled state.
| :disabled="!nodeRepositoryLoaded" | |
| :disabled="!nodeRepositoryLoaded" | |
| :title=" | |
| !nodeRepositoryLoaded | |
| ? 'The node repository is still loading. You can switch the search context once loading has finished.' | |
| : undefined | |
| " | |
| :aria-label=" | |
| !nodeRepositoryLoaded | |
| ? 'Search context switcher is disabled until the node repository has finished loading.' | |
| : 'Switch search context between nodes and components.' | |
| " |
| }; | ||
| const props = withDefaults(defineProps<Props>(), { | ||
| searchScrollPosition: 0, |
Copilot
AI
Dec 18, 2025
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.
Default prop 'searchScrollPosition' is defined but this prop doesn't exist in the Props type definition. This appears to be leftover from refactoring and should be removed.
| searchScrollPosition: 0, |
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.
this is true and very annoying that withDefaults does not complain type-wise. I saw more default by destruction but well some people like their props object (like: const { something = 0 } = defineProps() that seems to be better type checked.
NXT-4296 (Gateway API for component search (use HubClient SDK to call Search Service; aggregate and map entities for FE; error handling))
|
NXT-4296 (Gateway API for component search (use HubClient SDK to call Search Service; aggregate and map entities for FE; error handling))
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
| searchScrollPosition.value = position; | ||
| }; | ||
| const scroller = ref<InstanceType<typeof ScrollViewContainer> | null>(null); |
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.
why not use useTemplateRef
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.
It comes from older code so this line didn't change. But yeah, makes sense
| }; | ||
| const props = withDefaults(defineProps<Props>(), { | ||
| searchScrollPosition: 0, |
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.
this is true and very annoying that withDefaults does not complain type-wise. I saw more default by destruction but well some people like their props object (like: const { something = 0 } = defineProps() that seems to be better type checked.
| compact | ||
| :disabled="!nodeRepositoryLoaded" | ||
| :model-value="searchContext" | ||
| :possible-values="[ |
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.
there will be icons eventually right?
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.
Unfortunately, no. The ValueSwitch does not support that at all. I still need to sync with Peter but the design in Figma I've seen uses the whole word like I'm doing now
| @@ -56,7 +56,7 @@ const focusFirst = () => { | |||
| searchResults.value?.focusFirst(); | |||
| }; | |||
|
|
|||
| const onHelpKey = (node: NodeTemplateWithExtendedPorts) => { | |||
| const onShowNodeDetails = (node: NodeTemplateWithExtendedPorts) => { | |||
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.
rename was long overdue :D
| import CategoryTree from "./CategoryTree.vue"; | ||
| import NodeRepositoryLoader from "./NodeRepositoryLoader.vue"; | ||
| import NodeRepositoryTree from "./NodeRepositoryTree/NodeRepositoryTree.vue"; |
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.
also this aligns better with the other names I agree!
| <template v-if="nodeRepositoryLoaded"> | ||
| <SidebarSearchResults | ||
| v-if="searchIsActive" | ||
| v-show="searchContext === 'nodes'" |
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.
so we keep it in the DOM, why? To have it faster back on switch? Why don't wrap all of them (3 types) and do the show on the wrapper? Or do the if on the template (but that might be slower)? Its a bit complex having if and show at the same time on 3 items conditionally...
And if css is killing you with the wrapper display: contents is very handy 💅
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.
My main motivation is to have faster switch back, yes. Because these components are sort of heavy and they do a lot of loading upon mount (you can feel it pause briefly when you switch). I want to avoid that and given that the nodes will be the default, it's why I added the active prop for the comp search.
Why don't wrap all of them (3 types) and do the show on the wrapper?
I was doing this before, but wrapping on a div breaks the infinite scrolling because the wrapper div would now need to have height:100%, which tbh is not much but it's rather disconnected from the internal behavior.
Or do the if on the template (but that might be slower)?
Not sure what you meant by this.
But yes, I agree that having 3 v-shows is not very nice. I'll think about the wrapper div again even if I have to add a height to it. Maybe try out your fancy display: contents 😆
| numFilteredOutNodes: number; | ||
| highlightFirst?: boolean; | ||
| displayMode?: NodeRepositoryDisplayModesType; | ||
| displayMode?: Exclude<NodeRepositoryDisplayModesType, "tree">; |
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.
the other type on the skeleton was different maybe just use the same there?
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 don't want to use this type on the skeleton because it's a more generic component and I don't to tie it to the noderepository in any way.
Overall, I think the problem is that these types are a bit awkward to define. Because the settings (store context) are a super set of what the component uses so they related somewhat. But with the current folder structure the component and stores are "too far away" from each other instead of being more self-contained and related.
This is one of the motivations I have for (later) moving to a different structure similar to what I'm proposing for the hub atm
| toastPresets.workflow.addNodeToCanvas({ error }); | ||
| }; | ||
|
|
||
| const addNodeByPosition = async ( |
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.
nice to have it all in the same place - I know you wanted to to that for a longer time now...
- keyboard navigation - error handling - empty state NXT-4296 (Gateway API for component search (use HubClient SDK to call Search Service; aggregate and map entities for FE; error handling))


No description provided.