Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
Frontend V2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GraphPolaris
Frontend V2
Commits
9c8076ca
Commit
9c8076ca
authored
1 month ago
by
Dennis Collaris
Browse files
Options
Downloads
Patches
Plain Diff
feat: doubleclick to copy from node link popup
parent
8ee155ec
No related branches found
No related tags found
1 merge request
!474
feat: doubleclick to copy from node link popup
Pipeline
#147188
failed
1 month ago
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib/vis/visualizations/nodelinkvis/components/NLPopup.tsx
+22
-3
22 additions, 3 deletions
...lib/vis/visualizations/nodelinkvis/components/NLPopup.tsx
with
22 additions
and
3 deletions
src/lib/vis/visualizations/nodelinkvis/components/NLPopup.tsx
+
22
−
3
View file @
9c8076ca
import
React
from
'
react
'
;
import
{
Tooltip
Provid
er
}
from
'
@/lib/components/tooltip
'
;
import
React
,
{
useState
}
from
'
react
'
;
import
{
Tooltip
,
TooltipContent
,
TooltipProvider
,
TooltipTrigg
er
}
from
'
@/lib/components/tooltip
'
;
import
{
ATTRIBUTE_MAX_CHARACTERS
}
from
'
@/config
'
;
const
formatNumber
=
(
number
:
number
)
=>
{
if
(
String
(
number
).
length
<=
4
)
return
number
;
return
number
.
toLocaleString
(
'
de-DE
'
);
};
...
...
@@ -11,6 +12,8 @@ export type NLPopUpProps = {
};
export
const
NLPopUp
:
React
.
FC
<
NLPopUpProps
>
=
({
data
})
=>
{
const
[
didCopy
,
setDidCopy
]
=
useState
<
string
|
null
>
(
null
);
return
(
<
TooltipProvider
delay
=
{
100
}
>
<
div
className
=
{
`px-2`
}
>
...
...
@@ -26,7 +29,23 @@ export const NLPopUp: React.FC<NLPopUpProps> = ({ data }) => {
<
span
className
=
{
`font-semibold truncate min-w-[40%]`
}
>
{
k
}
</
span
>
<
span
className
=
"ml-auto text-right truncate grow-1 flex items-center"
>
{
v
!==
undefined
&&
(
typeof
v
!==
'
object
'
||
Array
.
isArray
(
v
))
&&
v
!=
''
?
(
<
span
className
=
"ml-auto text-right truncate"
>
{
typeof
v
===
'
number
'
?
formatNumber
(
v
)
:
v
.
toString
()
}
</
span
>
<
Tooltip
open
=
{
didCopy
===
k
}
placement
=
"top"
>
<
TooltipContent
>
Copied!
</
TooltipContent
>
<
TooltipTrigger
>
<
span
className
=
"ml-auto text-right truncate"
onDoubleClick
=
{
e
=>
{
const
value
=
typeof
v
===
'
number
'
?
formatNumber
(
v
)
:
v
.
toString
();
navigator
.
clipboard
.
writeText
(
value
);
setDidCopy
(
k
);
window
.
getSelection
()?.
empty
();
setTimeout
(()
=>
setDidCopy
(
null
),
1000
);
}
}
>
{
typeof
v
===
'
number
'
?
formatNumber
(
v
)
:
v
.
toString
()
}
</
span
>
</
TooltipTrigger
>
</
Tooltip
>
)
:
(
<
div
className
=
{
`ml-auto mt-auto h-4 w-12 border-[1px] solid border-gray`
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment