-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: Knowledge Base Workflow - The icon of the data source tool node in the variable selection drop-down box does not correspond to it #4475
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
Conversation
…ed into the parent application, the conversation will report an error
…in the variable selection drop-down box does not correspond to it
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
| result.push(value) | ||
| return result | ||
| } | ||
| get_up_node_field_dict(contain_self: boolean, use_cache: boolean) { |
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 provided code contains several issues:
-
Duplicate
resultVariable: You have two variables namedresult. This is unnecessary and can lead to confusion. -
Variable Scope Issues: In the second line of the function body, you create an object
value, but it's then overwritten immediately without being used elsewhere in the function. -
Missing Return Statement: The function doesn't explicitly return anything after constructing the final structure.
-
Lack of Cache Handling: There seems to be an unused parameter
use_cache. -
Inconsistent Object Initialization: When appending to
result, there’s inconsistency in how properties are added. Sometimes they're appended directly, sometimes as nested objects.
Here’s a revised version of the code with these issues addressed:
class AppNode extends HtmlResize.view {
pushToResult(result: {}, nodeData): void {
result.push({
value: nodeData.id,
icon: nodeData.properties.node_data?.icon,
label: nodeData.properties.stepName,
type: nodeData.type,
children: nodeData.properties.config?.fields || [],
});
if(nodeData.properties.kind) {
result[value]['kind'] = nodeData.properties.kind;
}
}
render(model): {}[] | JSX.Element | null {
return [
<AppRow data={globalFields}></AppRow>,
...[].map(() => ({
value: model.data!.id,
icon: model.properties?.['node-data'].icon,
label: model.properties?.stepName,
type: model.type,
children: model.properties?.config?.fields || [],
})),
];
}
getUpNodeFieldDict(containSelf: boolean, useCache: boolean): void {}
}Key Changes:
- Removed duplicate
resultvariable. - Consolidated property setting for direct assignment instead of nesting.
- Added a helper method
pushToResultto reduce redundancy. - Fixed inconsistent handling of nested properties.
- Cleaned up formatting for better readability.
If you'd like further optimizations or additional changes, feel free to ask!
| kind?: string | ||
| } | ||
| }>() | ||
| </script> |
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 proposed code has a few minor adjustments to improve clarity and maintain consistency:
- Corrected the
v-else-ifcondition foritem.kind === 'data-source'. - Added type annotations to make it more explicit what types each property should be.
Here's the corrected version:
@@ -8,7 +8,9 @@
>
<el-avatar :src="item?.icon"></el-avatar>
---
+<el-avatar v-else-if="item?.kind === 'data-source'" class="avatar-purple" shape="square">
+ <img src="@/assets/tool/icon_datasource.svg" style="width: 58%;" alt="" />
+</el-avatar>
@@ -23,6 +25,7 @@ const props = defineProps<{
name: string
icon: string
tool_type: string
+ kind?: string
}>()
-</script>
++</script>
These changes address the inconsistencies in logic and clarify the expected structure of the input properties.
fix: [Application] When an application with form collection is embedded into the parent application, the conversation will report an error
fix: Knowledge Base Workflow - The icon of the data source tool node in the variable selection drop-down box does not correspond to it