Skip to content

Commit

Permalink
Fix [Alerts] The Event type filter doesn't align with the Entity type…
Browse files Browse the repository at this point in the history
… option (#3078)
  • Loading branch information
ilan7empest authored Feb 4, 2025
1 parent f0f411d commit f2167d7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/Alerts/AlertsFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ under the Apache 2.0 license is conditioned upon your compliance with
such restriction.
*/
import { useCallback, useEffect, useMemo } from 'react'
import { useLocation } from 'react-router-dom'
import { useSelector } from 'react-redux'
import PropTypes from 'prop-types'
import { useForm, useFormState } from 'react-final-form'
import { upperFirst } from 'lodash'
import { useSelector } from 'react-redux'

import StatusFilter from '../../common/StatusFilter/StatusFilter'
import { FormSelect, FormInput } from 'igz-controls/components'
Expand Down Expand Up @@ -56,6 +57,8 @@ const AlertsFilters = ({ isAlertsPage, isCrossProjects }) => {
values: { [ENTITY_TYPE]: entityType }
} = useFormState()

const location = useLocation()

const projectStore = useSelector(state => state.projectStore)

const projectsList = useMemo(() => {
Expand Down Expand Up @@ -87,6 +90,12 @@ const AlertsFilters = ({ isAlertsPage, isCrossProjects }) => {
form.change(inputName, value || '')
}

const handleEntityTypeChange = selectedValue => {
const params = Object.fromEntries(new URLSearchParams(location.search))

form.change(EVENT_TYPE, params[ENTITY_TYPE] === selectedValue ? params[EVENT_TYPE] : 'all')
}

return (
<>
{isCrossProjects && (
Expand All @@ -106,6 +115,7 @@ const AlertsFilters = ({ isAlertsPage, isCrossProjects }) => {
name={ENTITY_TYPE}
options={filterAlertsEntityTypeOptions}
/>
<FormOnChange handler={handleEntityTypeChange} name={ENTITY_TYPE} />
</div>
)}

Expand Down

0 comments on commit f2167d7

Please sign in to comment.