Skip to content

Commit

Permalink
review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese committed Sep 18, 2020
1 parent 335122e commit 22ac2a1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ interface Props {
combinedFields: CombinedField[];
onCombinedFieldsChange(combinedFields: CombinedField[]): void;
results: FindFileStructureResponse;
isDisabled: boolean;
}

interface State {
Expand Down Expand Up @@ -188,28 +189,35 @@ export class CombinedFieldsForm extends Component<Props, State> {
<EuiFlexItem>
<CombinedFieldLabel combinedField={combinedField} />
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonIcon
iconType="trash"
color="danger"
onClick={this.removeCombinedField.bind(null, idx)}
title={i18n.translate('xpack.ml.fileDatavisualizer.removeCombinedFieldsLabel', {
defaultMessage: 'Remove combined field',
})}
aria-label={i18n.translate(
'xpack.ml.fileDatavisualizer.removeCombinedFieldsLabel',
{
{!this.props.isDisabled && (
<EuiFlexItem grow={false}>
<EuiButtonIcon
iconType="trash"
color="danger"
onClick={this.removeCombinedField.bind(null, idx)}
title={i18n.translate('xpack.ml.fileDatavisualizer.removeCombinedFieldsLabel', {
defaultMessage: 'Remove combined field',
}
)}
/>
</EuiFlexItem>
})}
aria-label={i18n.translate(
'xpack.ml.fileDatavisualizer.removeCombinedFieldsLabel',
{
defaultMessage: 'Remove combined field',
}
)}
/>
</EuiFlexItem>
)}
</EuiFlexGroup>
))}
<EuiPopover
id="combineFieldsPopover"
button={
<EuiButtonEmpty onClick={this.togglePopover} size="xs" iconType="plusInCircleFilled">
<EuiButtonEmpty
onClick={this.togglePopover}
size="xs"
iconType="plusInCircleFilled"
isDisabled={this.props.isDisabled}
>
<FormattedMessage
id="xpack.ml.fileDatavisualizer.addCombinedFieldsLabel"
defaultMessage="Add combined field"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { i18n } from '@kbn/i18n';
import _ from 'lodash';
import debounce from 'lodash/debounce';
import { FormattedMessage } from '@kbn/i18n/react';
import React, { ChangeEvent, Component, Fragment } from 'react';

Expand Down Expand Up @@ -86,7 +86,7 @@ export class GeoPointForm extends Component<Props, State> {
this.hasNameCollision(geoPointField);
};

hasNameCollision = _.debounce((name: string) => {
hasNameCollision = debounce((name: string) => {
try {
const geoPointFieldError = this.props.hasNameCollision(name) ? getNameCollisionMsg(name) : '';
this.setState({ geoPointFieldError });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export const AdvancedSettings: FC<Props> = ({
combinedFields={combinedFields}
onCombinedFieldsChange={onCombinedFieldsChange}
results={results}
isDisabled={initialized === true}
/>

<EuiFlexGroup>
Expand Down

0 comments on commit 22ac2a1

Please sign in to comment.