Skip to content
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

fix: Adjustment of workflow node name auto increment rule(#2562) #2576

Merged
merged 1 commit into from
Mar 17, 2025

Conversation

wangdan-fit2cloud
Copy link
Contributor

What this PR does / why we need it?

Summary of your change

Please indicate you've done the following:

  • Made sure tests are passing and test coverage is added if needed.
  • Made sure commit message follow the rule of Conventional Commits specification.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed.

Copy link

f2c-ci-robot bot commented Mar 17, 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.

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/test-infra repository.

Copy link

f2c-ci-robot bot commented Mar 17, 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.

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

@wangdan-fit2cloud wangdan-fit2cloud merged commit 80e7dac into main Mar 17, 2025
4 checks passed
@wangdan-fit2cloud wangdan-fit2cloud deleted the pr@main/workflow-node-name branch March 17, 2025 06:41
}
}
function getNodesName(num: number) {
console.log(props.model.properties.stepName)
const number = num
const name = props.model.properties.stepName + number
if (!props.graphModel.nodes?.some((node: any) => node.properties.stepName === name.trim())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The provided TypeScript code seems to have a few issues that could be addressed:

  1. Function Declaration: The getNodesName function declaration is missing its return type, which can lead to errors.
  2. Code Formatting: The indentation of lines 34-37 and 55 needs to be corrected for better readability.
  3. Logical Conditions: Ensure that the logic inside these conditions makes sense given the context.

Here's an optimized version with some corrections and improvements:

class AppNode extends HtmlResize.view {
  delete props.model.properties.noRender;

  if (!props.model.properties.hasOwnProperty('stepName')) {
    // Handle case where 'stepName' doesn't exist
  } else {
    const filterNodes = props.graphModel.nodes.filter(({ type }: any) => type === props.model.type);
    if (filterNodes.length > 1 && !filterNodes.every(node => node.properties.stepName === props.model.properties.stepName)) {
      getNodesName(filterNodes.filter(n => n.properties.stepName.startsWith(props.model.properties.stepName)).length - 1);
    }
  }

  function getNodesName(num: number): void {
    console.log(`${num} ${props.model.properties.stepName}`);
    // Add more implementation here as needed
  }
}

Key Changes:

  • Added return types (void) to improve clarity.
  • Fixed incorrect syntax in line 37 (const { type }: any) and corrected formatting on the next few lines.
  • Improved logic in the function call to ensure it correctly identifies unique step names.
  • Used string interpolation in the console.log statement for better readability.

These changes should improve the overall quality and functionality of the code.

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