Skip to content

Commit

Permalink
review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese committed Apr 14, 2021
1 parent cda1e3f commit 6571d79
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class GeoIndexPatternSelect extends Component<Props, State> {
this.setState({
doesIndexPatternHaveGeoField: indexPattern.fields.some((field) => {
return this.props?.isGeoPointsOnly
? [ES_GEO_FIELD_TYPE.GEO_POINT as string].includes(field.type)
? (ES_GEO_FIELD_TYPE.GEO_POINT as string) === field.type
: ES_GEO_FIELD_TYPES.includes(field.type);
}),
});
Expand Down Expand Up @@ -95,7 +95,7 @@ export class GeoIndexPatternSelect extends Component<Props, State> {
<EuiLink href={getHttp().basePath.prepend(`/app/management/kibana/indexPatterns`)}>
<FormattedMessage
id="xpack.maps.noIndexPattern.doThisLinkTextDescription"
defaultMessage="create an index pattern."
defaultMessage="Create an index pattern."
/>
</EuiLink>
</p>
Expand All @@ -119,10 +119,7 @@ export class GeoIndexPatternSelect extends Component<Props, State> {

render() {
const IndexPatternSelect = getIndexPatternSelectComponent();
const isIndexPatternInvalid =
this.props.value !== null &&
this.props.value !== '' &&
!this.state.doesIndexPatternHaveGeoField;
const isIndexPatternInvalid = this.props.value && !this.state.doesIndexPatternHaveGeoField;
const error = isIndexPatternInvalid
? i18n.translate('xpack.maps.noGeoFieldInIndexPattern.message', {
defaultMessage: 'Index pattern does not contain any geospatial fields',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export function SingleFieldSelect({
options={fieldsToOptions(fields, isFieldDisabled)}
selectedOptions={selectedOptions}
onChange={onSelection}
isDisabled={!fields}
isDisabled={!fields || fields.length === 0}
renderOption={renderOption}
{...rest}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class GeoIndexPatternSelect extends Component<Props, State> {
>
<FormattedMessage
id="xpack.stackAlerts.geoContainment.noIndexPattern.doThisLinkTextDescription"
defaultMessage="create an index pattern."
defaultMessage="Create an index pattern."
/>
</EuiLink>
</p>
Expand All @@ -120,10 +120,7 @@ export class GeoIndexPatternSelect extends Component<Props, State> {

render() {
const IndexPatternSelectComponent = this.props.IndexPatternSelectComponent;
const isIndexPatternInvalid =
this.props.value !== null &&
this.props.value !== '' &&
!this.state.doesIndexPatternHaveGeoField;
const isIndexPatternInvalid = this.props.value && !this.state.doesIndexPatternHaveGeoField;
const error = isIndexPatternInvalid
? i18n.translate('xpack.stackAlerts.geoContainment.noGeoFieldInIndexPattern.message', {
defaultMessage: 'Index pattern does not contain any geospatial fields',
Expand Down

0 comments on commit 6571d79

Please sign in to comment.