Skip to content

Conversation

@shaohuzhang1
Copy link
Contributor

fix: In workflow applications, the display of custom icons for sub applications and tools in the box below the variable selection is incorrect

…plications and tools in the box below the variable selection is incorrect
/>{{ data.label }}</span
>
</template>
</el-cascader>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code looks mostly correct with a couple of minor adjustments to enhance readability and maintainability:

  1. Attribute Order: It seems like you're trying to ensure attributes (class and @wheel) are consistently placed within specific tags (e.g., <a>, <button>, etc.). If this is a requirement, make sure each element has its properties in the same order.

  2. Whitespace Consistency: The addition of spaces after commas (,"size": "18"), colons (:), and semi-colons (;) can improve the readability, but it's already present.

  3. Code Formatting: Ensure consistent indentation. In JavaScript objects, {...} typically use two-space indentation while strings might need to be single-quoted ('string'). However, if you prefer triple quotes (`"""```"), they must span at least three lines.

Here is a slightly formatted version for better readability:

<el-cascader>
  <template #default="{ node, data }">
    <span class="flex align-center" @wheel="wheel">
      <component :is="iconComponent(`${data.type}-icon`)" 
                 class="mr-8" 
                 :size="18"><>{{ data.label }}</></span
    />
  </template>
</el-cascader>

In summary, there are no immediate technical issues, but ensuring proper formatting and attribute ordering can certainly help keep the code clean and easier to understand.

icon: this.props.model.properties.node_data?.icon,
label: this.props.model.properties.stepName,
type: this.props.model.type,
children: this.props.model.properties?.config?.fields || [],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provided code snippet seems to contain a small issue that could be resolved without altering its main functionality. Let's address it:

@@ -75,6 +75,9 @@
       },
       result.push({
         value: this.props.model.id,
+        icon: this.props.model.properties.node_data.icon || '',
         label: this.props.model.properties.stepName,
         type: this.props.model.type,
         children: this.props.model.properties.config.fields || [],
     });

Potential issue resolved:

  1. Optional Chaining: In JavaScript/TypeScript, using ?. can prevent errors if an object is nullish (null or undefined). The line where you retrieve the icon should use || '' to ensure a default string is returned in case of a missing property.

Optimization suggestion (not required but recommended):
2. Inline Conditional Logic: Consider moving the conditional logic inside the array literal, especially for better readability and potentially reducing nested checks.

This change will handle optional properties gracefully while maintaining the original intent of providing a node with an optional icon.

@shaohuzhang1 shaohuzhang1 merged commit 6faa72d into v2 Oct 10, 2025
3 of 5 checks passed
@shaohuzhang1 shaohuzhang1 deleted the pr@v2@fix_workflow branch October 10, 2025 05:55
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Oct 10, 2025

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.

Details

Instructions 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.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Oct 10, 2025

[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.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

liuruibin pushed a commit that referenced this pull request Oct 10, 2025
…plications and tools in the box below the variable selection is incorrect (#4168)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants