-
Notifications
You must be signed in to change notification settings - Fork 26
Sequence Diagram reverse and local message flow and events #2310
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
Merged
Merged
Changes from 45 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
b148921
include audit section displaying audit messages
PhilBastian 105cc68
show status icons
PhilBastian 337fdef
Merge branch 'master' into si_integration
PhilBastian dd2cd69
add feature flag
PhilBastian 36d7815
format message type as per SI
PhilBastian b281cf3
change name from audit to all messages and include message view route
PhilBastian f706a7f
display time_sent and processing_time values
PhilBastian db87e15
fix the body of the popup message in retry dialog
soujay ef84c78
Revert "fix the body of the popup message in retry dialog"
soujay 2616724
enable auto refresh to be paused and to be configured after creation
PhilBastian 0065abb
manual/auto refresh control
PhilBastian 6933c0f
Merge branch 'si_integration' of https://github.com/Particular/Servic…
PhilBastian 10ae9af
stripe results grid
PhilBastian 0a510d0
change to use emits
PhilBastian ba62324
remove commented code
PhilBastian 60e4bfa
add paging
PhilBastian 322f801
implement server side sorting
PhilBastian 9cf0ac4
scroll on list instead of view, allowing the table headers to always …
PhilBastian 338d370
Merge branch 'master' into si_integration
PhilBastian 3b206eb
change to use messages routing
PhilBastian 9e77b04
increase default page size
PhilBastian be36fd2
add failedmessage redirect and remove unused message components
PhilBastian c2f286e
start converting conversation model from SI
PhilBastian 83592dc
order messages
PhilBastian 0a07896
Merge branch 'master' into sequence_diagram
PhilBastian 6a3fdab
add endpoint host versions
PhilBastian b2e1204
convert handleritem logic from SI
PhilBastian 72df26f
convert routedMessages (arrows) from SI
PhilBastian a89730a
display endpoints
PhilBastian 90a0052
timeline
PhilBastian eb5ffa5
handlers
PhilBastian 7350293
arrow (left to right)
PhilBastian 19171da
expand SVG to fit larger diagrams
PhilBastian f24f540
fix handler map
PhilBastian a9b6488
fix messagetype text side
PhilBastian 5108f2a
replace props and emits with a store
PhilBastian 39929c2
highlight on handlers
PhilBastian 29f435a
implement route highlight
PhilBastian 2de64d6
hide sequence diagram behind feature flag
PhilBastian c926f54
Merge branch 'master' into sequence_diagram
PhilBastian 9303f63
support local and response message flow
PhilBastian ff1666f
handle long message names being pushed off the svg surface
PhilBastian 35e4232
handle handler messagetext offset less than 0 (buggy)
PhilBastian b32a4fd
display event as dashed line
PhilBastian 9645d4a
handle events in SequenceDiagram
PhilBastian 0b0f590
address comments from review
PhilBastian c62f833
Merge branch 'sequence_diagram' into reverse_local_events_timeout
PhilBastian 821947e
add comment for clarity
PhilBastian 799eebb
Merge branch 'master' into reverse_local_events_timeout
PhilBastian 20f3a71
fix merge issue
PhilBastian ec1a5b7
simplify name uniqueness
PhilBastian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<script setup lang="ts"> | ||
import Endpoints from "./SequenceDiagram/EndpointsComponent.vue"; | ||
import Timeline from "./SequenceDiagram/TimelineComponent.vue"; | ||
import Handlers from "./SequenceDiagram/HandlersComponent.vue"; | ||
import Routes from "./SequenceDiagram/RoutesComponent.vue"; | ||
import { useSequenceDiagramStore } from "@/stores/SequenceDiagramStore"; | ||
import { storeToRefs } from "pinia"; | ||
|
||
const store = useSequenceDiagramStore(); | ||
store.setConversationId("39907d51-12e5-4202-82c3-b2b30077ebd4"); | ||
|
||
const { maxWidth, maxHeight } = storeToRefs(store); | ||
</script> | ||
|
||
<template> | ||
<div class="outer"> | ||
<svg class="sequence-diagram" :width="`max(100%, ${isNaN(maxWidth) ? 0 : maxWidth}px)`" :height="maxHeight + 20"> | ||
<Endpoints /> | ||
<Timeline /> | ||
<Handlers /> | ||
<Routes /> | ||
</svg> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
.outer { | ||
max-width: 100%; | ||
max-height: calc(100vh - 27em); | ||
overflow: auto; | ||
} | ||
|
||
.sequence-diagram { | ||
--error: red; | ||
--gray20: #333333; | ||
--gray30: #444444; | ||
--gray40: #666666; | ||
--gray60: #999999; | ||
--gray80: #cccccc; | ||
--gray90: #e6e6e6; | ||
--gray95: #b3b3b3; | ||
--highlight: #0b6eef; | ||
--highlight-background: #c5dee9; | ||
background: white; | ||
} | ||
</style> |
107 changes: 107 additions & 0 deletions
107
src/Frontend/src/components/messages/SequenceDiagram/EndpointsComponent.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<script setup lang="ts"> | ||
import { Endpoint } from "@/resources/SequenceDiagram/Endpoint"; | ||
import { Endpoint_Width, EndpointCentrePoint, useSequenceDiagramStore } from "@/stores/SequenceDiagramStore"; | ||
import { storeToRefs } from "pinia"; | ||
import { computed, ref, watch } from "vue"; | ||
|
||
interface EndpointWithLocation extends Endpoint { | ||
width: number; | ||
textWidth: number; | ||
x?: number; | ||
surround?: EndpointSurround; | ||
} | ||
|
||
interface EndpointSurround { | ||
x: number; | ||
y: number; | ||
width: number; | ||
height: number; | ||
fill: string; | ||
rx: string; | ||
strokeWidth: string; | ||
stroke: string; | ||
} | ||
|
||
const Endpoint_Gap = 30; | ||
const Endpoint_Image_Width = 20; | ||
|
||
const store = useSequenceDiagramStore(); | ||
const { startX, endpoints } = storeToRefs(store); | ||
|
||
const epRefs = ref<SVGTextElement[]>([]); | ||
const endpointItems = computed(() => | ||
endpoints.value.map((x, index) => { | ||
const endpoint = x as EndpointWithLocation; | ||
const el = epRefs.value[index]; | ||
if (el) { | ||
const bounds = el.getBBox(); | ||
const previousEndpoint = index > 0 ? endpointItems.value[index - 1] : undefined; | ||
endpoint.width = Math.max(Endpoint_Width, bounds.width); | ||
endpoint.textWidth = bounds.width; | ||
endpoint.x = (previousEndpoint?.x ?? startX.value) + (previousEndpoint?.width ?? 0) + Endpoint_Gap; | ||
|
||
if (!endpoint.surround && el.isConnected) { | ||
const style = getComputedStyle(el); | ||
const padding_top = parseInt(style.getPropertyValue("padding-top")); | ||
const padding_left = parseInt(style.getPropertyValue("padding-left")); | ||
const padding_right = parseInt(style.getPropertyValue("padding-right")); | ||
const padding_bottom = parseInt(style.getPropertyValue("padding-bottom")); | ||
endpoint.surround = { | ||
x: endpoint.x - endpoint.width / 2 - padding_left, | ||
y: bounds.y - padding_top, | ||
width: endpoint.width + padding_left + padding_right, | ||
height: bounds.height + padding_top + padding_bottom, | ||
fill: style.getPropertyValue("background-color"), | ||
rx: style.getPropertyValue("border-radius"), | ||
strokeWidth: style.getPropertyValue("border-top-width"), | ||
stroke: style.getPropertyValue("border-top-color"), | ||
}; | ||
} | ||
} | ||
return endpoint; | ||
}) | ||
); | ||
|
||
watch(endpointItems, () => { | ||
store.setEndpointCentrePoints(endpointItems.value.map((endpoint) => ({ name: endpoint.name, centre: endpoint.x ?? 0, top: (endpoint.surround?.y ?? 0) + (endpoint.surround?.height ?? 0) + 15 }) as EndpointCentrePoint)); | ||
const lastEndpoint = endpointItems.value[endpointItems.value.length - 1]; | ||
store.setMaxWidth((lastEndpoint.x ?? 0) + lastEndpoint.width); | ||
}); | ||
|
||
watch(startX, () => { | ||
epRefs.value = []; | ||
endpoints.value.forEach((endpoint) => ((endpoint as EndpointWithLocation).surround = undefined)); | ||
}); | ||
|
||
function setEndpointRef(el: SVGTextElement, index: number) { | ||
if (el) epRefs.value[index] = el; | ||
} | ||
</script> | ||
|
||
<template> | ||
<g v-for="(endpoint, i) in endpointItems" :key="endpoint.name" transform="translate(0,15)"> | ||
<rect | ||
v-if="endpoint.surround" | ||
:x="endpoint.surround.x" | ||
:y="endpoint.surround.y" | ||
:width="endpoint.surround.width" | ||
:height="endpoint.surround.height" | ||
:fill="endpoint.surround.fill" | ||
:rx="endpoint.surround.rx" | ||
:stroke-width="endpoint.surround.strokeWidth" | ||
:stroke="endpoint.surround.stroke" | ||
></rect> | ||
<g :transform="`translate(${(endpoint.x ?? Endpoint_Width / 2) - ((endpoint.textWidth ?? 0) + Endpoint_Image_Width) / 2},0)`"> | ||
<path fill="var(--gray40)" d="M 0,0 M 18,18 M 0,2 v 14 h 14 v -4 h -6 v -6 h 6 v -4 h -14 M 9,7 v 4 h 9 v -4"></path> | ||
<text :x="Endpoint_Image_Width" y="10" alignment-baseline="middle" text-anchor="start" :ref="(el) => setEndpointRef(el as SVGTextElement, i)">{{ endpoint.name }}</text> | ||
</g> | ||
</g> | ||
</template> | ||
|
||
<style scoped> | ||
text { | ||
background: var(--gray90); | ||
border-radius: 5px; | ||
padding: 0.5em; | ||
} | ||
</style> |
103 changes: 103 additions & 0 deletions
103
src/Frontend/src/components/messages/SequenceDiagram/HandlersComponent.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<script setup lang="ts"> | ||
import { HandlerState } from "@/resources/SequenceDiagram/Handler"; | ||
import { computed, ref } from "vue"; | ||
import { Direction } from "@/resources/SequenceDiagram/RoutedMessage"; | ||
import { useSequenceDiagramStore } from "@/stores/SequenceDiagramStore"; | ||
import { storeToRefs } from "pinia"; | ||
|
||
const Height_Per_Out = 40; | ||
const Handler_Gap = 20; | ||
const Handler_Width = 14; | ||
|
||
const store = useSequenceDiagramStore(); | ||
const { handlers, endpointCentrePoints, highlightId } = storeToRefs(store); | ||
|
||
const messageTypeRefs = ref<SVGTextElement[]>([]); | ||
|
||
const handlerItems = computed(() => { | ||
let nextY = 0; | ||
const result = handlers.value.map((handler, index) => { | ||
const endpoint = endpointCentrePoints.value.find((cp) => cp.name === handler.endpoint.name)!; | ||
const messageTypeElement = messageTypeRefs.value[index]; | ||
const count = handler.outMessages.length; | ||
const height = (count === 0 ? 1 : count) * Height_Per_Out; | ||
if (nextY === 0) nextY += Handler_Gap + (endpoint?.top ?? 0); | ||
const y = nextY; | ||
nextY += height + Handler_Gap; | ||
const fill = (() => { | ||
if (handler.id === "First") return "black"; | ||
if (handler.state === HandlerState.Fail) return "var(--error)"; | ||
if (handler.route?.name === highlightId.value) return "var(--highlight-background)"; | ||
return "var(--gray60)"; | ||
})(); | ||
const icon = (() => { | ||
if (handler.id === "First") return "M0,0L8,4 0,8z"; | ||
if (handler.state === HandlerState.Fail) return "M6,0L0,6 6,12 12,6 6,0z M7,9L5,9 5,8 7,8 7,9z M5,7L5,3 7,3 7,7 5,7z"; | ||
return null; | ||
})(); | ||
const iconSize = (() => { | ||
if (handler.id === "First") return 8; | ||
if (handler.state === HandlerState.Fail) return 12; | ||
return 0; | ||
})(); | ||
|
||
const messageTypeOffset = handler.direction === Direction.Right ? ((messageTypeElement?.getBBox().width ?? 0) + 24) * -1 : 20; | ||
if (messageTypeOffset < 0) { | ||
store.setStartX(-1 * messageTypeOffset); | ||
} | ||
|
||
return { | ||
id: handler.id, | ||
endpointName: handler.endpoint.name, | ||
incomingId: handler.route?.name, | ||
left: (endpoint?.centre ?? 0) - Handler_Width / 2, | ||
right: (endpoint?.centre ?? 0) + Handler_Width / 2, | ||
y, | ||
height, | ||
fill, | ||
icon, | ||
iconSize, | ||
messageType: handler.name, | ||
messageTypeOffset, | ||
messageTypeHighlight: handler.route?.name === highlightId.value, | ||
}; | ||
}); | ||
|
||
store.setMaxHeight(nextY); | ||
store.setHandlerLocations(result.map((handler) => ({ id: handler.id, endpointName: handler.endpointName, left: handler.left, right: handler.right, y: handler.y, height: handler.height }))); | ||
|
||
return result; | ||
}); | ||
|
||
function setMessageTypeRef(el: SVGTextElement, index: number) { | ||
if (el) messageTypeRefs.value[index] = el; | ||
} | ||
</script> | ||
|
||
<template> | ||
<g> | ||
<g v-for="(handler, i) in handlerItems" :key="handler.id" :transform="`translate(${handler.left}, ${handler.y})`"> | ||
<!--Handler Activation Box--> | ||
<rect :width="Handler_Width" :height="handler.height" :class="handler.incomingId && 'clickable'" :fill="handler.fill" @mouseover="() => store.setHighlightId(handler.incomingId)" @mouseleave="() => store.setHighlightId()" /> | ||
<path v-if="handler.icon" :d="handler.icon" fill="white" :transform="`translate(${Handler_Width / 2 - handler.iconSize / 2}, ${handler.height / 2 - handler.iconSize / 2})`" /> | ||
<!--Message Type and Icon--> | ||
<g | ||
v-if="handler.messageType" | ||
:transform="`translate(${handler.messageTypeOffset}, 4)`" | ||
class="clickable" | ||
:fill="handler.messageTypeHighlight ? 'var(--highlight)' : 'var(--gray40)'" | ||
@mouseover="() => store.setHighlightId(handler.incomingId)" | ||
@mouseleave="() => store.setHighlightId()" | ||
> | ||
<path d="M9,3L9,3 9,0 0,0 0,3 4,3 4,6 0,6 0,9 4,9 4,12 0,12 0,15 9,15 9,12 5,12 5,9 9,9 9,6 5,6 5,3z" /> | ||
<text x="14" y="10" alignment-baseline="middle" :ref="(el) => setMessageTypeRef(el as SVGTextElement, i)">{{ handler.messageType }}</text> | ||
</g> | ||
</g> | ||
</g> | ||
</template> | ||
|
||
<style scoped> | ||
.clickable { | ||
cursor: pointer; | ||
} | ||
</style> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.