Skip to content

Commit

Permalink
[ML] Fix transform edit button setup.
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed Jul 7, 2020
1 parent 1c42f67 commit 5de8ec3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@ import { i18n } from '@kbn/i18n';

import { EuiIcon, EuiLink, EuiToolTip } from '@elastic/eui';

import { TransformPivotConfig } from '../../../../common';
import {
createCapabilityFailureMessage,
AuthorizationContext,
} from '../../../../lib/authorization';

interface EditButtonProps {
config: TransformPivotConfig;
onClick: (config: TransformPivotConfig) => void;
onClick: () => void;
}
export const EditButton: FC<EditButtonProps> = ({ config, onClick }) => {
export const EditButton: FC<EditButtonProps> = ({ onClick }) => {
const { canCreateTransform } = useContext(AuthorizationContext).capabilities;

const buttonEditText = i18n.translate('xpack.transform.transformList.editActionName', {
Expand All @@ -32,7 +30,7 @@ export const EditButton: FC<EditButtonProps> = ({ config, onClick }) => {
data-test-subj="transformActionEdit"
color={!canCreateTransform ? 'subdued' : 'text'}
disabled={!canCreateTransform}
onClick={!canCreateTransform ? undefined : () => onClick(config)}
onClick={!canCreateTransform ? undefined : onClick}
aria-label={buttonEditText}
>
<EuiIcon type="pencil" /> {buttonEditText}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const useActions = ({
},
{
render: (item: TransformListRow) => {
return <EditButton config={item.config} onClick={editAction.showFlyout} />;
return <EditButton onClick={() => editAction.showFlyout(item.config)} />;
},
},
{
Expand Down

0 comments on commit 5de8ec3

Please sign in to comment.