Skip to content

Commit aa32e4b

Browse files
committed
Populate selected indices from query params on initial load
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
1 parent e9e178d commit aa32e4b

File tree

1 file changed

+6
-4
lines changed
  • public/pages/DetectorsList/containers/List

1 file changed

+6
-4
lines changed

public/pages/DetectorsList/containers/List/List.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
EuiBasicTable,
1515
EuiButton,
1616
EuiComboBoxOptionProps,
17-
EuiHorizontalRule,
1817
EuiPage,
1918
EuiPageBody,
2019
EuiSpacer,
@@ -191,11 +190,14 @@ export const DetectorList = (props: ListProps) => {
191190
const visibleAliases = get(opensearchState, 'aliases', []) as IndexAlias[];
192191
const indexOptions = getVisibleOptions(visibleIndices, visibleAliases);
193192

193+
const queryParams = getURLQueryParams(props.location);
194194
const [state, setState] = useState<ListState>({
195195
page: 0,
196-
queryParams: getURLQueryParams(props.location),
196+
queryParams,
197197
selectedDetectorStates: ALL_DETECTOR_STATES,
198-
selectedIndices: ALL_INDICES,
198+
selectedIndices: queryParams.indices
199+
? queryParams.indices.split(',')
200+
: ALL_INDICES,
199201
});
200202

201203
// Set breadcrumbs on page initialization
@@ -211,7 +213,7 @@ export const DetectorList = (props: ListProps) => {
211213
const { history, location } = props;
212214
const updatedParams = {
213215
...state.queryParams,
214-
indices: state.selectedIndices.join(' '),
216+
indices: state.selectedIndices.join(','),
215217
from: state.page * state.queryParams.size,
216218
};
217219

0 commit comments

Comments
 (0)