Skip to content

Commit

Permalink
fix empty string in selected indices (elastic#76855)
Browse files Browse the repository at this point in the history
  • Loading branch information
jloleysens committed Sep 8, 2020
1 parent 7724c0f commit 7e181eb
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const IndicesAndDataStreamsField: FunctionComponent<Props> = ({

// We assume all indices if the config has no indices entry or if we receive an empty array
const [isAllIndices, setIsAllIndices] = useState<boolean>(
!config.indices || (Array.isArray(config.indices) && config.indices.length === 0)
config.indices == null || (Array.isArray(config.indices) && config.indices.length === 0)
);

const onUpdate = (data: IndicesConfig) => {
Expand Down Expand Up @@ -135,12 +135,17 @@ export const IndicesAndDataStreamsField: FunctionComponent<Props> = ({
);
onUpdate({ indices: undefined });
} else {
onUpdate({
indices:
selectIndicesMode === 'custom'
? indexPatterns.join(',')
: [...(indicesAndDataStreamsSelection || [])],
});
_onUpdate(
{
indices:
selectIndicesMode === 'custom'
? indexPatterns.join(',')
: [...(indicesAndDataStreamsSelection || [])],
},
{
validateIndicesCount: true,
}
);
}
}}
/>
Expand Down

0 comments on commit 7e181eb

Please sign in to comment.