mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-17 15:21:54 +00:00
fix/ui/Service-map-filtering-is-not-updated-after-refresh_TRA-4497 (#1033)
* filter graph when refresh * change to const * listen only for getServicesForFilter Co-authored-by: Leon <> Co-authored-by: Igor Gov <iggvrv@gmail.com>
This commit is contained in:
@@ -78,15 +78,8 @@ export const ServiceMapModal: React.FC<ServiceMapModalProps> = ({ isOpen, onClos
|
|||||||
const serviceMapData: ServiceMapGraph = await getServiceMapDataApi()
|
const serviceMapData: ServiceMapGraph = await getServiceMapDataApi()
|
||||||
setServiceMapApiData(serviceMapData)
|
setServiceMapApiData(serviceMapData)
|
||||||
const newGraphData: GraphData = { nodes: [], edges: [] }
|
const newGraphData: GraphData = { nodes: [], edges: [] }
|
||||||
|
|
||||||
if (serviceMapData.nodes) {
|
|
||||||
newGraphData.nodes = serviceMapData.nodes.map(mapNodesDatatoGraph)
|
newGraphData.nodes = serviceMapData.nodes.map(mapNodesDatatoGraph)
|
||||||
}
|
|
||||||
|
|
||||||
if (serviceMapData.edges) {
|
|
||||||
newGraphData.edges = serviceMapData.edges.map(mapEdgesDatatoGraph)
|
newGraphData.edges = serviceMapData.edges.map(mapEdgesDatatoGraph)
|
||||||
}
|
|
||||||
|
|
||||||
setGraphData(newGraphData)
|
setGraphData(newGraphData)
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
toast.error("An error occurred while loading Mizu Service Map, see console for mode details", { containerId: TOAST_CONTAINER_ID });
|
toast.error("An error occurred while loading Mizu Service Map, see console for mode details", { containerId: TOAST_CONTAINER_ID });
|
||||||
@@ -145,9 +138,11 @@ export const ServiceMapModal: React.FC<ServiceMapModalProps> = ({ isOpen, onClos
|
|||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (checkedServices.length > 0) return // only after refresh
|
if (checkedServices.length > 0)
|
||||||
|
filterServiceMap()
|
||||||
|
else
|
||||||
filterServiceMap(checkedProtocols, getServicesForFilter.map(x => x.key).filter(serviceName => !Utils.isIpAddress(serviceName)))
|
filterServiceMap(checkedProtocols, getServicesForFilter.map(x => x.key).filter(serviceName => !Utils.isIpAddress(serviceName)))
|
||||||
}, [getServicesForFilter, checkedServices])
|
}, [getServicesForFilter])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getServiceMapData()
|
getServiceMapData()
|
||||||
|
Reference in New Issue
Block a user