Skip to content

Commit 272949f

Browse files
enhancement: default name is now captured for edges
1 parent 4b59fda commit 272949f

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

ui/src/components/diagram-maker/edge-properties/new-edge-properties.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,21 @@ export const NewEdgeProperties = (props: NewEdgePropertiesProps) => {
101101

102102
const clientTypesConfig: ClientTypesConfig = getClientTypesConfig(srcNodeConfig, srcNodeState, destNodeState);
103103

104+
const getDefaultName = () => {
105+
return srcNodeState?.consumerData?.name + "-to-" + destNodeState?.consumerData?.name;
106+
};
107+
108+
const getName = () => {
109+
const name = currentEdgeState?.consumerData?.name;
110+
// name captured as undefined when destNode wasn't added properties with may include `undefined` in name.
111+
if (name && !name.includes("undefined")) {
112+
return name;
113+
}
114+
return getDefaultName();
115+
};
116+
104117
const [payload, setPayload] = React.useState({
105-
name: currentEdgeState?.consumerData?.name !== undefined ? currentEdgeState?.consumerData?.name : "",
118+
name: getName(),
106119
isRestServer: clientTypesConfig.isRestServer || false,
107120
restServerPort: clientTypesConfig.restServerPort,
108121
isGrpcServer: clientTypesConfig.isGrpcServer || false,

0 commit comments

Comments
 (0)