Skip to content

Conversation

@shaohuzhang1
Copy link
Contributor

fix: Error parameter not popped up prompt during variable splitting and parameter extraction node verification

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Oct 22, 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 22, 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

})
}
onMounted(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are no irregularities or significant issues with the provided code snippet. The code appears to be correctly structured and contains typical practices for form validation using El-form from Element UI in Vue.js.

Suggested Optimization:

1. Error Handling in validate Function:

  • Although there's already error handling in this part of the code using .catch(), it could benefit from adding a more clear message when an error occurs. This can help debugging and improve user experience if something goes wrong.
try:
    await VariableSplittingRef.value.validate()
except ValidationErrors as e:
    throw new Error(`Validation failed for variable spli<|fim_suffix|>on will then catch and reject this promise with additional data about the validation errors, including details such as the affected node and the specific error messages. If successful, the validated result is returned normally.

})
}
onMounted(() => {
set(props.nodeModel, 'validate', validate)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are two main issues in this code:

  1. The message string in the validation rule is not localized correctly when using internationalization library $t.

  2. There's an error handling block inside validate() where it catches rejection, but it incorrectly returns { node: props.nodeModel, errMessage: err }. This might prevent further actions from being processed correctly.

Suggested Changes

const rules = computed(() => ({
-  variable_list: [
+  variable_list: {
     required: true,
     message: $t(
       'views.applicationWorkflow.nodes.variableSplittingNode.variableListPlaceholder',
     ),
-    trigger: 'blur'
+    },
+    trigger: ['blur', 'change'],
  }),
}))

Explanation of changes:

  • Added braces to make the message property inline with other properties of the same level, which makes object syntax cleaner.
  • Enhanced the trigger to include both blur and change events (trigger: ['blur', 'change']) to ensure that the form item checks if all required fields have been filled without losing focus after changing values.

Regarding the second issue of returning the promise directly instead of passing it through reject (which would require additional code elsewhere to handle), I think the correct approach is to either propagate errors properly so they can be handled higher up in your application logic, or to log them appropriately within the catch block if there's no possibility of handling them further. If you're confident these errors won't need to be propagated, leaving them caught should be sufficient for debugging purposes. But usually, it would best practice to fix what caused the initial failure rather than ignore it silently.

return {variable['field']: {'type': variable['parameter_type'], 'description': (variable.get('desc') or ""),
'title': variable['label']} for variable in
variable_list}

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 appears to be generating property settings based on a list of variables with fields like field, parameter_type, desc, and label. The main issue is that if there's no description ('desc') provided for a variable, it currently raises an error because you're trying to access None properties directly.

I suggest:

  1. Replace the line: 'type': variable['type'], 'description': (variable.get('desc') or ""),
  2. With this one: 'type': variable['type'], 'description': str((variable.get('desc', '')),

This modification ensures that if variable['desc'] is None, it defaults to an empty string, avoiding any runtime errors.

@shaohuzhang1 shaohuzhang1 merged commit c5dfbde into v2 Oct 22, 2025
4 of 5 checks passed
@shaohuzhang1 shaohuzhang1 deleted the pr@v2@fix_workflow branch October 22, 2025 09:57
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