-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Backports the following commits to 7.9: - [Logs UI] Add missing ML capabilities checks (#72606)
- Loading branch information
1 parent
89c17fd
commit 2b69da0
Showing
20 changed files
with
175 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
...k/plugins/infra/public/components/logging/log_analysis_job_status/recreate_job_button.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
x-pack/plugins/infra/public/components/logging/log_analysis_setup/create_job_button.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { EuiButton, PropsOf } from '@elastic/eui'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import React from 'react'; | ||
import { MissingSetupPrivilegesToolTip } from './missing_setup_privileges_tooltip'; | ||
|
||
export const CreateJobButton: React.FunctionComponent< | ||
{ | ||
hasSetupCapabilities?: boolean; | ||
} & PropsOf<typeof EuiButton> | ||
> = ({ hasSetupCapabilities = true, children, ...buttonProps }) => { | ||
const button = ( | ||
<EuiButton isDisabled={!hasSetupCapabilities} {...buttonProps}> | ||
{children ?? ( | ||
<FormattedMessage | ||
id="xpack.infra.logs.analysis.createJobButtonLabel" | ||
defaultMessage="Create ML jobs" | ||
/> | ||
)} | ||
</EuiButton> | ||
); | ||
|
||
return hasSetupCapabilities ? ( | ||
button | ||
) : ( | ||
<MissingSetupPrivilegesToolTip position="bottom" delay="regular"> | ||
{button} | ||
</MissingSetupPrivilegesToolTip> | ||
); | ||
}; | ||
|
||
export const RecreateJobButton: React.FunctionComponent<PropsOf<typeof CreateJobButton>> = ({ | ||
children, | ||
...otherProps | ||
}) => ( | ||
<CreateJobButton {...otherProps}> | ||
{children ?? ( | ||
<FormattedMessage | ||
id="xpack.infra.logs.analysis.recreateJobButtonLabel" | ||
defaultMessage="Recreate ML job" | ||
/> | ||
)} | ||
</CreateJobButton> | ||
); |
30 changes: 30 additions & 0 deletions
30
...plugins/infra/public/components/logging/log_analysis_setup/missing_privileges_messages.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
|
||
export const missingMlPrivilegesTitle = i18n.translate( | ||
'xpack.infra.logs.analysis.missingMlPrivilegesTitle', | ||
{ | ||
defaultMessage: 'Additional Machine Learning privileges required', | ||
} | ||
); | ||
|
||
export const missingMlResultsPrivilegesDescription = i18n.translate( | ||
'xpack.infra.logs.analysis.missingMlResultsPrivilegesDescription', | ||
{ | ||
defaultMessage: | ||
'This feature makes use of Machine Learning jobs, which require at least the read permission for the Machine Learning app in order to access their status and results.', | ||
} | ||
); | ||
|
||
export const missingMlSetupPrivilegesDescription = i18n.translate( | ||
'xpack.infra.logs.analysis.missingMlSetupPrivilegesDescription', | ||
{ | ||
defaultMessage: | ||
'This feature makes use of Machine Learning jobs, which require all permissions for the Machine Learning app in order to be set up.', | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...s/infra/public/components/logging/log_analysis_setup/missing_setup_privileges_tooltip.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { EuiToolTip, PropsOf } from '@elastic/eui'; | ||
import React from 'react'; | ||
import { | ||
missingMlPrivilegesTitle, | ||
missingMlSetupPrivilegesDescription, | ||
} from './missing_privileges_messages'; | ||
|
||
export const MissingSetupPrivilegesToolTip: React.FC<Omit< | ||
PropsOf<EuiToolTip>, | ||
'content' | 'title' | ||
>> = (props) => ( | ||
<EuiToolTip | ||
{...props} | ||
content={missingMlSetupPrivilegesDescription} | ||
title={missingMlPrivilegesTitle} | ||
/> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.