Skip to content

Commit 9645d4a

Browse files
committed
handle events in SequenceDiagram
1 parent b32a4fd commit 9645d4a

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

src/Frontend/src/components/messages/SequenceDiagram/HandlersComponent.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const handlerItems = computed(() => {
4848
4949
return {
5050
id: handler.id,
51+
endpointName: handler.endpoint.name,
5152
incomingId: handler.route?.name,
5253
left: (endpoint?.centre ?? 0) - Handler_Width / 2,
5354
right: (endpoint?.centre ?? 0) + Handler_Width / 2,
@@ -63,7 +64,7 @@ const handlerItems = computed(() => {
6364
});
6465
6566
store.setMaxHeight(nextY);
66-
store.setHandlerLocations(result.map((handler) => ({ id: handler.id, left: handler.left, right: handler.right, y: handler.y, height: handler.height })));
67+
store.setHandlerLocations(result.map((handler) => ({ id: handler.id, endpointName: handler.endpointName, left: handler.left, right: handler.right, y: handler.y, height: handler.height })));
6768
6869
return result;
6970
});

src/Frontend/src/components/messages/SequenceDiagram/RoutesComponent.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ const arrows = computed(() =>
1717
if (!route.name) return;
1818
const fromHandler = route.fromRoutedMessage?.fromHandler;
1919
if (!fromHandler) return;
20-
const fromHandlerLocation = handlerLocations.value.find((hl) => hl.id === fromHandler.id);
20+
const fromHandlerLocation = handlerLocations.value.find((hl) => hl.id === fromHandler.id && hl.endpointName === fromHandler.endpoint.name);
2121
if (!fromHandlerLocation) return;
22-
const toHandlerLocation = handlerLocations.value.find((hl) => hl.id === route.fromRoutedMessage?.toHandler?.id);
22+
const toHandlerLocation = handlerLocations.value.find((hl) => hl.id === route.fromRoutedMessage?.toHandler?.id && hl.endpointName === route.fromRoutedMessage?.receiving.name);
2323
if (!toHandlerLocation) return;
2424
2525
const messageTypeElement = messageTypeRefs.value[index];
2626
const messageTypeElementBounds = messageTypeElement?.getBBox();
2727
//TODO: is messageId enough to uniquely identify?
28-
const arrowIndex = fromHandler.outMessages.findIndex((out) => route.fromRoutedMessage?.messageId === out.messageId) + 1;
28+
const arrowIndex = fromHandler.outMessages.findIndex((out) => route.fromRoutedMessage?.messageId === out.messageId && route.fromRoutedMessage?.receiving.name === out.receiving.name) + 1;
2929
const y = fromHandlerLocation.y + (fromHandlerLocation.height / (fromHandler.outMessages.length + 1)) * arrowIndex; //TODO work out the reason - 15 is applied in WPF;
3030
3131
const toHandlerCentre = toHandlerLocation.left + (toHandlerLocation.right - toHandlerLocation.left) / 2;

src/Frontend/src/resources/SequenceDiagram/RoutedMessage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class MessageProcessingRouteItem implements MessageProcessingRoute {
6666
this.processingHandler = processingHandler;
6767

6868
if (routedMessage && this.processingHandler) {
69-
this.name = `${processingHandler?.name}(${routedMessage.messageId})`;
69+
this.name = `${processingHandler?.name}(${routedMessage.messageId}###${routedMessage.receiving.name}})`;
7070
}
7171

7272
if (routedMessage) routedMessage.route = this;

src/Frontend/src/stores/SequenceDiagramStore.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export interface EndpointCentrePoint {
1515

1616
export interface HandlerLocation {
1717
id: string;
18+
endpointName: string;
1819
left: number;
1920
right: number;
2021
y: number;

0 commit comments

Comments
 (0)