mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
# Backport This will backport the following commits from `main` to `9.0`: - [[EDR Workflows]Automatic troubleshooting usage callout (#224030)](https://github.com/elastic/kibana/pull/224030) <!--- Backport version: 10.0.1 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Konrad Szwarc","email":"konrad.szwarc@elastic.co"},"sourceCommit":{"committedDate":"2025-06-17T08:48:15Z","message":"[EDR Workflows]Automatic troubleshooting usage callout (#224030)\n\nTracks https://github.com/elastic/kibana/pull/221566\nCloses https://github.com/elastic/security-team/issues/12824\n\nWith this change, whenever a user selects the Elastic LLM connector\nwithin the Automatic Troubleshooting feature, they'll see a callout\ninforming them about the potential costs of using it. Once the callout\nis acknowledged, it will be dismissed and the closed state will be\nstored in local storage, so it won’t appear again on future visits.\n\nTo enable EIS locally:\n```\nexport VAULT_ADDR=https://secrets.elastic.co:8200/\nvault login --method=oidc\nnode scripts/eis.js\n```\nand run ES server with provided env + start kibana with .dev.yaml entry\nfrom the output of the command above.\n\n\nhttps://github.com/user-attachments/assets/51a2ce77-ed25-4611-9d62-72e9d09bb789\n\n---------\n\nCo-authored-by: Angela Chuang <yi-chun.chuang@elastic.co>\nCo-authored-by: Angela Chuang <6295984+angorayc@users.noreply.github.com>\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: florent-leborgne <florent.leborgne@elastic.co>\nCo-authored-by: Viduni Wickramarachchi <viduni.ushanka@gmail.com>","sha":"dfe6f541c163235677a6a27498c3cd85594c174f","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Defend Workflows","backport:version","v9.1.0"],"title":"[EDR Workflows]Automatic troubleshooting usage callout","number":224030,"url":"https://github.com/elastic/kibana/pull/224030","mergeCommit":{"message":"[EDR Workflows]Automatic troubleshooting usage callout (#224030)\n\nTracks https://github.com/elastic/kibana/pull/221566\nCloses https://github.com/elastic/security-team/issues/12824\n\nWith this change, whenever a user selects the Elastic LLM connector\nwithin the Automatic Troubleshooting feature, they'll see a callout\ninforming them about the potential costs of using it. Once the callout\nis acknowledged, it will be dismissed and the closed state will be\nstored in local storage, so it won’t appear again on future visits.\n\nTo enable EIS locally:\n```\nexport VAULT_ADDR=https://secrets.elastic.co:8200/\nvault login --method=oidc\nnode scripts/eis.js\n```\nand run ES server with provided env + start kibana with .dev.yaml entry\nfrom the output of the command above.\n\n\nhttps://github.com/user-attachments/assets/51a2ce77-ed25-4611-9d62-72e9d09bb789\n\n---------\n\nCo-authored-by: Angela Chuang <yi-chun.chuang@elastic.co>\nCo-authored-by: Angela Chuang <6295984+angorayc@users.noreply.github.com>\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: florent-leborgne <florent.leborgne@elastic.co>\nCo-authored-by: Viduni Wickramarachchi <viduni.ushanka@gmail.com>","sha":"dfe6f541c163235677a6a27498c3cd85594c174f"}},"sourceBranch":"main","suggestedTargetBranches":["9.0"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/224030","number":224030,"mergeCommit":{"message":"[EDR Workflows]Automatic troubleshooting usage callout (#224030)\n\nTracks https://github.com/elastic/kibana/pull/221566\nCloses https://github.com/elastic/security-team/issues/12824\n\nWith this change, whenever a user selects the Elastic LLM connector\nwithin the Automatic Troubleshooting feature, they'll see a callout\ninforming them about the potential costs of using it. Once the callout\nis acknowledged, it will be dismissed and the closed state will be\nstored in local storage, so it won’t appear again on future visits.\n\nTo enable EIS locally:\n```\nexport VAULT_ADDR=https://secrets.elastic.co:8200/\nvault login --method=oidc\nnode scripts/eis.js\n```\nand run ES server with provided env + start kibana with .dev.yaml entry\nfrom the output of the command above.\n\n\nhttps://github.com/user-attachments/assets/51a2ce77-ed25-4611-9d62-72e9d09bb789\n\n---------\n\nCo-authored-by: Angela Chuang <yi-chun.chuang@elastic.co>\nCo-authored-by: Angela Chuang <6295984+angorayc@users.noreply.github.com>\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: florent-leborgne <florent.leborgne@elastic.co>\nCo-authored-by: Viduni Wickramarachchi <viduni.ushanka@gmail.com>","sha":"dfe6f541c163235677a6a27498c3cd85594c174f"}}]}] BACKPORT--> Co-authored-by: Angela Chuang <yi-chun.chuang@elastic.co> Co-authored-by: Angela Chuang <6295984+angorayc@users.noreply.github.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: florent-leborgne <florent.leborgne@elastic.co> Co-authored-by: Viduni Wickramarachchi <viduni.ushanka@gmail.com>
This commit is contained in:
parent
bac57fa68f
commit
58e519350f
3 changed files with 37 additions and 7 deletions
|
@ -52,6 +52,13 @@ const testFeatures = [
|
|||
NEW_FEATURES_TOUR_STORAGE_KEYS.CONVERSATION_CONNECTOR_ELASTIC_LLM
|
||||
],
|
||||
},
|
||||
{
|
||||
featureKey: NEW_FEATURES_TOUR_STORAGE_KEYS.ELASTIC_LLM_USAGE_AUTOMATIC_TROUBLESHOOTING,
|
||||
expectedStorageKey:
|
||||
NEW_TOUR_FEATURES_TOUR_STORAGE_KEYS[
|
||||
NEW_FEATURES_TOUR_STORAGE_KEYS.ELASTIC_LLM_USAGE_AUTOMATIC_TROUBLESHOOTING
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
describe('useTourStorageKey', () => {
|
||||
|
|
|
@ -11,6 +11,7 @@ export enum NEW_FEATURES_TOUR_STORAGE_KEYS {
|
|||
ELASTIC_LLM_USAGE_ATTACK_DISCOVERY = 'ELASTIC_LLM_USAGE_ATTACK_DISCOVERY',
|
||||
ELASTIC_LLM_USAGE_ATTACK_DISCOVERY_FLYOUT = 'ELASTIC_LLM_USAGE_ATTACK_DISCOVERY_FLYOUT',
|
||||
ELASTIC_LLM_USAGE_ASSISTANT_HEADER = 'ELASTIC_LLM_USAGE_ASSISTANT_HEADER',
|
||||
ELASTIC_LLM_USAGE_AUTOMATIC_TROUBLESHOOTING = 'ELASTIC_LLM_USAGE_AUTOMATIC_TROUBLESHOOTING',
|
||||
CONVERSATION_CONNECTOR_ELASTIC_LLM = 'CONVERSATION_CONNECTOR_ELASTIC_LLM',
|
||||
}
|
||||
|
||||
|
@ -26,4 +27,6 @@ export const NEW_TOUR_FEATURES_TOUR_STORAGE_KEYS: Record<NEW_FEATURES_TOUR_STORA
|
|||
'elasticAssistant.elasticLLM.costAwarenessTour.assistantHeader.v8.19',
|
||||
CONVERSATION_CONNECTOR_ELASTIC_LLM:
|
||||
'elasticAssistant.elasticLLM.conversation.costAwarenessTour.v8.19',
|
||||
ELASTIC_LLM_USAGE_AUTOMATIC_TROUBLESHOOTING:
|
||||
'elasticAssistant.elasticLLM.costAwarenessTour.automaticTroubleshooting.v9.0',
|
||||
};
|
||||
|
|
|
@ -12,11 +12,15 @@ import {
|
|||
ConnectorSelectorInline,
|
||||
DEFAULT_ASSISTANT_NAMESPACE,
|
||||
useLoadConnectors,
|
||||
useAssistantContext,
|
||||
AssistantSpaceIdProvider,
|
||||
} from '@kbn/elastic-assistant';
|
||||
import { noop } from 'lodash/fp';
|
||||
import useLocalStorage from 'react-use/lib/useLocalStorage';
|
||||
import { some } from 'lodash';
|
||||
import { AssistantIcon } from '@kbn/ai-assistant-icon';
|
||||
import { ElasticLLMCostAwarenessTour } from '@kbn/elastic-assistant/impl/tour/elastic_llm';
|
||||
import { NEW_FEATURES_TOUR_STORAGE_KEYS } from '@kbn/elastic-assistant/impl/tour/const';
|
||||
import { useUserPrivileges } from '../../../../../../../common/components/user_privileges';
|
||||
import { useSpaceId } from '../../../../../../../common/hooks/use_space_id';
|
||||
import { WORKFLOW_INSIGHTS } from '../../../translations';
|
||||
|
@ -39,17 +43,20 @@ export const WorkflowInsightsScanSection = ({
|
|||
}: WorkflowInsightsScanSectionProps) => {
|
||||
const CONNECTOR_ID_LOCAL_STORAGE_KEY = 'connectorId';
|
||||
|
||||
const spaceId = useSpaceId() ?? 'default';
|
||||
const spaceId = useSpaceId();
|
||||
const { http } = useKibana().services;
|
||||
const { data: aiConnectors } = useLoadConnectors({
|
||||
http,
|
||||
});
|
||||
const { canWriteWorkflowInsights } = useUserPrivileges().endpointPrivileges;
|
||||
const { inferenceEnabled } = useAssistantContext();
|
||||
|
||||
// Store the selected connector id in local storage so that it persists across page reloads
|
||||
const [localStorageWorkflowInsightsConnectorId, setLocalStorageWorkflowInsightsConnectorId] =
|
||||
useLocalStorage<string>(
|
||||
`${DEFAULT_ASSISTANT_NAMESPACE}.${DEFEND_INSIGHTS_STORAGE_KEY}.${spaceId}.${CONNECTOR_ID_LOCAL_STORAGE_KEY}`
|
||||
`${DEFAULT_ASSISTANT_NAMESPACE}.${DEFEND_INSIGHTS_STORAGE_KEY}.${
|
||||
spaceId || 'default'
|
||||
}.${CONNECTOR_ID_LOCAL_STORAGE_KEY}`
|
||||
);
|
||||
|
||||
const [connectorId, setConnectorId] = React.useState<string | undefined>(
|
||||
|
@ -133,11 +140,24 @@ export const WorkflowInsightsScanSection = ({
|
|||
<EuiFlexItem grow={false}>
|
||||
<EuiFlexGroup alignItems="center" gutterSize="s">
|
||||
<EuiFlexItem grow={false}>
|
||||
<ConnectorSelectorInline
|
||||
onConnectorSelected={noop}
|
||||
onConnectorIdSelected={onConnectorIdSelected}
|
||||
selectedConnectorId={connectorId}
|
||||
/>
|
||||
{spaceId && (
|
||||
<AssistantSpaceIdProvider spaceId={spaceId}>
|
||||
<ElasticLLMCostAwarenessTour
|
||||
isDisabled={!inferenceEnabled}
|
||||
selectedConnectorId={connectorId}
|
||||
zIndex={1000}
|
||||
storageKey={
|
||||
NEW_FEATURES_TOUR_STORAGE_KEYS.ELASTIC_LLM_USAGE_AUTOMATIC_TROUBLESHOOTING
|
||||
}
|
||||
>
|
||||
<ConnectorSelectorInline
|
||||
onConnectorSelected={noop}
|
||||
onConnectorIdSelected={onConnectorIdSelected}
|
||||
selectedConnectorId={connectorId}
|
||||
/>
|
||||
</ElasticLLMCostAwarenessTour>
|
||||
</AssistantSpaceIdProvider>
|
||||
)}
|
||||
</EuiFlexItem>
|
||||
{scanButton}
|
||||
</EuiFlexGroup>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue