Skip to content

Conversation

@shaohuzhang1
Copy link
Contributor

fix: The loop nodes in the canvas are prohibited from being copied into the loop body, and the continue and break nodes inside the loop body are also prohibited from being copied into the loop body

…to the loop body, and the continue and break nodes inside the loop body are also prohibited from being copied into the loop body
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Dec 9, 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 Dec 9, 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

selected.nodes = selected.nodes.filter((n: any) => nodes?.includes(n.type))
if (selected && (selected.nodes || selected.edges)) {
lf.clearSelectElements()
const addElements = lf.addElements(selected, CHILDREN_TRANSLATION_DISTANCE)
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 functioning correctly for the task it performs, which is initializing default shortcuts based on keyboard options and user-selected elements. Here, I would suggest minor adjustments:

  1. Ensure consistent use of lf and graph.
  2. Consider logging or debugging output after key functions like .getElementsByIds() if needed.
// Simplifying imports for clarity
import { WorkflowType, TranslateConfig } from '@/enums/application';
import { getMenuNodes } from './data';

function translationNodeData(nodeData: any, distance: number) {
    // Existing logic implementation
}

/**
 * Initializes default shortcut functionality in the LogicFlow instance.
 * @param {LogicFlow} lf - The LogicFlow instance.
 */
export function initDefaultShortcut(lf: LogicFlow): void {
    const workflowMode = GraphModel.get_workflowMode() ?? WorkflowType.PROJECT;
    
    // Add paste node shortcut with specified conditions
    let selectItems = [];
    if (keyboardOptions.enabled && !graph.isTextEditMode()) {
        // Filter out nodes that don't support translation based on menu configuration
        getMenuNodes(workflowMode)?.forEach((m: any) =>
            s.push(...m.list.filter(n => n.type === TranslationConfig.NODE_TYPE).map(p => p.id))
        );
        
        s.forEach(id => selectItems.push({
            id,
            x: graph.getNodeById(id).x + CHILDREN_TRANSLATION_DISTANCE / 2,
            y: graph.getNodeById(id).y + CHILDREN_TRANSLATION_DISTANCE / 2 + DISTANCE
        }));
        lf.selectElements(selectItems);
    }
}

Summary:

  • Imports: Ensures the necessary components are properly imported.
  • Function Refactoring: Moved initialization inside another function (initDefaultShortcut) and renamed variables for improved readability.
  • Documentation: Added JSDoc comments to describe each part of the function for better understanding.
  • Consistency: Maintained consistency in how variables are declared and referenced.

@shaohuzhang1 shaohuzhang1 merged commit 32e5b32 into v2 Dec 9, 2025
3 of 5 checks passed
@shaohuzhang1 shaohuzhang1 deleted the pr@v2@fix_workflow branch December 9, 2025 07:10
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