-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Logs UI] Add missing ML capabilities checks #72606
Merged
weltenwort
merged 9 commits into
elastic:master
from
weltenwort:logs-ui-add-flyout-ml-permissions-check
Jul 22, 2020
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
07b082d
Disable setup buttons when lacking capabilities
weltenwort 4f3c6f2
Remove mention of deprecated roles from message
weltenwort 18910de
Fix link to user management page
weltenwort 4ec24e5
factor out missing privileges messages for re-use
weltenwort 80ee0b7
Add tooltip to disabled setup buttons
weltenwort 74f9249
Update missing read permission labels
weltenwort 964f54f
Factor out capability-guarded job creation button
weltenwort 50a39b6
Merge branch 'master' into logs-ui-add-flyout-ml-permissions-check
weltenwort a417a7a
Combine identical title translation strings
weltenwort File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the default text here should it be job instead of jobs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say, it depends on whether we want to abstract away the fact that this module happens to only contain one job. 🤷