Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
SigNoz
Commits
9dd9f113
Unverified
Commit
9dd9f113
authored
4 years ago
by
Ankit Nayan
Committed by
GitHub
4 years ago
Browse files
Options
Download
Plain Diff
Merge pull request #104 from SigNoz/issue-103-
Fixes multiple re-renders
parents
613e6ba5
8b743f78
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
frontend/src/modules/Servicemap/ServiceMap.tsx
+2
-1
frontend/src/modules/Servicemap/ServiceMap.tsx
frontend/src/modules/Servicemap/utils.ts
+11
-0
frontend/src/modules/Servicemap/utils.ts
frontend/src/store/actions/serviceMap.ts
+12
-2
frontend/src/store/actions/serviceMap.ts
with
25 additions
and
3 deletions
+25
-3
frontend/src/modules/Servicemap/ServiceMap.tsx
+
2
-
1
View file @
9dd9f113
...
...
@@ -10,6 +10,7 @@ import {
import
{
Spin
}
from
"
antd
"
;
import
styled
from
"
styled-components
"
;
import
{
StoreState
}
from
"
../../store/reducers
"
;
import
{
getZoomPx
,
getGraphData
}
from
"
./utils
"
;
import
{
getGraphData
,
getTooltip
}
from
"
./utils
"
;
import
SelectService
from
"
./SelectService
"
;
import
{
ForceGraph2D
}
from
"
react-force-graph
"
;
...
...
@@ -72,7 +73,7 @@ const ServiceMap = (props: ServiceMapProps) => {
}
const
zoomToService
=
(
value
:
string
)
=>
{
fgRef
&&
fgRef
.
current
.
zoomToFit
(
700
,
380
,
(
e
)
=>
e
.
id
===
value
);
fgRef
&&
fgRef
.
current
.
zoomToFit
(
700
,
getZoomPx
()
,
(
e
)
=>
e
.
id
===
value
);
};
const
{
nodes
,
links
}
=
getGraphData
(
serviceMap
);
...
...
This diff is collapsed.
Click to expand it.
frontend/src/modules/Servicemap/utils.ts
+
11
-
0
View file @
9dd9f113
...
...
@@ -74,6 +74,16 @@ export const getGraphData = (serviceMap: serviceMapStore): graphDataType => {
};
};
export
const
getZoomPx
=
():
number
=>
{
const
width
=
window
.
screen
.
width
;
if
(
width
<
1400
)
{
return
190
;
}
else
if
(
width
>
1400
&&
width
<
2500
)
{
return
380
;
}
else
if
(
width
>
2500
)
{
return
360
;
}
export
const
getTooltip
=
(
node
:
{
p99
:
number
;
errorRate
:
number
;
...
...
@@ -95,4 +105,5 @@ export const getTooltip = (node: {
<div class="val">
${
node
.
errorRate
}
%</div>
</div>
</div>`
;
};
This diff is collapsed.
Click to expand it.
frontend/src/store/actions/serviceMap.ts
+
12
-
2
View file @
9dd9f113
...
...
@@ -38,6 +38,11 @@ export interface servicesAction {
export
const
getServiceMapItems
=
(
globalTime
:
GlobalTime
)
=>
{
return
async
(
dispatch
:
Dispatch
)
=>
{
dispatch
<
serviceMapItemAction
>
({
type
:
ActionTypes
.
getServiceMapItems
,
payload
:
[],
});
let
request_string
=
"
/serviceMapDependencies?start=
"
+
globalTime
.
minTime
+
...
...
@@ -45,7 +50,7 @@ export const getServiceMapItems = (globalTime: GlobalTime) => {
globalTime
.
maxTime
;
const
response
=
await
api
.
get
<
servicesMapItem
[]
>
(
apiV1
+
request_string
);
dispatch
<
serviceMapItemAction
>
({
type
:
ActionTypes
.
getServiceMapItems
,
payload
:
response
.
data
,
...
...
@@ -55,11 +60,16 @@ export const getServiceMapItems = (globalTime: GlobalTime) => {
export
const
getDetailedServiceMapItems
=
(
globalTime
:
GlobalTime
)
=>
{
return
async
(
dispatch
:
Dispatch
)
=>
{
dispatch
<
servicesAction
>
({
type
:
ActionTypes
.
getServices
,
payload
:
[],
});
let
request_string
=
"
/services?start=
"
+
globalTime
.
minTime
+
"
&end=
"
+
globalTime
.
maxTime
;
const
response
=
await
api
.
get
<
servicesItem
[]
>
(
apiV1
+
request_string
);
dispatch
<
servicesAction
>
({
type
:
ActionTypes
.
getServices
,
payload
:
response
.
data
,
...
...
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