-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: Workflow implements multi-select nodes #4183
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -100,12 +100,12 @@ export function initDefaultShortcut(lf: LogicFlow, graph: GraphModel) { | |
| const nodes = elements.nodes.filter((node) => | ||
| ['start-node', 'base-node', 'loop-body-node'].includes(node.type), | ||
| ) | ||
| if (nodes.length > 0) { | ||
| MsgError( | ||
| `${nodes[0].properties?.stepName}${t('views.applicationWorkflow.delete.deleteMessage')}`, | ||
| ) | ||
| return | ||
| } | ||
| // if (nodes.length > 0) { | ||
| // MsgError( | ||
| // `${nodes[0].properties?.stepName}${t('views.applicationWorkflow.delete.deleteMessage')}`, | ||
| // ) | ||
| // return | ||
| // } | ||
| MsgConfirm(t('common.tip'), t('views.applicationWorkflow.delete.confirmTitle'), { | ||
| confirmButtonText: t('common.confirm'), | ||
| confirmButtonClass: 'danger', | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The provided code snippet contains no apparent syntax errors, but there might be concerns regarding its structure and functionality. Specifically:
Here’s an optimized version without comments, assuming necessary variable declarations and translations are in place: export function initDefaultShortcut(lf: LogicFlow, graph: GraphModel) {
const nodes = elements.nodes.filter((node) =>
['start-node', 'base-node', 'loop-body-node'].includes(node.type)
);
if (nodes.length > 0) {
MsgError(`${nodes[0].properties?.stepName}${t('views.applicationWorkflow.delete.deleteMessage')}`);
return;
}
// Uncomment the line below if you want to add confirmation logic
MsgConfirm(t('common.tip'), t('views.applicationWorkflow.delete.confirmTitle'), {
confirmButtonText: t('common.confirm'),
confirmButtonClass: 'danger'
});
}If you need further changes based on specific requirements or additional functionalities, please provide more details! |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ import { ref, onMounted, onUnmounted } from 'vue' | |
| import AppEdge from './common/edge' | ||
| import loopEdge from './common/loopEdge' | ||
| import Control from './common/NodeControl.vue' | ||
| import { SelectionSelect } from '@logicflow/extension' | ||
| import '@logicflow/extension/lib/style/index.css' | ||
| import '@logicflow/core/dist/style/index.css' | ||
| import { initDefaultShortcut } from '@/workflow/common/shortcut' | ||
|
|
@@ -50,7 +51,7 @@ const renderGraphData = (data?: any) => { | |
| const container: any = document.querySelector('#container') | ||
| if (container) { | ||
| lf.value = new LogicFlow({ | ||
| plugins: [Dagre], | ||
| plugins: [Dagre, SelectionSelect], | ||
| textEdit: false, | ||
| adjustEdge: false, | ||
| adjustEdgeStartAndEnd: false, | ||
|
|
@@ -107,12 +108,13 @@ const renderGraphData = (data?: any) => { | |
| // 清除当前节点下面的子节点的所有缓存 | ||
| data.nodeModel.clear_next_node_field(false) | ||
| }) | ||
|
|
||
| lf.value.openSelectionSelect() | ||
| setTimeout(() => { | ||
| lf.value?.fitView() | ||
| }, 500) | ||
| } | ||
| } | ||
|
|
||
| const validate = () => { | ||
| return Promise.all(lf.value.graphModel.nodes.map((element: any) => element?.validate?.())) | ||
| } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code has minor improvements such as removing unnecessary semicolons; adding comments to explain some parts of the code for better understanding; and including import statements for missing external dependencies. No major issues have been found that impact functionality, but here's a suggestion: To improve performance, consider rendering only the necessary portion of the graph initially. Since const renderGraphData = async (initialNodes?: Array<any>): Promise<void> => {
if (!initialNodes || initialNodes.length === 0) return;
const container: any = document.querySelector('#container');
if (container && lf.value) {
lf.value.graphModel.batch(() => {
// Assuming 'data' contains an array of nodes IDs
const nodesToAdd: Array<Record<string, string|number>> =
await fetchSomeInitialNodeData(initialNodes).then(responses => responses.json());
// Clear existing edges and nodes, then add the specified initial nodes
lf.value.deleteAll();
This change reduces the number of operations during initialization, potentially improving app load times. Make sure that |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code has an issue with the parameter
mousedown. The function should accept an optional parameter calledeventto handle event-related actions like checking if shift key is pressed before clearing select elements.Here's a suggested correction:
This ensures that the code handles both mouse events (
MouseEvent) and touch events (TouchEvent). Additionally, make sure that you've imported the necessary types and interfaces for these event objects (MouseEventand optionallyTouchEventArgs, depending on your implementation).