1+ <script setup lang="ts">
2+ import { usePrettyHttp } from ' @/composables/http' ;
3+ import { usePrettyDates } from ' @/composables/usePrettyDate' ;
4+ import { usePrettyText } from ' @/composables/usePrettyText' ;
5+ import { computed } from ' vue' ;
6+
7+ const props = defineProps <{
8+ item: SearchItem
9+ }>()
10+
11+ const { formatStatusCode, getClassByStatusCode } = usePrettyHttp ()
12+ const { adaptiveTruncate } = usePrettyText ()
13+ const { format } = usePrettyDates ()
14+
15+ const title = computed (() => {
16+ let title = props .item .title
17+ return adaptiveTruncate (title )
18+ })
19+
20+ function isHttp() {
21+ return props .item .params [' traits.namespace' ] === ' http'
22+ }
23+ function isKafka() {
24+ return props .item .params [' traits.namespace' ] === ' kafka'
25+ }
26+ function isLdap() {
27+ return props .item .params [' traits.namespace' ] === ' ldap'
28+ }
29+ function isMail() {
30+ return props .item .params [' traits.namespace' ] === ' mail'
31+ }
32+ </script >
33+
34+ <template >
35+ <div class =" card-body" >
36+
37+ <div class =" d-flex justify-content-between align-items-center small" >
38+ <div v-if =" item.time" class =" text-muted" >⏱ {{ format(item.time) }}</div >
39+ <span v-if =" isKafka()" class =" fw-semibold text-dark" >Message received</span >
40+ <span v-if =" isHttp()" class =" fw-semibold text-dark" >Request received</span >
41+ </div >
42+
43+ <h6 class =" mb-1 mt-1" >
44+ <span v-if =" isKafka()" class =" badge me-2 text-capitalize" :class =" item.params['traits.namespace']" >{{ item.params['traits.namespace'] }}</span >
45+ <span v-if =" isHttp()" class =" badge me-2 text-uppercase operation" :class =" item.params['traits.method']" >{{ item.params['traits.method'] }}</span >
46+ <span v-if =" isLdap()" class =" badge me-2 text-uppercase ldap operation" :class =" item.params['traits.operation']" >{{ item.params['traits.operation'] }}</span >
47+ <span >{{ title }}</span >
48+ </h6 >
49+ <div class =" text-end small" v-if =" item.params.statusCode" >
50+ <span class =" badge status-code text-dark" :class =" getClassByStatusCode(item.params.statusCode)" >{{ formatStatusCode(item.params.statusCode) }}</span >
51+ </div >
52+
53+ <div class =" text-muted small mb-1" >
54+ <span v-if =" item.domain" > {{ item.domain }}</span >
55+ <span v-if =" item.params['traits.topic']" > · ; Topic {{ item.params['traits.topic'] }}</span >
56+ <span v-if =" item.params['traits.namespace'] == 'kafka'" > · ; Partition {{ item.params['traits.partition'] }}</span >
57+ <span v-if =" isLdap() && item.params['baseDn']" > · ; {{ item.params['baseDn'] }}</span >
58+ <span > · ; {{ item.type }}</span >
59+ </div >
60+
61+ <p class =" small mb-0" v-html =" item.fragments?.join(' ... ')" ></p >
62+
63+ </div >
64+ </template >
65+
66+ <style scoped>
67+ .bg-purple , .kafka {
68+ background-color : #6f42c1 ;
69+ }
70+ .http {
71+ background-color : #1E88E5 ;
72+ }
73+ .ldap {
74+ background-color : #2E7D32 ;
75+ }
76+ .mail {
77+ background-color : #F9A825 ;
78+ }
79+ .text-capitalize {
80+ text-transform : capitalize ;
81+ }
82+ </style >
0 commit comments