Skip to content

Commit

Permalink
Populate selected indices from query params on initial load (#713)
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Ohlsen <[email protected]>
  • Loading branch information
ohltyler authored Apr 1, 2024
1 parent e9e178d commit e5cf2d8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions public/pages/DetectorsList/containers/List/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
EuiBasicTable,
EuiButton,
EuiComboBoxOptionProps,
EuiHorizontalRule,
EuiPage,
EuiPageBody,
EuiSpacer,
Expand Down Expand Up @@ -191,11 +190,14 @@ export const DetectorList = (props: ListProps) => {
const visibleAliases = get(opensearchState, 'aliases', []) as IndexAlias[];
const indexOptions = getVisibleOptions(visibleIndices, visibleAliases);

const queryParams = getURLQueryParams(props.location);
const [state, setState] = useState<ListState>({
page: 0,
queryParams: getURLQueryParams(props.location),
queryParams,
selectedDetectorStates: ALL_DETECTOR_STATES,
selectedIndices: ALL_INDICES,
selectedIndices: queryParams.indices
? queryParams.indices.split(',')
: ALL_INDICES,
});

// Set breadcrumbs on page initialization
Expand All @@ -211,7 +213,7 @@ export const DetectorList = (props: ListProps) => {
const { history, location } = props;
const updatedParams = {
...state.queryParams,
indices: state.selectedIndices.join(' '),
indices: state.selectedIndices.join(','),
from: state.page * state.queryParams.size,
};

Expand Down

0 comments on commit e5cf2d8

Please sign in to comment.