1
1
<script setup lang="ts">
2
- import { computed , onMounted , ref , watch } from " vue" ;
2
+ import { computed , watch } from " vue" ;
3
3
import { RouterLink , useRoute } from " vue-router" ;
4
4
import NoData from " ../NoData.vue" ;
5
5
import TimeSince from " ../TimeSince.vue" ;
@@ -16,10 +16,10 @@ import RetryMessageButton from "@/components/messages/RetryMessageButton.vue";
16
16
import EditAndRetryButton from " @/components/messages/EditAndRetryButton.vue" ;
17
17
import ExportMessageButton from " @/components/messages/ExportMessageButton.vue" ;
18
18
import LoadingSpinner from " @/components/LoadingSpinner.vue" ;
19
+ import TabsLayout from " @/components/TabsLayout.vue" ;
19
20
import { storeToRefs } from " pinia" ;
20
21
import MetadataLabel from " @/components/messages/MetadataLabel.vue" ;
21
22
22
- const panel = ref <number >(1 );
23
23
const route = useRoute ();
24
24
const id = computed (() => route .params .id as string );
25
25
const messageId = computed (() => route .params .messageId as string );
@@ -29,10 +29,6 @@ const isMassTransitConnected = useIsMassTransitConnected();
29
29
const store = useMessageViewStore ();
30
30
const { state } = storeToRefs (store );
31
31
32
- function togglePanel(panelNum : number ) {
33
- panel .value = panelNum ;
34
- }
35
-
36
32
watch (
37
33
[id , messageId ],
38
34
async ([newId , newMessageId ], [oldId , oldMessageId ]) => {
@@ -49,8 +45,33 @@ watch(
49
45
{ immediate: true }
50
46
);
51
47
52
- onMounted (() => {
53
- togglePanel (isError .value ? 1 : 2 );
48
+ const tabs = computed (() => {
49
+ const currentTabs = [
50
+ {
51
+ text: " Message body" ,
52
+ component: BodyView ,
53
+ },
54
+ {
55
+ text: " Headers" ,
56
+ component: HeadersView ,
57
+ },
58
+ ];
59
+
60
+ if (isError .value ) {
61
+ currentTabs .unshift ({
62
+ text: " Stacktrace" ,
63
+ component: StackTraceView ,
64
+ });
65
+ }
66
+
67
+ if (! isMassTransitConnected .value ) {
68
+ currentTabs .push ({
69
+ text: " Flow Diagram" ,
70
+ component: FlowDiagram ,
71
+ });
72
+ }
73
+
74
+ return currentTabs ;
54
75
});
55
76
</script >
56
77
@@ -117,16 +138,7 @@ onMounted(() => {
117
138
</div >
118
139
<div class =" row" >
119
140
<div class =" col-sm-12 no-side-padding" >
120
- <div class =" nav tabs msg-tabs" >
121
- <h5 v-if =" isError" :class =" { active: panel === 1 }" class =" nav-item" @click.prevent =" togglePanel(1)" ><a href =" #" >Stacktrace</a ></h5 >
122
- <h5 :class =" { active: panel === 2 }" class =" nav-item" @click.prevent =" togglePanel(2)" ><a href =" #" >Message body</a ></h5 >
123
- <h5 :class =" { active: panel === 3 }" class =" nav-item" @click.prevent =" togglePanel(3)" ><a href =" #" >Headers</a ></h5 >
124
- <h5 v-if =" !isMassTransitConnected" :class =" { active: panel === 4 }" class =" nav-item" @click.prevent =" togglePanel(4)" ><a href =" #" >Flow Diagram</a ></h5 >
125
- </div >
126
- <StackTraceView v-if =" isError && panel === 1" />
127
- <BodyView v-if =" panel === 2" />
128
- <HeadersView v-if =" panel === 3" />
129
- <FlowDiagram v-if =" panel === 4" />
141
+ <TabsLayout :tabs =" tabs" />
130
142
</div >
131
143
</div >
132
144
</template >
0 commit comments