Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Mizu
Commits
2427955a
Unverified
Commit
2427955a
authored
3 years ago
by
lirazyehezkel
Committed by
GitHub
3 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Avoid overlap only for service map including under 10 services
parent
27a73e21
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ui/src/components/ServiceMapModal/ServiceMapModal.tsx
+19
-10
ui/src/components/ServiceMapModal/ServiceMapModal.tsx
ui/src/components/ServiceMapModal/ServiceMapOptions.ts
+2
-2
ui/src/components/ServiceMapModal/ServiceMapOptions.ts
with
21 additions
and
12 deletions
+21
-12
ui/src/components/ServiceMapModal/ServiceMapModal.tsx
+
19
-
10
View file @
2427955a
...
...
@@ -100,6 +100,7 @@ export const ServiceMapModal: React.FC<ServiceMapModalProps> = ({ isOpen, onOpen
const
commonClasses
=
useCommonStyles
();
const
[
isLoading
,
setIsLoading
]
=
useState
<
boolean
>
(
true
);
const
[
graphData
,
setGraphData
]
=
useState
<
GraphData
>
({
nodes
:
[],
edges
:
[]
});
const
[
graphOptions
,
setGraphOptions
]
=
useState
(
ServiceMapOptions
);
const
getServiceMapData
=
useCallback
(
async
()
=>
{
try
{
...
...
@@ -149,6 +150,14 @@ export const ServiceMapModal: React.FC<ServiceMapModalProps> = ({ isOpen, onOpen
// eslint-disable-next-line
},
[
isOpen
])
useEffect
(()
=>
{
if
(
graphData
?.
nodes
?.
length
===
0
)
return
;
let
options
=
{...
graphOptions
};
options
.
physics
.
barnesHut
.
avoidOverlap
=
graphData
?.
nodes
?.
length
>
10
?
0
:
1
;
setGraphOptions
(
options
);
// eslint-disable-next-line
},[
graphData
?.
nodes
?.
length
])
useEffect
(()
=>
{
getServiceMapData
();
return
()
=>
setGraphData
({
nodes
:
[],
edges
:
[]
})
...
...
@@ -180,7 +189,7 @@ export const ServiceMapModal: React.FC<ServiceMapModalProps> = ({ isOpen, onOpen
<
div
style
=
{
{
display
:
"
flex
"
,
justifyContent
:
"
space-between
"
}
}
>
<
div
>
<
Button
startIcon
=
{
<
img
src
=
{
refresh
}
className
=
"custom"
alt
=
"refresh"
style
=
{
{
marginRight
:
"
8%
"
}
}
></
img
>
}
startIcon
=
{
<
img
src
=
{
refresh
}
className
=
"custom"
alt
=
"refresh"
style
=
{
{
marginRight
:
"
8%
"
}
}
/
>
}
size
=
"medium"
variant
=
"contained"
className
=
{
commonClasses
.
outlinedButton
+
"
"
+
commonClasses
.
imagedButton
}
...
...
@@ -189,20 +198,20 @@ export const ServiceMapModal: React.FC<ServiceMapModalProps> = ({ isOpen, onOpen
Refresh
</
Button
>
</
div
>
<
img
src
=
{
close
}
alt
=
"close"
onClick
=
{
()
=>
onClose
()
}
style
=
{
{
cursor
:
"
pointer
"
}
}
></
img
>
<
img
src
=
{
close
}
alt
=
"close"
onClick
=
{
()
=>
onClose
()
}
style
=
{
{
cursor
:
"
pointer
"
}
}
/
>
</
div
>
<
Graph
graph
=
{
graphData
}
options
=
{
ServiceM
apOptions
}
options
=
{
gr
ap
h
Options
}
/>
<
div
className
=
'legend-scale'
>
<
ul
className
=
'legend-labels'
>
<
li
><
span
style
=
{
{
background
:
'
#205cf5
'
}
}
></
span
>
HTTP
</
li
>
<
li
><
span
style
=
{
{
background
:
'
#244c5a
'
}
}
></
span
>
HTTP/2
</
li
>
<
li
><
span
style
=
{
{
background
:
'
#244c5a
'
}
}
></
span
>
gRPC
</
li
>
<
li
><
span
style
=
{
{
background
:
'
#ff6600
'
}
}
></
span
>
AMQP
</
li
>
<
li
><
span
style
=
{
{
background
:
'
#000000
'
}
}
></
span
>
KAFKA
</
li
>
<
li
><
span
style
=
{
{
background
:
'
#a41e11
'
}
}
></
span
>
REDIS
</
li
>
<
li
><
span
style
=
{
{
background
:
'
#205cf5
'
}
}
/
>
HTTP
</
li
>
<
li
><
span
style
=
{
{
background
:
'
#244c5a
'
}
}
/
>
HTTP/2
</
li
>
<
li
><
span
style
=
{
{
background
:
'
#244c5a
'
}
}
/
>
gRPC
</
li
>
<
li
><
span
style
=
{
{
background
:
'
#ff6600
'
}
}
/
>
AMQP
</
li
>
<
li
><
span
style
=
{
{
background
:
'
#000000
'
}
}
/
>
KAFKA
</
li
>
<
li
><
span
style
=
{
{
background
:
'
#a41e11
'
}
}
/
>
REDIS
</
li
>
</
ul
>
</
div
>
</
div
>
}
...
...
@@ -211,4 +220,4 @@ export const ServiceMapModal: React.FC<ServiceMapModalProps> = ({ isOpen, onOpen
</
Modal
>
);
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
ui/src/components/ServiceMapModal/ServiceMapOptions.ts
+
2
-
2
View file @
2427955a
...
...
@@ -148,7 +148,7 @@ const ServiceMapOptions = {
springLength
:
180
,
springConstant
:
0.04
,
damping
:
0.2
,
avoidOverlap
:
1
avoidOverlap
:
0
},
},
layout
:
{
...
...
@@ -171,4 +171,4 @@ const ServiceMapOptions = {
},
};
export
default
ServiceMapOptions
\ No newline at end of file
export
default
ServiceMapOptions
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help