@@ -84,7 +84,7 @@ import {
84
84
} from '../../../../../server/utils/helpers' ;
85
85
import { CoreStart , MountPoint } from '../../../../../../../src/core/public' ;
86
86
import { CoreServicesContext } from '../../../../components/CoreServices/CoreServices' ;
87
- import { DataSourceSelectableConfig } from '../../../../../../../src/plugins/data_source_management/public' ;
87
+ import { DataSourceOption , DataSourceSelectableConfig } from '../../../../../../../src/plugins/data_source_management/public' ;
88
88
import {
89
89
getDataSourceManagementPlugin ,
90
90
getDataSourceEnabled ,
@@ -206,25 +206,25 @@ export const DetectorList = (props: ListProps) => {
206
206
selectedIndices : queryParams . indices
207
207
? queryParams . indices . split ( ',' )
208
208
: ALL_INDICES ,
209
- selectedDataSourceId : queryParams . dataSourceId
210
- ? queryParams . dataSourceId
211
- : undefined ,
209
+ selectedDataSourceId : queryParams . dataSourceId === undefined
210
+ ? undefined
211
+ : queryParams . dataSourceId ,
212
212
} ) ;
213
213
214
214
// Set breadcrumbs on page initialization
215
215
useEffect ( ( ) => {
216
216
if ( dataSourceEnabled ) {
217
217
core . chrome . setBreadcrumbs ( [
218
- BREADCRUMBS . ANOMALY_DETECTOR ,
219
- BREADCRUMBS . DETECTORS ,
218
+ MDS_BREADCRUMBS . ANOMALY_DETECTOR ( state . selectedDataSourceId ) ,
219
+ MDS_BREADCRUMBS . DETECTORS ( state . selectedDataSourceId ) ,
220
220
] ) ;
221
221
} else {
222
222
core . chrome . setBreadcrumbs ( [
223
- MDS_BREADCRUMBS . ANOMALY_DETECTOR ( state . selectedDataSourceId ) ,
224
- MDS_BREADCRUMBS . DETECTORS ( state . selectedDataSourceId ) ,
223
+ BREADCRUMBS . ANOMALY_DETECTOR ,
224
+ BREADCRUMBS . DETECTORS ,
225
225
] ) ;
226
226
}
227
- } , [ ] ) ;
227
+ } , [ state . selectedDataSourceId ] ) ;
228
228
229
229
// Getting all initial indices
230
230
const [ indexQuery , setIndexQuery ] = useState ( '' ) ;
@@ -238,12 +238,21 @@ export const DetectorList = (props: ListProps) => {
238
238
// Refresh data if user change any parameters / filter / sort
239
239
useEffect ( ( ) => {
240
240
const { history, location } = props ;
241
- const updatedParams = {
242
- ...state . queryParams ,
243
- indices : state . selectedIndices . join ( ',' ) ,
241
+ let updatedParams = {
244
242
from : state . page * state . queryParams . size ,
245
- dataSourceId : state . selectedDataSourceId ,
246
- } ;
243
+ size : state . queryParams . size ,
244
+ search : state . queryParams . search ,
245
+ indices : state . selectedIndices . join ( ',' ) ,
246
+ sortDirection : state . queryParams . sortDirection ,
247
+ sortField : state . queryParams . sortField ,
248
+ } as GetDetectorsQueryParams ;
249
+
250
+ if ( dataSourceEnabled ) {
251
+ updatedParams = {
252
+ ...updatedParams ,
253
+ dataSourceId : state . selectedDataSourceId ,
254
+ }
255
+ }
247
256
248
257
history . replace ( {
249
258
...location ,
@@ -588,8 +597,8 @@ export const DetectorList = (props: ListProps) => {
588
597
} ) ;
589
598
} ;
590
599
591
- const handleDataSourceChange = ( [ event ] ) => {
592
- const dataSourceId = event ? .id ;
600
+ const handleDataSourceChange = ( dataSources : DataSourceOption [ ] ) => {
601
+ const dataSourceId = dataSources [ 0 ] . id ;
593
602
594
603
if ( dataSourceEnabled && dataSourceId === undefined ) {
595
604
getNotifications ( ) . toasts . addDanger (
0 commit comments