Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bc85944

Browse files
ohltylergithub-actions[bot]
authored andcommittedApr 1, 2024·
Populate selected indices from query params on initial load (#713)
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com> (cherry picked from commit e5cf2d8)
1 parent 5c70d83 commit bc85944

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)
Please sign in to comment.