@@ -124,9 +124,6 @@ const IncidentsPage = () => {
124124 const incidentsActiveFilters = useSelector ( ( state : MonitoringState ) =>
125125 state . plugins . mcp . getIn ( [ 'incidentsData' , 'incidentsActiveFilters' ] ) ,
126126 ) ;
127- const incidentGroupId = useSelector ( ( state : MonitoringState ) =>
128- state . plugins . mcp . getIn ( [ 'incidentsData' , 'groupId' ] ) ,
129- ) ;
130127 const alertsData = useSelector ( ( state : MonitoringState ) =>
131128 state . plugins . mcp . getIn ( [ 'incidentsData' , 'alertsData' ] ) ,
132129 ) ;
@@ -142,6 +139,7 @@ const IncidentsPage = () => {
142139 state . plugins . mcp . getIn ( [ 'incidentsData' , 'incidentPageFilterType' ] ) ,
143140 ) ;
144141
142+ const selectedGroupId = incidentsActiveFilters . groupId ?. [ 0 ] ?? null ;
145143 useEffect ( ( ) => {
146144 const hasUrlParams = Object . keys ( urlParams ) . length > 0 ;
147145 if ( hasUrlParams ) {
@@ -170,7 +168,7 @@ const IncidentsPage = () => {
170168 } , [ ] ) ;
171169
172170 useEffect ( ( ) => {
173- updateBrowserUrl ( incidentsActiveFilters , incidentGroupId ) ;
171+ updateBrowserUrl ( incidentsActiveFilters , selectedGroupId ) ;
174172 } , [ incidentsActiveFilters ] ) ;
175173
176174 useEffect ( ( ) => {
@@ -284,13 +282,13 @@ const IncidentsPage = () => {
284282 } , [ timeRanges ] ) ;
285283
286284 useEffect ( ( ) => {
287- if ( incidentGroupId ) {
285+ if ( selectedGroupId ) {
288286 Promise . all (
289287 timeRanges . map ( async ( range ) => {
290288 const response = await fetchDataForIncidentsAndAlerts (
291289 safeFetch ,
292290 range ,
293- `cluster:health:components:map{group_id='${ incidentGroupId } '}` ,
291+ `cluster:health:components:map{group_id='${ selectedGroupId } '}` ,
294292 perspective ,
295293 ) ;
296294 return response . data . result ;
@@ -307,7 +305,7 @@ const IncidentsPage = () => {
307305 console . log ( err ) ;
308306 } ) ;
309307 }
310- } , [ incidentGroupId , timeRanges ] ) ;
308+ } , [ selectedGroupId , timeRanges ] ) ;
311309
312310 const onSelect = ( _event , value ) => {
313311 if ( value ) {
@@ -334,7 +332,7 @@ const IncidentsPage = () => {
334332 < Toolbar
335333 id = "toolbar-with-filter"
336334 collapseListedFiltersBreakpoint = "xl"
337- clearAllFilters = { ( ) =>
335+ clearAllFilters = { ( ) => {
338336 dispatch (
339337 setIncidentsActiveFilters ( {
340338 incidentsActiveFilters : {
@@ -344,8 +342,9 @@ const IncidentsPage = () => {
344342 groupId : [ ] ,
345343 } ,
346344 } ) ,
347- )
348- }
345+ ) ;
346+ dispatch ( setAlertsAreLoading ( { alertsAreLoading : true } ) ) ;
347+ } }
349348 >
350349 < ToolbarContent >
351350 < ToolbarGroup >
@@ -373,6 +372,7 @@ const IncidentsPage = () => {
373372 { incidentPageFilterTypeSelected }
374373 </ MenuToggle >
375374 ) }
375+ style = { { width : '145px' } }
376376 >
377377 < SelectOption
378378 value = "Severity"
@@ -394,7 +394,9 @@ const IncidentsPage = () => {
394394 </ SelectOption >
395395 </ Select >
396396 </ ToolbarItem >
397- < ToolbarItem >
397+ < ToolbarItem
398+ className = { incidentPageFilterTypeSelected !== 'Severity' ? 'pf-m-hidden' : '' }
399+ >
398400 < IncidentFilterToolbarItem
399401 categoryName = "Severity"
400402 toggleLabel = "Severity filters"
@@ -414,7 +416,9 @@ const IncidentsPage = () => {
414416 showToolbarItem = { incidentPageFilterTypeSelected ?. includes ( 'Severity' ) }
415417 />
416418 </ ToolbarItem >
417- < ToolbarItem >
419+ < ToolbarItem
420+ className = { incidentPageFilterTypeSelected !== 'State' ? 'pf-m-hidden' : '' }
421+ >
418422 < IncidentFilterToolbarItem
419423 categoryName = "State"
420424 toggleLabel = "State filters"
@@ -434,7 +438,11 @@ const IncidentsPage = () => {
434438 showToolbarItem = { incidentPageFilterTypeSelected ?. includes ( 'State' ) }
435439 />
436440 </ ToolbarItem >
437- < ToolbarItem >
441+ < ToolbarItem
442+ className = {
443+ incidentPageFilterTypeSelected !== 'Incident ID' ? 'pf-m-hidden' : ''
444+ }
445+ >
438446 < IncidentFilterToolbarItem
439447 categoryName = "Incident ID"
440448 toggleLabel = "Incident ID filters"
@@ -445,7 +453,7 @@ const IncidentsPage = () => {
445453 incidentFilterIsExpanded = { filtersExpanded . groupId }
446454 onIncidentFiltersSelect = { onIncidentFiltersSelect }
447455 setIncidentIsExpanded = { ( isExpanded ) =>
448- setFiltersExpanded ( ( prev ) => ( { ...prev , incidentId : isExpanded } ) )
456+ setFiltersExpanded ( ( prev ) => ( { ...prev , groupId : isExpanded } ) )
449457 }
450458 onIncidentFilterToggle = { ( ev ) =>
451459 onFilterToggle ( ev , 'groupId' , setFiltersExpanded )
0 commit comments