@@ -6,6 +6,7 @@ import { usePrettyHttp } from '@/composables/http'
66import { Modal , Tooltip } from ' bootstrap'
77import RegexInput from ' @/components/RegexInput.vue'
88import { getRouteName , useDashboard } from ' @/composables/dashboard' ;
9+ import { usePrettyText } from ' @/composables/usePrettyText'
910
1011const props = defineProps ({
1112 serviceName: { type: String , required: false },
@@ -29,12 +30,15 @@ const { dashboard } = useDashboard()
2930const { events : data, close } = dashboard .value .getEvents (' http' , ... labels .value )
3031const { format, duration } = usePrettyDates ()
3132const { formatStatusCode } = usePrettyHttp ()
33+ const { adaptiveTruncate } = usePrettyText ()
3234const { services, close : closeServices } = dashboard .value .getServices (' http' , true );
3335const dialogRef = useTemplateRef (' dialogRef' )
3436let dialog: Modal | undefined ;
3537const urlValue = useTemplateRef <ComponentPublicInstance <typeof RegexInput >>(' urlValue' );
3638const requestHeaderValueRefs = ref <any []>([])
3739const responseHeaderValueRefs = ref <any []>([])
40+ const urlCell = useTemplateRef <HTMLElement >(' urlCell' );
41+ const dynamicLimit = ref (80 );
3842type CheckboxFilter = ' Not' | ' Single' | ' Multi'
3943interface Filter {
4044 service: MultiFilterItem
@@ -81,6 +85,14 @@ const filter = reactive<Filter>({
8185 }
8286)
8387
88+ const updateLimit = () => {
89+ if (urlCell .value ) {
90+ const width = urlCell .value .offsetWidth ;
91+ dynamicLimit .value = Math .floor (width / 9 );
92+ }
93+ };
94+
95+ const observer = new ResizeObserver (updateLimit );
8496onMounted (() => {
8597 dialog = Modal .getOrCreateInstance (dialogRef .value ! );
8698 const s = localStorage .getItem (` http-requests-${getFilterCacheKey ()} ` )
@@ -92,6 +104,9 @@ onMounted(() => {
92104 tooltipTriggerList .forEach (el => new Tooltip (el , {
93105 trigger: ' hover'
94106 }))
107+ if (urlCell .value ) {
108+ observer .observe (urlCell .value );
109+ }
95110})
96111
97112function goToRequest(event : ServiceEvent , openInNewTab = false ){
@@ -323,6 +338,7 @@ const method = computed({
323338onUnmounted (() => {
324339 close ()
325340 closeServices ()
341+ observer .disconnect ()
326342})
327343function showDialog() {
328344 dialog ?.show ()
@@ -590,7 +606,7 @@ function mergeDeep<T>(target: T, source: Partial<T>): T {
590606 <tr >
591607 <th v-if =" hasDeprecatedRequests" scope =" col" class =" text-center" style =" width : 5px ;" ></th >
592608 <th scope =" col" class =" text-left col-1" >Method</th >
593- <th scope =" col" class =" text-left col" >URL</th >
609+ <th scope =" col" class =" text-left col" ref = " urlCell " >URL</th >
594610 <th scope =" col" class =" text-center col-1" >Status Code</th >
595611 <th scope =" col" class =" text-center col-2" >Time</th >
596612 <th scope =" col" class =" text-center col-1" >Duration</th >
@@ -608,7 +624,7 @@ function mergeDeep<T>(target: T, source: Partial<T>): T {
608624 </td >
609625 <td >
610626 <router-link @click.stop class =" row-link" :to =" { name: getRouteName('httpRequest').value, params: {id: event.id} }" >
611- {{ eventData(event).request.url }}
627+ {{ adaptiveTruncate( eventData(event).request.url, dynamicLimit) }}
612628 </router-link >
613629 </td >
614630 <td class =" text-center" >{{ formatStatusCode(eventData(event).response.statusCode.toString()) }}</td >
0 commit comments