-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add initial component interfaces & basic node rendering #32
Conversation
switch (field.type) { | ||
case 'string': { | ||
el = ( | ||
<EuiFlexItem key={idx}> |
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.
using index as a key isn't always a problem. But if the list can change over time, will it cause issues and even potentially introduce bugs? Do we have other unique identifier in IComponentField
that we can use and the key here?
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.
Using the index as a key for items in a list is a common JS pattern since it is calculated on-the-fly for each render. This will likely change a lot as we iterate so prefer to leave for now.
<EuiFlexItem> | ||
{props.inputFields?.map((field, idx) => { | ||
let el; | ||
switch (field.type) { |
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.
nit: instead of using a switch statement, consider refactoring it to use a mapping object for better clarity and scalability. This also makes adding new input types in the future easier
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.
Thanks. Likely this will be moved into more complex helper fns as the number of object types will grow, and the complexity to render them will grow. Prefer to just leave as a simple switch for now.
a9b9a7b
to
7d79df1
Compare
Signed-off-by: Tyler Ohlsen <[email protected]>
7d79df1
to
812989d
Compare
Signed-off-by: Tyler Ohlsen <[email protected]> (cherry picked from commit d3bb6bb)
Signed-off-by: Tyler Ohlsen <[email protected]> (cherry picked from commit d3bb6bb) Co-authored-by: Tyler Ohlsen <[email protected]>
Description
This PR accomplishes 3 main things:
WorkflowComponent
React component that's purpose is to take in a component instance (a particular k-NN index, for example), and dynamically render based on its configuration. An example with more details is shown below.Example:
WorkflowComponent
building out instances of a text embedding processor and a k-NN index.screen-capture.15.webm
Adding a
rapid
label to indicate this PR may not be perfectly clean or have tests. It is for rapid iteration.Issues Resolved
Makes progress on #4.
Check List
--signoff
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.