@@ -4,6 +4,7 @@ import MessageDataBox from "./MessageDataBox.vue";
44import TimeoutIcon from " @/assets/TimeoutIcon.svg" ;
55import SagaTimeoutIcon from " @/assets/SagaTimeoutIcon.svg" ;
66import { useSagaDiagramStore } from " @/stores/SagaDiagramStore" ;
7+ import { computed , ref , watch } from " vue" ;
78
89const props = defineProps <{
910 message: SagaTimeoutMessageViewModel ;
@@ -12,11 +13,43 @@ const props = defineProps<{
1213}>();
1314
1415const store = useSagaDiagramStore ();
16+ const timeoutMessageRef = ref <HTMLElement | null >(null );
17+ const isActive = ref (false );
1518
19+ const shouldHighlightAndScroll = computed (() => {
20+ return props .message .MessageId === store .selectedMessageId ;
21+ });
22+
23+ // This sets the store with the required values so the timeout invocation node exists, it will react by scrolling to the node
1624const navigateToTimeout = () => {
1725 // Set the selected message ID in the store
1826 store .setSelectedMessageId (props .message .MessageId );
27+ store .scrollToTimeout = true ;
1928};
29+
30+ watch (
31+ [() => store .scrollToTimeoutRequest , () => shouldHighlightAndScroll .value , () => timeoutMessageRef .value !== null ],
32+ ([scrollRequest , shouldScroll , refExists ]) => {
33+ if (scrollRequest && shouldScroll && refExists && timeoutMessageRef .value ) {
34+ timeoutMessageRef .value .scrollIntoView ({
35+ behavior: " smooth" ,
36+ block: " center" ,
37+ });
38+
39+ store .scrollToTimeoutRequest = false ;
40+ }
41+ },
42+ { immediate: true }
43+ );
44+
45+ watch (
46+ () => store .selectedMessageId ,
47+ (newMessageId ) => {
48+ // Check if this node contains the selected message
49+ isActive .value = newMessageId === props .message .MessageId ;
50+ },
51+ { immediate: true }
52+ );
2053 </script >
2154
2255<template >
@@ -35,7 +68,14 @@ const navigateToTimeout = () => {
3568 </div >
3669 <div class =" cell cell--side" >
3770 <div class =" cell-inner cell-inner-right" ></div >
38- <div class =" cell-inner cell-inner-side" >
71+ <div
72+ ref =" timeoutMessageRef"
73+ :class =" {
74+ 'cell-inner': true,
75+ 'cell-inner-side': true,
76+ 'cell-inner-side--active': isActive,
77+ }"
78+ >
3979 <img class =" saga-icon saga-icon--side-cell" :src =" TimeoutIcon" alt =" " />
4080 <h2 class =" message-title" aria-label =" timeout message type" >{{ message.MessageFriendlyTypeName }}</h2 >
4181 <div class =" timestamp" aria-label =" timeout message timestamp" >{{ message.FormattedTimeSent }}</div >
@@ -96,7 +136,8 @@ const navigateToTimeout = () => {
96136}
97137
98138.cell-inner-side--active {
99- border : solid 2px #000000 ;
139+ border : solid 5px #00a3c4 ;
140+ animation : blink-border 1.8s ease-in-out ;
100141}
101142
102143.cell-inner-right {
@@ -176,4 +217,19 @@ const navigateToTimeout = () => {
176217.saga-icon--overlap {
177218 margin-left : -1rem ;
178219}
220+
221+ @keyframes blink-border {
222+ 0% ,
223+ 100% {
224+ border-color : #00a3c4 ;
225+ }
226+ 20% ,
227+ 60% {
228+ border-color : #cccccc ;
229+ }
230+ 40% ,
231+ 80% {
232+ border-color : #00a3c4 ;
233+ }
234+ }
179235 </style >
0 commit comments