11/* eslint-disable react-hooks/exhaustive-deps */
2- import * as React from 'react' ;
2+ import { useMemo , useState , useEffect } from 'react' ;
33import { useSafeFetch } from '../console/utils/safe-fetch-hook' ;
44import { createAlertsQuery , fetchDataForIncidentsAndAlerts } from './api' ;
55import { useTranslation } from 'react-i18next' ;
@@ -63,24 +63,24 @@ const IncidentsPage = () => {
6363 const { t } = useTranslation ( process . env . I18N_NAMESPACE ) ;
6464 const dispatch = useDispatch ( ) ;
6565 const location = useLocation ( ) ;
66- const urlParams = React . useMemo ( ( ) => parseUrlParams ( location . search ) , [ location . search ] ) ;
66+ const urlParams = useMemo ( ( ) => parseUrlParams ( location . search ) , [ location . search ] ) ;
6767 const { perspective } = usePerspective ( ) ;
6868 const { theme } = usePatternFlyTheme ( ) ;
6969 // loading states
70- const [ incidentsAreLoading , setIncidentsAreLoading ] = React . useState ( true ) ;
70+ const [ incidentsAreLoading , setIncidentsAreLoading ] = useState ( true ) ;
7171 // days span is where we store the value for creating time ranges for
7272 // fetch incidents/alerts based on the length of time ranges
7373 // when days filter changes we set a new days span -> calculate new time range and fetch new data
74- const [ daysSpan , setDaysSpan ] = React . useState < number > ( ) ;
75- const [ timeRanges , setTimeRanges ] = React . useState ( [ ] ) ;
74+ const [ daysSpan , setDaysSpan ] = useState < number > ( ) ;
75+ const [ timeRanges , setTimeRanges ] = useState ( [ ] ) ;
7676 // data that is used for processing to serve it to the alerts table and chart
77- const [ incidentForAlertProcessing , setIncidentForAlertProcessing ] = React . useState <
77+ const [ incidentForAlertProcessing , setIncidentForAlertProcessing ] = useState <
7878 Array < Partial < Incident > >
7979 > ( [ ] ) ;
80- const [ hideCharts , setHideCharts ] = React . useState ( false ) ;
80+ const [ hideCharts , setHideCharts ] = useState ( false ) ;
8181
82- const [ incidentFilterIsExpanded , setIncidentIsExpanded ] = React . useState ( false ) ;
83- const [ daysFilterIsExpanded , setDaysFilterIsExpanded ] = React . useState ( false ) ;
82+ const [ incidentFilterIsExpanded , setIncidentIsExpanded ] = useState ( false ) ;
83+ const [ daysFilterIsExpanded , setDaysFilterIsExpanded ] = useState ( false ) ;
8484
8585 const onIncidentFilterToggle = ( ev ) => {
8686 ev . stopPropagation ( ) ;
@@ -115,7 +115,7 @@ const IncidentsPage = () => {
115115 const filteredData = useSelector ( ( state : MonitoringState ) =>
116116 state . plugins . mcp . getIn ( [ 'incidentsData' , 'filteredIncidentsData' ] ) ,
117117 ) ;
118- React . useEffect ( ( ) => {
118+ useEffect ( ( ) => {
119119 const hasUrlParams = Object . keys ( urlParams ) . length > 0 ;
120120 if ( hasUrlParams ) {
121121 // If URL parameters exist, update incidentsActiveFilters based on them
@@ -147,11 +147,11 @@ const IncidentsPage = () => {
147147 }
148148 } , [ ] ) ;
149149
150- React . useEffect ( ( ) => {
150+ useEffect ( ( ) => {
151151 updateBrowserUrl ( incidentsActiveFilters , incidentGroupId ) ;
152152 } , [ incidentsActiveFilters ] ) ;
153153
154- React . useEffect ( ( ) => {
154+ useEffect ( ( ) => {
155155 dispatch (
156156 setFilteredIncidentsData ( {
157157 filteredIncidentsData : filterIncident ( incidentsActiveFilters , incidents ) ,
@@ -163,11 +163,11 @@ const IncidentsPage = () => {
163163 const safeFetch = useSafeFetch ( ) ;
164164 const title = t ( 'Incidents' ) ;
165165
166- React . useEffect ( ( ) => {
166+ useEffect ( ( ) => {
167167 setTimeRanges ( getIncidentsTimeRanges ( daysSpan , now ) ) ;
168168 } , [ daysSpan ] ) ;
169169
170- React . useEffect ( ( ) => {
170+ useEffect ( ( ) => {
171171 setDaysSpan (
172172 parsePrometheusDuration (
173173 incidentsActiveFilters . days . length > 0
@@ -177,7 +177,7 @@ const IncidentsPage = () => {
177177 ) ;
178178 } , [ incidentsActiveFilters . days ] ) ;
179179
180- React . useEffect ( ( ) => {
180+ useEffect ( ( ) => {
181181 ( async ( ) => {
182182 Promise . all (
183183 timeRanges . map ( async ( range ) => {
@@ -206,15 +206,15 @@ const IncidentsPage = () => {
206206 } ) ( ) ;
207207 } , [ incidentForAlertProcessing ] ) ;
208208
209- React . useEffect ( ( ) => {
209+ useEffect ( ( ) => {
210210 dispatch (
211211 setAlertsTableData ( {
212212 alertsTableData : groupAlertsForTable ( alertsData ) ,
213213 } ) ,
214214 ) ;
215215 } , [ alertsData ] ) ;
216216
217- React . useEffect ( ( ) => {
217+ useEffect ( ( ) => {
218218 ( async ( ) => {
219219 Promise . all (
220220 timeRanges . map ( async ( range ) => {
@@ -251,7 +251,7 @@ const IncidentsPage = () => {
251251 } ) ( ) ;
252252 } , [ timeRanges ] ) ;
253253
254- React . useEffect ( ( ) => {
254+ useEffect ( ( ) => {
255255 if ( incidentGroupId ) {
256256 Promise . all (
257257 timeRanges . map ( async ( range ) => {
0 commit comments