Skip to content

fix: The search and positioning status is incorrect. By default, only the node being located needs to be selected, and not all nodes found in the search need to be selected#4863

Merged
shaohuzhang1 merged 1 commit intov2from
pr@v2@fix_workflow_search
Mar 11, 2026

Conversation

@shaohuzhang1
Copy link
Contributor

fix: The search and positioning status is incorrect. By default, only the node being located needs to be selected, and not all nodes found in the search need to be selected

… the node being located needs to be selected, and not all nodes found in the search need to be selected
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Mar 11, 2026

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 Mar 11, 2026

[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

@shaohuzhang1 shaohuzhang1 merged commit cb4ef4a into v2 Mar 11, 2026
3 checks passed
@shaohuzhang1 shaohuzhang1 deleted the pr@v2@fix_workflow_search branch March 11, 2026 03:18
console.log('onClearSearchSelect')
}

// 高亮选中关键字
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the provided code snippet, there are several areas that could be improved:

  1. Redundant Code: The props.nodeModel.setSelected(true) line is duplicated in both selectOn and focusOn. It should only be executed once if necessary.

  2. Variable Consistency: The naming convention for variables like keyWord, currentKeyWord, and their properties can be more consistent to help with readability and reduce errors.

  3. Log Statements Simplification: Instead of logging the keyword every time it changes, consider using console.debug() or remove it altogether unless debugging is needed.

  4. Documentation and Comments: Add comments explaining the purpose of each function and variable to improve maintainability.

  5. Use Cases: Consider how these functions might be used outside of the context shown here to ensure they cover all use cases efficiently.

Here's an optimized version of the code with some of these improvements:

import { ref } from 'vue';

export default {
  setup(props) {
    const keyWord = ref('');
    const currentKeyWord = ref(false);

    const selectOn = (kw: string) => {
      props.nodeModel.selected = true;
      keyWord.value = kw;
      currentKeyWord.value = false;
      console.log('selected', kw);
    };

    const focusOn = (kw: string) => {
      props.nodeModel.selected = true;
      currentKeyWord.value = true;
      console.log('focused on', kw);
    };

    const clearSelectOn = () => {
      keyWord.value = '';
      currentKeyWord.value = false;
      console.log('cleared search selection');
    };

    return {
      keyWord,
      currentKeyWord,
      selectOn,
      focusOn,
      clearSelectOn,
    };
  },
};

These optimizations make the code cleaner and easier to maintain.

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.

1 participant