forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution] [Onboarding] AI connectors card privileges escena…
…rios (elastic#198014) ## Summary Issue elastic#197397 - Fix how AI connectors cards handle the lack of privileges for user. **Before:** When user has none privileges inside the AI connectors card an infinite spinner is rendered. ![379211667-8f565693-a9a6-43dc-9a88-d6b678f5692c](https://github.com/user-attachments/assets/d2d6330d-d464-413a-bf18-3737db8d573c) **Introduced by this PR:** ### **Case 1: User has all privileges** <img width="613" alt="Screenshot 2024-10-28 at 15 52 53" src="https://github.com/user-attachments/assets/bb5f7dd6-e025-4ba1-aeaa-4f2dbe1d5d77"> User capabilities: `actions.show`, `actions.save` & `actions.execute` **Case 1.1** - User does not have any connector <img width="3232" alt="Untitled (1)" src="https://github.com/user-attachments/assets/b1cfa090-5ff0-4b7b-a6f0-19f05438ad7a"> **Case 1.2** - User already has connectors <img width="3231" alt="Untitled" src="https://github.com/user-attachments/assets/aed0ea61-a043-475f-8cd4-8f9189a43d59"> ### **Case 2: User can read only** User capabilities: `actions.show` & `actions.execute` <img width="614" alt="Screenshot 2024-10-28 at 15 51 39" src="https://github.com/user-attachments/assets/2f4c31b1-157e-4927-bb16-c3d400ca5f5d"> **Case 2.1** - User does not have any connector <img width="3231" alt="Untitled (3)" src="https://github.com/user-attachments/assets/f64687f3-c74b-4d27-a978-7bea4448289d"> **Case 2.2** - User already has connectors <img width="3231" alt="Untitled (2)" src="https://github.com/user-attachments/assets/cc4df86e-f7dd-4957-883a-94e2135b9d19"> ### **Case 3: User can not read or save** <img width="610" alt="Screenshot 2024-10-28 at 15 52 16" src="https://github.com/user-attachments/assets/534cb671-3629-4413-9cbc-e33babf83b08"> <img width="3231" alt="Untitled (4)" src="https://github.com/user-attachments/assets/aafe7693-da40-47eb-847f-61045da15490"> ### Checklist Delete any items that are not applicable to this PR. - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Angela Chuang <[email protected]>
- Loading branch information
1 parent
5499b69
commit 99b9b5e
Showing
9 changed files
with
237 additions
and
80 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
41 changes: 41 additions & 0 deletions
41
...ding/components/onboarding_body/cards/assistant/connectors/missing_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,41 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import React from 'react'; | ||
import { EuiCode, EuiFlexGroup, EuiFlexItem, EuiToolTip } from '@elastic/eui'; | ||
import * as i18n from './translations'; | ||
|
||
interface MissingPrivilegesTooltip { | ||
children: React.ReactElement; // EuiToolTip requires a single ReactElement child | ||
} | ||
|
||
export const MissingPrivilegesTooltip = React.memo<MissingPrivilegesTooltip>(({ children }) => ( | ||
<EuiToolTip | ||
anchorProps={{ style: { width: 'fit-content' } }} | ||
title={i18n.PRIVILEGES_MISSING_TITLE} | ||
content={<MissingPrivilegesDescription />} | ||
> | ||
{children} | ||
</EuiToolTip> | ||
)); | ||
MissingPrivilegesTooltip.displayName = 'MissingPrivilegesTooltip'; | ||
|
||
export const MissingPrivilegesDescription = React.memo(() => { | ||
return ( | ||
<EuiFlexGroup gutterSize="m" direction="column" data-test-subj="missingPrivilegesGroup"> | ||
<EuiFlexItem>{i18n.PRIVILEGES_REQUIRED_TITLE}</EuiFlexItem> | ||
<EuiFlexItem> | ||
<EuiCode> | ||
<ul> | ||
<li>{i18n.REQUIRED_PRIVILEGES_CONNECTORS_ALL}</li> | ||
</ul> | ||
</EuiCode> | ||
</EuiFlexItem> | ||
<EuiFlexItem>{i18n.CONTACT_ADMINISTRATOR}</EuiFlexItem> | ||
</EuiFlexGroup> | ||
); | ||
}); | ||
MissingPrivilegesDescription.displayName = 'MissingPrivilegesDescription'; |
43 changes: 43 additions & 0 deletions
43
...n/public/onboarding/components/onboarding_body/cards/assistant/connectors/translations.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,43 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
|
||
export const ASSISTANT_CARD_CREATE_NEW_CONNECTOR_POPOVER = i18n.translate( | ||
'xpack.securitySolution.onboarding.assistantCard.createNewConnectorPopover', | ||
{ | ||
defaultMessage: 'Create new connector', | ||
} | ||
); | ||
|
||
export const PRIVILEGES_MISSING_TITLE = i18n.translate( | ||
'xpack.securitySolution.onboarding.assistantCard.missingPrivileges.title', | ||
{ | ||
defaultMessage: 'Missing privileges', | ||
} | ||
); | ||
|
||
export const PRIVILEGES_REQUIRED_TITLE = i18n.translate( | ||
'xpack.securitySolution.onboarding.assistantCard.requiredPrivileges', | ||
{ | ||
defaultMessage: 'The minimum Kibana privileges required to use this feature are:', | ||
} | ||
); | ||
|
||
export const REQUIRED_PRIVILEGES_CONNECTORS_ALL = i18n.translate( | ||
'xpack.securitySolution.onboarding.assistantCard.requiredPrivileges.connectorsAll', | ||
{ | ||
defaultMessage: 'Management > Connectors: All', | ||
} | ||
); | ||
|
||
export const CONTACT_ADMINISTRATOR = i18n.translate( | ||
'xpack.securitySolution.onboarding.assistantCard.missingPrivileges.contactAdministrator', | ||
{ | ||
defaultMessage: 'Contact your administrator for assistance.', | ||
} | ||
); |
Oops, something went wrong.