-
Notifications
You must be signed in to change notification settings - Fork 73
[BI Data Mapper] Improve data mapper converted-variable UI #1545
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: release/bi-1.8.x
Are you sure you want to change the base?
Changes from all commits
61aeef2
bd46697
f5e7e6a
0a00baf
9dca054
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -149,15 +149,25 @@ export function InputNodeWidget(props: InputNodeWidgetProps) { | |||||||||||||||||
| onMouseLeave={onMouseLeave} | ||||||||||||||||||
| > | ||||||||||||||||||
| <span className={classes.label}> | ||||||||||||||||||
| {(fields || dmType.convertedField || isConvertibleType) && ( | ||||||||||||||||||
| {dmType.category !== InputCategory.ConvertedVariable ? ( | ||||||||||||||||||
| (fields || dmType.convertedField || isConvertibleType) && ( | ||||||||||||||||||
| <Button | ||||||||||||||||||
| id={"expand-or-collapse-" + id} | ||||||||||||||||||
| appearance="icon" | ||||||||||||||||||
| tooltip="Expand/Collapse" | ||||||||||||||||||
| onClick={handleExpand} | ||||||||||||||||||
| data-testid={`${id}-expand-icon-record-source-node`} | ||||||||||||||||||
| > | ||||||||||||||||||
| {expanded ? <Codicon name="chevron-down" /> : <Codicon name="chevron-right" />} | ||||||||||||||||||
| </Button> | ||||||||||||||||||
| ) | ||||||||||||||||||
| ) : ( | ||||||||||||||||||
| <Button | ||||||||||||||||||
| id={"expand-or-collapse-" + id} | ||||||||||||||||||
| id={"converted-icon-" + id} | ||||||||||||||||||
| appearance="icon" | ||||||||||||||||||
| tooltip="Expand/Collapse" | ||||||||||||||||||
| onClick={handleExpand} | ||||||||||||||||||
| data-testid={`${id}-expand-icon-record-source-node`} | ||||||||||||||||||
| tooltip="Type defined variable" | ||||||||||||||||||
| > | ||||||||||||||||||
| {expanded ? <Codicon name="chevron-down" /> : <Codicon name="chevron-right" />} | ||||||||||||||||||
| <Icon name="arrow-down-right" /> | ||||||||||||||||||
| </Button> | ||||||||||||||||||
| )} | ||||||||||||||||||
| {label} | ||||||||||||||||||
|
|
@@ -167,7 +177,7 @@ export function InputNodeWidget(props: InputNodeWidgetProps) { | |||||||||||||||||
| <FieldActionButton | ||||||||||||||||||
| id={"field-action-edit-" + id} | ||||||||||||||||||
| tooltip="Edit" | ||||||||||||||||||
| iconName="settings-gear" | ||||||||||||||||||
| iconName="edit" | ||||||||||||||||||
| onClick={async () => await context.createConvertedVariable(dmType.name, true, dmType.typeName)} | ||||||||||||||||||
| /> | ||||||||||||||||||
| )} | ||||||||||||||||||
|
|
@@ -202,27 +212,21 @@ export function InputNodeWidget(props: InputNodeWidgetProps) { | |||||||||||||||||
| )} | ||||||||||||||||||
| </TreeContainer> | ||||||||||||||||||
| {expanded && dmType.convertedField && | ||||||||||||||||||
| <> | ||||||||||||||||||
| <ArrowWidget direction="down" /> | ||||||||||||||||||
| <InputNodeWidget | ||||||||||||||||||
| id={dmType.convertedField.name} | ||||||||||||||||||
| dmType={dmType.convertedField} | ||||||||||||||||||
| engine={engine} | ||||||||||||||||||
| getPort={getPort} | ||||||||||||||||||
| context={context} | ||||||||||||||||||
| valueLabel={dmType.convertedField.name} | ||||||||||||||||||
| focusedInputs={focusedInputs} | ||||||||||||||||||
| /> | ||||||||||||||||||
| </> | ||||||||||||||||||
| <InputNodeWidget | ||||||||||||||||||
| id={dmType.convertedField.name} | ||||||||||||||||||
| dmType={dmType.convertedField} | ||||||||||||||||||
| engine={engine} | ||||||||||||||||||
| getPort={getPort} | ||||||||||||||||||
| context={context} | ||||||||||||||||||
| valueLabel={dmType.convertedField.name} | ||||||||||||||||||
| focusedInputs={focusedInputs} | ||||||||||||||||||
| /> | ||||||||||||||||||
| } | ||||||||||||||||||
| {expanded && isConvertibleType && !dmType.convertedField && | ||||||||||||||||||
| <> | ||||||||||||||||||
| <ArrowWidget direction="down" /> | ||||||||||||||||||
| <PayloadWidget | ||||||||||||||||||
| onClick={async () => await context.createConvertedVariable(headerLabel, true, undefined, dmType.typeName)} | ||||||||||||||||||
| typeName={dmType.typeName} | ||||||||||||||||||
| /> | ||||||||||||||||||
| </> | ||||||||||||||||||
| <PayloadWidget | ||||||||||||||||||
| onClick={async () => await context.createConvertedVariable(headerLabel, true, undefined, dmType.typeName)} | ||||||||||||||||||
| typeName={dmType.typeName.toUpperCase()} | ||||||||||||||||||
| /> | ||||||||||||||||||
|
Comment on lines
+226
to
+229
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same
🛡️ Proposed fix- <PayloadWidget
- onClick={async () => await context.createConvertedVariable(headerLabel, true, undefined, dmType.typeName)}
- typeName={dmType.typeName.toUpperCase()}
- />
+ <PayloadWidget
+ onClick={async () => await context.createConvertedVariable(headerLabel, true, undefined, dmType.typeName)}
+ typeName={(dmType.typeName ?? typeKind).toUpperCase()}
+ />📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typeName is a required field, interfaces will be refactored in a separate PR
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
🐰✨ ✏️ Learnings added
🧠 Learnings used |
||||||||||||||||||
| } | ||||||||||||||||||
| </> | ||||||||||||||||||
| ); | ||||||||||||||||||
|
|
||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -152,21 +152,31 @@ export function ObjectOutputWidget(props: ObjectOutputWidgetProps) { | |||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| </span> | ||||||||||||||||||||||||||||||||||||||||
| <span className={classes.label}> | ||||||||||||||||||||||||||||||||||||||||
| <Button | ||||||||||||||||||||||||||||||||||||||||
| id={"expand-or-collapse-" + id} | ||||||||||||||||||||||||||||||||||||||||
| appearance="icon" | ||||||||||||||||||||||||||||||||||||||||
| tooltip="Expand/Collapse" | ||||||||||||||||||||||||||||||||||||||||
| onClick={handleExpand} | ||||||||||||||||||||||||||||||||||||||||
| data-testid={`${id}-expand-icon-mapping-target-node`} | ||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||
| {expanded ? <Codicon name="chevron-down" /> : <Codicon name="chevron-right" />} | ||||||||||||||||||||||||||||||||||||||||
| </Button> | ||||||||||||||||||||||||||||||||||||||||
| {outputType.category !== InputCategory.ConvertedVariable ? ( | ||||||||||||||||||||||||||||||||||||||||
| <Button | ||||||||||||||||||||||||||||||||||||||||
| id={"expand-or-collapse-" + id} | ||||||||||||||||||||||||||||||||||||||||
| appearance="icon" | ||||||||||||||||||||||||||||||||||||||||
| tooltip="Expand/Collapse" | ||||||||||||||||||||||||||||||||||||||||
| onClick={handleExpand} | ||||||||||||||||||||||||||||||||||||||||
| data-testid={`${id}-expand-icon-mapping-target-node`} | ||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||
| {expanded ? <Codicon name="chevron-down" /> : <Codicon name="chevron-right" />} | ||||||||||||||||||||||||||||||||||||||||
| </Button> | ||||||||||||||||||||||||||||||||||||||||
| ) : ( | ||||||||||||||||||||||||||||||||||||||||
| <Button | ||||||||||||||||||||||||||||||||||||||||
| id={"converted-icon-" + id} | ||||||||||||||||||||||||||||||||||||||||
| appearance="icon" | ||||||||||||||||||||||||||||||||||||||||
| tooltip="Type defined variable" | ||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||
| <Icon name="arrow-left-up" /> | ||||||||||||||||||||||||||||||||||||||||
| </Button> | ||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||
| {label} | ||||||||||||||||||||||||||||||||||||||||
| {outputType.category === InputCategory.ConvertedVariable && ( | ||||||||||||||||||||||||||||||||||||||||
| <FieldActionButton | ||||||||||||||||||||||||||||||||||||||||
| id={"field-action-edit-" + id} | ||||||||||||||||||||||||||||||||||||||||
| tooltip="Edit" | ||||||||||||||||||||||||||||||||||||||||
| iconName="settings-gear" | ||||||||||||||||||||||||||||||||||||||||
| iconName="edit" | ||||||||||||||||||||||||||||||||||||||||
| onClick={async () => await context.createConvertedVariable(outputType.name, false, outputType.typeName)} | ||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -192,30 +202,24 @@ export function ObjectOutputWidget(props: ObjectOutputWidgetProps) { | |||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||
| </TreeContainer> | ||||||||||||||||||||||||||||||||||||||||
| {expanded && outputType.convertedField && | ||||||||||||||||||||||||||||||||||||||||
| <> | ||||||||||||||||||||||||||||||||||||||||
| <ArrowWidget direction="up" /> | ||||||||||||||||||||||||||||||||||||||||
| <ObjectOutputWidget | ||||||||||||||||||||||||||||||||||||||||
| engine={engine} | ||||||||||||||||||||||||||||||||||||||||
| id={`${OBJECT_OUTPUT_TARGET_PORT_PREFIX}.${outputType.convertedField.name}`} | ||||||||||||||||||||||||||||||||||||||||
| outputType={outputType.convertedField} | ||||||||||||||||||||||||||||||||||||||||
| typeName={outputType.convertedField.typeName} | ||||||||||||||||||||||||||||||||||||||||
| value={undefined} | ||||||||||||||||||||||||||||||||||||||||
| getPort={getPort} | ||||||||||||||||||||||||||||||||||||||||
| context={context} | ||||||||||||||||||||||||||||||||||||||||
| mappings={mappings} | ||||||||||||||||||||||||||||||||||||||||
| valueLabel={outputType.convertedField.name} | ||||||||||||||||||||||||||||||||||||||||
| originalTypeName={outputType.convertedField.typeName} | ||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||
| </> | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| <ObjectOutputWidget | ||||||||||||||||||||||||||||||||||||||||
| engine={engine} | ||||||||||||||||||||||||||||||||||||||||
| id={`${OBJECT_OUTPUT_TARGET_PORT_PREFIX}.${outputType.convertedField.name}`} | ||||||||||||||||||||||||||||||||||||||||
| outputType={outputType.convertedField} | ||||||||||||||||||||||||||||||||||||||||
| typeName={outputType.convertedField.typeName} | ||||||||||||||||||||||||||||||||||||||||
| value={undefined} | ||||||||||||||||||||||||||||||||||||||||
| getPort={getPort} | ||||||||||||||||||||||||||||||||||||||||
| context={context} | ||||||||||||||||||||||||||||||||||||||||
| mappings={mappings} | ||||||||||||||||||||||||||||||||||||||||
| valueLabel={outputType.convertedField.name} | ||||||||||||||||||||||||||||||||||||||||
| originalTypeName={outputType.convertedField.typeName} | ||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| {expanded && isConvertibleType && !outputType.convertedField && | ||||||||||||||||||||||||||||||||||||||||
| <> | ||||||||||||||||||||||||||||||||||||||||
| <ArrowWidget direction="up" /> | ||||||||||||||||||||||||||||||||||||||||
| <PayloadWidget | ||||||||||||||||||||||||||||||||||||||||
| onClick={async () => await context.createConvertedVariable(valueLabel, false, undefined, outputType.typeName)} | ||||||||||||||||||||||||||||||||||||||||
| typeName={outputType.typeName} | ||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||
| </> | ||||||||||||||||||||||||||||||||||||||||
| <PayloadWidget | ||||||||||||||||||||||||||||||||||||||||
| onClick={async () => await context.createConvertedVariable(valueLabel, false, undefined, outputType.typeName)} | ||||||||||||||||||||||||||||||||||||||||
| typeName={outputType.typeName.toUpperCase()} | ||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
218
to
223
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Find IOType definition and typeName property
fd ".*\.(ts|tsx)$" workspaces/ballerina/data-mapper --type f | head -20 | xargs grep -l "IOType" | head -5Repository: wso2/vscode-extensions Length of output: 48 🏁 Script executed: #!/bin/bash
# Search for IOType interface/type definition
rg "type IOType|interface IOType" --type ts -A 5 workspaces/ballerina/Repository: wso2/vscode-extensions Length of output: 1139 🏁 Script executed: #!/bin/bash
# Get context around lines 219-224 in the target file
cat -n workspaces/ballerina/data-mapper/src/components/Diagram/Node/ObjectOutput/ObjectOutputWidget.tsx | sed -n '210,235p'Repository: wso2/vscode-extensions Length of output: 732 🏁 Script executed: #!/bin/bash
# Find type of outputType and understand the isConvertibleType guard
cat -n workspaces/ballerina/data-mapper/src/components/Diagram/Node/ObjectOutput/ObjectOutputWidget.tsx | sed -n '75,95p'Repository: wso2/vscode-extensions Length of output: 804 🏁 Script executed: #!/bin/bash
# Check the broader context to understand typeKind
cat -n workspaces/ballerina/data-mapper/src/components/Diagram/Node/ObjectOutput/ObjectOutputWidget.tsx | sed -n '1,50p'Repository: wso2/vscode-extensions Length of output: 2599 🏁 Script executed: #!/bin/bash
# Check TypeKind enum definition
rg "export enum TypeKind|export const TypeKind" --type ts -A 10 workspaces/ballerina/ballerina-core/Repository: wso2/vscode-extensions Length of output: 1104 🏁 Script executed: #!/bin/bash
# Check if there are any usages or initialization patterns for outputType.typeName
rg "outputType\.typeName" --type ts -B 2 -A 2 workspaces/ballerina/data-mapper/src/components/Diagram/ | head -50Repository: wso2/vscode-extensions Length of output: 1578
Use optional chaining or provide a safe fallback: 💡 Suggested approach- typeName={outputType.typeName.toUpperCase()}
+ typeName={outputType.typeName?.toUpperCase()}Or with explicit fallback: - typeName={outputType.typeName.toUpperCase()}
+ typeName={(outputType.typeName ?? typeKind).toUpperCase()}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typeName is a required field, interfaces will be refactored in a separate PR
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
✏️ Learnings added
🧠 Learnings used |
||||||||||||||||||||||||||||||||||||||||
| </> | ||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.