fix: The name of the copy operator is displayed the same as before ##3265 (#3266)
### What problem does this PR solve? fix: The name of the copy operator is displayed the same as before ##3265 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@@ -3,25 +3,28 @@ import { CopyOutlined } from '@ant-design/icons';
|
||||
import { Flex, MenuProps } from 'antd';
|
||||
import { useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useGetNodeName } from '../../hooks';
|
||||
import useGraphStore from '../../store';
|
||||
|
||||
interface IProps {
|
||||
id: string;
|
||||
iconFontColor?: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
const NodeDropdown = ({ id, iconFontColor }: IProps) => {
|
||||
const NodeDropdown = ({ id, iconFontColor, label }: IProps) => {
|
||||
const { t } = useTranslation();
|
||||
const deleteNodeById = useGraphStore((store) => store.deleteNodeById);
|
||||
const duplicateNodeById = useGraphStore((store) => store.duplicateNode);
|
||||
const getNodeName = useGetNodeName();
|
||||
|
||||
const deleteNode = useCallback(() => {
|
||||
deleteNodeById(id);
|
||||
}, [id, deleteNodeById]);
|
||||
|
||||
const duplicateNode = useCallback(() => {
|
||||
duplicateNodeById(id);
|
||||
}, [id, duplicateNodeById]);
|
||||
duplicateNodeById(id, getNodeName(label));
|
||||
}, [duplicateNodeById, id, getNodeName, label]);
|
||||
|
||||
const items: MenuProps['items'] = [
|
||||
{
|
||||
|
||||
@@ -9,13 +9,13 @@ import { NextNodePopover } from './popover';
|
||||
|
||||
interface IProps {
|
||||
id: string;
|
||||
label?: string;
|
||||
name?: string;
|
||||
label: string;
|
||||
name: string;
|
||||
gap?: number;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function RunStatus({ id, name }: IProps) {
|
||||
export function RunStatus({ id, name }: Omit<IProps, 'label'>) {
|
||||
const { t } = useTranslate('flow');
|
||||
return (
|
||||
<section className="flex justify-end items-center pb-1 ">
|
||||
@@ -44,7 +44,7 @@ const NodeHeader = ({ label, id, name, gap = 4, className }: IProps) => {
|
||||
color={operatorMap[label as Operator].color}
|
||||
></OperatorIcon>
|
||||
<span className={styles.nodeTitle}>{name}</span>
|
||||
<NodeDropdown id={id}></NodeDropdown>
|
||||
<NodeDropdown id={id} label={label}></NodeDropdown>
|
||||
</Flex>
|
||||
</section>
|
||||
);
|
||||
|
||||
@@ -62,7 +62,7 @@ function NoteNode({ data, id }: NodeProps<NodeData>) {
|
||||
onChange={handleNameChange}
|
||||
className={styles.noteName}
|
||||
></Input>
|
||||
<NodeDropdown id={id}></NodeDropdown>
|
||||
<NodeDropdown id={id} label={data.label}></NodeDropdown>
|
||||
</Flex>
|
||||
<Form
|
||||
onValuesChange={handleValuesChange}
|
||||
|
||||
Reference in New Issue
Block a user