11<script setup>
22import { middleTruncate } from " @ogw_front/utils/string" ;
3+ import { useFeedbackStore } from " @ogw_front/stores/feedback" ;
4+
5+ const feedbackStore = useFeedbackStore ();
36
47const { item , isLeaf } = defineProps ({
58 item: { type: Object , required: true },
@@ -47,6 +50,11 @@ const tooltipDisabled = computed(() => {
4750 }
4851 return actualItem .value .children && actualItem .value .children .length > 0 ;
4952});
53+
54+ async function copyToClipboard (text , label ) {
55+ await navigator .clipboard .writeText (text);
56+ feedbackStore .add_success (` ${ label} copied to clipboard` );
57+ }
5058 </script >
5159
5260<template >
@@ -55,7 +63,13 @@ const tooltipDisabled = computed(() => {
5563 :data-testid =" 'treeRow-' + actualItem.id"
5664 class =" tree-item-label-container w-100"
5765 >
58- <v-tooltip :disabled =" tooltipDisabled" location =" right" open-delay =" 400" >
66+ <v-tooltip
67+ :disabled =" tooltipDisabled"
68+ location =" right"
69+ open-delay =" 400"
70+ close-delay =" 100"
71+ interactive
72+ >
5973 <template #activator =" { props: tooltipProps } " >
6074 <span
6175 v-bind =" tooltipProps"
@@ -70,14 +84,32 @@ const tooltipDisabled = computed(() => {
7084 </template >
7185
7286 <div class =" d-flex flex-column ga-1" >
73- <span class =" text-caption" >
74- <strong class =" text-white" >ID:</strong > {{ actualItem.id }}
87+ <span class =" text-caption d-flex align-center" >
88+ <strong class =" text-white mr-1" >ID:</strong >
89+ <span >{{ actualItem.id }}</span >
90+ <v-btn
91+ icon =" mdi-content-copy"
92+ variant =" text"
93+ size =" x-small"
94+ density =" compact"
95+ class =" ml-1 text-white"
96+ @click.stop =" copyToClipboard(actualItem.id, 'ID')"
97+ />
7598 </span >
76- <span v-if =" actualItem.title" class =" text-caption" >
77- <strong class =" text-white" >Name:</strong > {{ actualItem.title }}
99+ <span v-if =" actualItem.title" class =" text-caption d-flex align-center" >
100+ <strong class =" text-white mr-1" >Name:</strong >
101+ <span >{{ actualItem.title }}</span >
102+ <v-btn
103+ icon =" mdi-content-copy"
104+ variant =" text"
105+ size =" x-small"
106+ density =" compact"
107+ class =" ml-1 text-white"
108+ @click.stop =" copyToClipboard(actualItem.title, 'Name')"
109+ />
78110 </span >
79- <span class =" text-caption" >
80- <strong class =" text-white" >Status:</strong >
111+ <span class =" text-caption d-flex align-center " >
112+ <strong class =" text-white mr-1 " >Status:</strong >
81113 <i class =" ml-1" >{{ actualItem.is_active ? "Active" : "Inactive" }}</i >
82114 </span >
83115 </div >
0 commit comments