File tree Expand file tree Collapse file tree 2 files changed +28
-7
lines changed
src/Frontend/src/components Expand file tree Collapse file tree 2 files changed +28
-7
lines changed Original file line number Diff line number Diff line change 2
2
import { Tippy , TippyComponent } from " vue-tippy" ;
3
3
import { useTemplateRef } from " vue" ;
4
4
5
- const props = defineProps <{
6
- value: string ;
7
- }>();
5
+ const props = withDefaults (
6
+ defineProps <{
7
+ value: string ;
8
+ isIconOnly? : boolean ;
9
+ }>(),
10
+ { isIconOnly: false }
11
+ );
8
12
9
13
const tippyRef = useTemplateRef <TippyComponent | null >(" tippyRef" );
10
14
let timeoutId: number ;
@@ -19,6 +23,7 @@ async function copyToClipboard() {
19
23
20
24
<template >
21
25
<Tippy content =" Copied" ref =" tippyRef" trigger =" manual" >
22
- <button type =" button" class =" btn btn-secondary btn-sm" @click =" copyToClipboard" ><i class =" fa fa-copy" ></i > Copy to clipboard</button >
26
+ <button v-if =" !props.isIconOnly" type =" button" class =" btn btn-secondary btn-sm" @click =" copyToClipboard" ><i class =" fa fa-copy" ></i > Copy to clipboard</button >
27
+ <button v-else type =" button" class =" btn btn-secondary btn-sm" @click =" copyToClipboard" v-tippy =" 'Copy to clipboard'" ><i class =" fa fa-copy" ></i ></button >
23
28
</Tippy >
24
29
</template >
Original file line number Diff line number Diff line change 1
1
<script setup lang="ts">
2
2
import { ExtendedFailedMessage } from " @/resources/FailedMessage" ;
3
-
3
+ import CopyToClipboard from " @/components/CopyToClipboard.vue" ;
4
+ import { ref } from " vue" ;
4
5
const props = defineProps <{
5
6
message: ExtendedFailedMessage ;
6
7
}>();
8
+
9
+ const hoverStates = ref <Record <number , boolean >>({});
10
+
11
+ const toggleHover = (index : number , state : boolean ) => {
12
+ hoverStates .value [index ] = state ;
13
+ };
7
14
</script >
8
15
9
16
<template >
@@ -12,12 +19,21 @@ const props = defineProps<{
12
19
<tr class =" interactiveList" v-for =" (header, index) in props.message.headers" :key =" index" >
13
20
<td nowrap =" nowrap" >{{ header.key }}</td >
14
21
<td >
15
- <pre >{{ header.value }}</pre >
22
+ <div class =" headercopy" @mouseover =" toggleHover(index, true)" @mouseleave =" toggleHover(index, false)" >
23
+ <pre >{{ header.value }}</pre >
24
+ <CopyToClipboard v-if =" hoverStates[index]" :value =" header.value || ''" :isIconOnly =" true" />
25
+ </div >
16
26
</td >
17
27
</tr >
18
28
</tbody >
19
29
</table >
20
30
<div v-if =" props.message.headersNotFound" class =" alert alert-info" >Could not find message headers. This could be because the message URL is invalid or the corresponding message was processed and is no longer tracked by ServiceControl.</div >
21
31
</template >
22
32
23
- <style scoped></style >
33
+ <style scoped>
34
+ .headercopy {
35
+ display : flex ;
36
+ align-items : top ;
37
+ gap : 0.4rem ;
38
+ }
39
+ </style >
You can’t perform that action at this time.
0 commit comments