Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Disable data frame anaylics clone button based on permission #64830

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
} from '../../hooks/use_create_analytics_form';
import { State } from '../../hooks/use_create_analytics_form/state';
import { DataFrameAnalyticsListRow } from './common';
import { checkPermission } from '../../../../../capabilities/check_capabilities';

interface PropDefinition {
/**
Expand Down Expand Up @@ -322,6 +323,8 @@ interface CloneActionProps {
* to support EuiContext with a valid DOM structure without nested buttons.
*/
export const CloneAction: FC<CloneActionProps> = ({ createAnalyticsForm, item }) => {
const canCreateDataFrameAnalytics: boolean = checkPermission('canCreateDataFrameAnalytics');

const buttonText = i18n.translate('xpack.ml.dataframe.analyticsList.cloneJobButtonLabel', {
defaultMessage: 'Clone job',
});
Expand All @@ -338,6 +341,7 @@ export const CloneAction: FC<CloneActionProps> = ({ createAnalyticsForm, item })
iconType="copy"
onClick={onClick}
aria-label={buttonText}
disabled={canCreateDataFrameAnalytics === false}
>
{buttonText}
</EuiButtonEmpty>
Expand Down