@@ -22,6 +22,8 @@ import { useDispatch, useSelector } from 'react-redux';
2222import { useLocationQuery } from '../hooks/useLocationQuery' ;
2323import { usePluginAvailable } from '../hooks/usePluginAvailable' ;
2424import { getGoalsGraph , getNeighborsGraph } from '../korrel8r-client' ;
25+ import { AlertDomain } from '../korrel8r/alert' ;
26+ import { allDomains } from '../korrel8r/all-domains' ;
2527import * as api from '../korrel8r/client' ;
2628import * as korrel8r from '../korrel8r/types' ;
2729import { defaultSearch , Search , SearchType , setPersistedSearch } from '../redux-actions' ;
@@ -48,7 +50,16 @@ export default function Korrel8rPanel() {
4850 const dispatch = useDispatch ( ) ;
4951
5052 // State
51- const locationQuery = useLocationQuery ( ) ;
53+ const alertRules = useSelector ( ( state : State ) => state . observe ?. get ( 'rules' ) ) ;
54+ const alertIDs = React . useMemo (
55+ ( ) => new Map < string , string > ( alertRules . map ( ( { id, name } ) => [ id , name ] ) ) ,
56+ [ alertRules ] ,
57+ ) ;
58+ const domains = React . useMemo (
59+ ( ) => new korrel8r . Domains ( ...allDomains , new AlertDomain ( alertIDs ) ) ,
60+ [ alertIDs ] ,
61+ ) ;
62+ const locationQuery = useLocationQuery ( domains ) ;
5263 const [ search , setSearch ] = React . useState < Search > (
5364 persistedSearch ?. queryStr
5465 ? persistedSearch
@@ -205,20 +216,27 @@ export default function Korrel8rPanel() {
205216 </ ExpandableSection >
206217 < Divider />
207218 < FlexItem className = "tp-plugin__panel-topology-container" grow = { { default : 'grow' } } >
208- < Topology result = { result } constraint = { search . constraint } t = { t } setSearch = { setSearch } />
219+ < Topology
220+ domains = { domains }
221+ result = { result }
222+ constraint = { search . constraint }
223+ t = { t }
224+ setSearch = { setSearch }
225+ />
209226 </ FlexItem >
210227 </ >
211228 ) ;
212229}
213230
214231interface TopologyProps {
232+ domains : korrel8r . Domains ;
215233 result ?: Result ;
216234 constraint : korrel8r . Constraint ;
217235 t : TFunction ;
218236 setSearch : ( search : Search ) => void ;
219237}
220238
221- const Topology : React . FC < TopologyProps > = ( { result, t, constraint } ) => {
239+ const Topology : React . FC < TopologyProps > = ( { domains , result, t, constraint } ) => {
222240 const [ loggingAvailable , loggingAvailableLoading ] = usePluginAvailable ( 'logging-view-plugin' ) ;
223241 const [ netobserveAvailable , netobserveAvailableLoading ] = usePluginAvailable ( 'netobserv-plugin' ) ;
224242
@@ -231,6 +249,7 @@ const Topology: React.FC<TopologyProps> = ({ result, t, constraint }) => {
231249 // Non-empty graph
232250 return (
233251 < Korrel8rTopology
252+ domains = { domains }
234253 graph = { result . graph }
235254 loggingAvailable = { loggingAvailable }
236255 netobserveAvailable = { netobserveAvailable }
0 commit comments