mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[8.x] [Cloud Security] Converts graph visualization from experimental feature to the advanced settings (#208614) (#208712)
# Backport This will backport the following commits from `main` to `8.x`: - [[Cloud Security] Converts graph visualization from experimental feature to the advanced settings (#208614)](https://github.com/elastic/kibana/pull/208614) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Kfir Peled","email":"61654899+kfirpeled@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-01-29T10:48:51Z","message":"[Cloud Security] Converts graph visualization from experimental feature to the advanced settings (#208614)\n\n## Summary\r\n\r\nDuring 8.17 development cycle, we introduced a new feature behind an\r\nexperimental flag.\r\nNow, in 8.18/9.0 a user could toggle the feature through the advanced\r\nsettings.\r\nThis will allow users on serverless to use this feature.\r\nThis change does not introduce a breaking change.\r\n\r\n\r\n\r\n### How to test \r\n\r\n1. Toggle the feature flags\r\n2. Load mock data\r\n\r\n```bash\r\nnode scripts/es_archiver load x-pack/test/cloud_security_posture_functional/es_archives/logs_gcp_audit \\ \r\n --es-url http://elastic:changeme@localhost:9200 \\\r\n --kibana-url http://elastic:changeme@localhost:5601\r\n\r\nnode scripts/es_archiver load x-pack/test/cloud_security_posture_functional/es_archives/security_alerts \\\r\n --es-url http://elastic:changeme@localhost:9200 \\\r\n --kibana-url http://elastic:changeme@localhost:5601\r\n```\r\n\r\n3. Go to the alerts page\r\n4. Change the query time range to show alerts from the 13th of October\r\n2024 (**IMPORTANT**)\r\n5. Open the alerts flyout\r\n6. Scroll to see the graph visualization : D\r\n\r\n\r\n### Checklist\r\n\r\n- [x] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"dbd06296cc4e2101a4a4e45d7ff54728ab8d815f","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Cloud Security","backport:prev-minor"],"title":"[Cloud Security] Converts graph visualization from experimental feature to the advanced settings","number":208614,"url":"https://github.com/elastic/kibana/pull/208614","mergeCommit":{"message":"[Cloud Security] Converts graph visualization from experimental feature to the advanced settings (#208614)\n\n## Summary\r\n\r\nDuring 8.17 development cycle, we introduced a new feature behind an\r\nexperimental flag.\r\nNow, in 8.18/9.0 a user could toggle the feature through the advanced\r\nsettings.\r\nThis will allow users on serverless to use this feature.\r\nThis change does not introduce a breaking change.\r\n\r\n\r\n\r\n### How to test \r\n\r\n1. Toggle the feature flags\r\n2. Load mock data\r\n\r\n```bash\r\nnode scripts/es_archiver load x-pack/test/cloud_security_posture_functional/es_archives/logs_gcp_audit \\ \r\n --es-url http://elastic:changeme@localhost:9200 \\\r\n --kibana-url http://elastic:changeme@localhost:5601\r\n\r\nnode scripts/es_archiver load x-pack/test/cloud_security_posture_functional/es_archives/security_alerts \\\r\n --es-url http://elastic:changeme@localhost:9200 \\\r\n --kibana-url http://elastic:changeme@localhost:5601\r\n```\r\n\r\n3. Go to the alerts page\r\n4. Change the query time range to show alerts from the 13th of October\r\n2024 (**IMPORTANT**)\r\n5. Open the alerts flyout\r\n6. Scroll to see the graph visualization : D\r\n\r\n\r\n### Checklist\r\n\r\n- [x] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"dbd06296cc4e2101a4a4e45d7ff54728ab8d815f"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/208614","number":208614,"mergeCommit":{"message":"[Cloud Security] Converts graph visualization from experimental feature to the advanced settings (#208614)\n\n## Summary\r\n\r\nDuring 8.17 development cycle, we introduced a new feature behind an\r\nexperimental flag.\r\nNow, in 8.18/9.0 a user could toggle the feature through the advanced\r\nsettings.\r\nThis will allow users on serverless to use this feature.\r\nThis change does not introduce a breaking change.\r\n\r\n\r\n\r\n### How to test \r\n\r\n1. Toggle the feature flags\r\n2. Load mock data\r\n\r\n```bash\r\nnode scripts/es_archiver load x-pack/test/cloud_security_posture_functional/es_archives/logs_gcp_audit \\ \r\n --es-url http://elastic:changeme@localhost:9200 \\\r\n --kibana-url http://elastic:changeme@localhost:5601\r\n\r\nnode scripts/es_archiver load x-pack/test/cloud_security_posture_functional/es_archives/security_alerts \\\r\n --es-url http://elastic:changeme@localhost:9200 \\\r\n --kibana-url http://elastic:changeme@localhost:5601\r\n```\r\n\r\n3. Go to the alerts page\r\n4. Change the query time range to show alerts from the 13th of October\r\n2024 (**IMPORTANT**)\r\n5. Open the alerts flyout\r\n6. Scroll to see the graph visualization : D\r\n\r\n\r\n### Checklist\r\n\r\n- [x] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"dbd06296cc4e2101a4a4e45d7ff54728ab8d815f"}}]}] BACKPORT--> Co-authored-by: Kfir Peled <61654899+kfirpeled@users.noreply.github.com>
This commit is contained in:
parent
96a4c33070
commit
010bbe34a7
17 changed files with 128 additions and 46 deletions
|
@ -185,6 +185,8 @@ export const SECURITY_SOLUTION_ENABLE_ASSET_CRITICALITY_SETTING =
|
|||
'securitySolution:enableAssetCriticality' as const;
|
||||
export const SECURITY_SOLUTION_ENABLE_VISUALIZATIONS_IN_FLYOUT_SETTING =
|
||||
'securitySolution:enableVisualizationsInFlyout' as const;
|
||||
export const SECURITY_SOLUTION_ENABLE_GRAPH_VISUALIZATION_SETTING =
|
||||
'securitySolution:enableGraphVisualization' as const;
|
||||
|
||||
// Timelion settings
|
||||
export const TIMELION_ES_DEFAULT_INDEX_ID = 'timelion:es.default_index';
|
||||
|
|
|
@ -24,4 +24,5 @@ export const SECURITY_PROJECT_SETTINGS = [
|
|||
settings.SECURITY_SOLUTION_ENABLE_NEWS_FEED_ID,
|
||||
settings.SECURITY_SOLUTION_DEFAULT_ALERT_TAGS_KEY,
|
||||
settings.SECURITY_SOLUTION_ENABLE_VISUALIZATIONS_IN_FLYOUT_SETTING,
|
||||
settings.SECURITY_SOLUTION_ENABLE_GRAPH_VISUALIZATION_SETTING,
|
||||
];
|
||||
|
|
|
@ -138,6 +138,10 @@ export const stackManagementSchema: MakeSchemaFrom<UsageStats> = {
|
|||
type: 'boolean',
|
||||
_meta: { description: 'Non-default value of setting.' },
|
||||
},
|
||||
'securitySolution:enableGraphVisualization': {
|
||||
type: 'boolean',
|
||||
_meta: { description: 'Non-default value of setting.' },
|
||||
},
|
||||
'search:includeFrozen': {
|
||||
type: 'boolean',
|
||||
_meta: { description: 'Non-default value of setting.' },
|
||||
|
|
|
@ -79,6 +79,7 @@ export interface UsageStats {
|
|||
'securitySolution:excludeColdAndFrozenTiersInAnalyzer': boolean;
|
||||
'securitySolution:enableCcsWarning': boolean;
|
||||
'securitySolution:enableVisualizationsInFlyout': boolean;
|
||||
'securitySolution:enableGraphVisualization': boolean;
|
||||
'search:includeFrozen': boolean;
|
||||
'courier:maxConcurrentShardRequests': number;
|
||||
'courier:setRequestPreference': string;
|
||||
|
|
|
@ -10630,6 +10630,12 @@
|
|||
"description": "Non-default value of setting."
|
||||
}
|
||||
},
|
||||
"securitySolution:enableGraphVisualization": {
|
||||
"type": "boolean",
|
||||
"_meta": {
|
||||
"description": "Non-default value of setting."
|
||||
}
|
||||
},
|
||||
"search:includeFrozen": {
|
||||
"type": "boolean",
|
||||
"_meta": {
|
||||
|
|
|
@ -11,6 +11,7 @@ import {
|
|||
} from '@kbn/cloud-security-posture-common/schema/graph/latest';
|
||||
import { transformError } from '@kbn/securitysolution-es-utils';
|
||||
import type { GraphRequest } from '@kbn/cloud-security-posture-common/types/graph/v1';
|
||||
import { SECURITY_SOLUTION_ENABLE_GRAPH_VISUALIZATION_SETTING } from '@kbn/management-settings-ids';
|
||||
import { GRAPH_ROUTE_PATH } from '../../../common/constants';
|
||||
import { CspRequestHandlerContext, CspRouter } from '../../types';
|
||||
import { getGraph as getGraphV1 } from './v1';
|
||||
|
@ -45,6 +46,15 @@ export const defineGraphRoute = (router: CspRouter) =>
|
|||
const { nodesLimit, showUnknownTarget = false } = request.body;
|
||||
const { originEventIds, start, end, esQuery } = request.body.query as GraphRequest['query'];
|
||||
const spaceId = (await cspContext.spaces?.spacesService?.getActiveSpace(request))?.id;
|
||||
const isGraphEnabled = await (
|
||||
await context.core
|
||||
).uiSettings.client.get(SECURITY_SOLUTION_ENABLE_GRAPH_VISUALIZATION_SETTING);
|
||||
|
||||
cspContext.logger.debug(`isGraphEnabled: ${isGraphEnabled}`);
|
||||
|
||||
if (!isGraphEnabled) {
|
||||
return response.notFound();
|
||||
}
|
||||
|
||||
try {
|
||||
const resp = await getGraphV1({
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
"@kbn/cloud-security-posture-common",
|
||||
"@kbn/cloud-security-posture",
|
||||
"@kbn/analytics",
|
||||
"@kbn/management-settings-ids",
|
||||
],
|
||||
"exclude": ["target/**/*"]
|
||||
}
|
||||
|
|
|
@ -211,6 +211,10 @@ export const MAX_UNASSOCIATED_NOTES = 'securitySolution:maxUnassociatedNotes' as
|
|||
export const ENABLE_VISUALIZATIONS_IN_FLYOUT_SETTING =
|
||||
'securitySolution:enableVisualizationsInFlyout' as const;
|
||||
|
||||
/** This Kibana Advanced Setting allows users to enable/disable the Graph Visualizations for alerts and events */
|
||||
export const ENABLE_GRAPH_VISUALIZATION_SETTING =
|
||||
'securitySolution:enableGraphVisualization' as const;
|
||||
|
||||
/**
|
||||
* Id for the notifications alerting type
|
||||
* @deprecated Once we are confident all rules relying on side-car actions SO's have been migrated to SO references we should remove this function
|
||||
|
|
|
@ -189,11 +189,6 @@ export const allowedExperimentalValues = Object.freeze({
|
|||
*/
|
||||
jamfDataInAnalyzerEnabled: true,
|
||||
|
||||
/**
|
||||
* Enables graph visualization in alerts flyout
|
||||
*/
|
||||
graphVisualizationInFlyoutEnabled: false,
|
||||
|
||||
/**
|
||||
* Enables an ability to customize Elastic prebuilt rules.
|
||||
*
|
||||
|
|
|
@ -11,7 +11,7 @@ import type { EuiButtonGroupOptionProps } from '@elastic/eui/src/components/butt
|
|||
import { useExpandableFlyoutApi, useExpandableFlyoutState } from '@kbn/expandable-flyout';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features';
|
||||
import { useUiSetting$ } from '@kbn/kibana-react-plugin/public';
|
||||
import { useDocumentDetailsContext } from '../../shared/context';
|
||||
import { useWhichFlyout } from '../../shared/hooks/use_which_flyout';
|
||||
import { DocumentDetailsAnalyzerPanelKey } from '../../shared/constants/panel_keys';
|
||||
|
@ -31,7 +31,7 @@ import { ALERTS_ACTIONS } from '../../../../common/lib/apm/user_actions';
|
|||
import { useStartTransaction } from '../../../../common/lib/apm/use_start_transaction';
|
||||
import { GRAPH_ID, GraphVisualization } from '../components/graph_visualization';
|
||||
import { useGraphPreview } from '../../shared/hooks/use_graph_preview';
|
||||
import { GRAPH_VISUALIZATION_IN_FLYOUT_ENABLED_EXPERIMENTAL_FEATURE } from '../../shared/constants/experimental_features';
|
||||
import { ENABLE_GRAPH_VISUALIZATION_SETTING } from '../../../../../common/constants';
|
||||
|
||||
const visualizeButtons: EuiButtonGroupOptionProps[] = [
|
||||
{
|
||||
|
@ -127,13 +127,11 @@ export const VisualizeTab = memo(() => {
|
|||
dataFormattedForFieldBrowser,
|
||||
});
|
||||
|
||||
const isGraphFeatureEnabled = useIsExperimentalFeatureEnabled(
|
||||
GRAPH_VISUALIZATION_IN_FLYOUT_ENABLED_EXPERIMENTAL_FEATURE
|
||||
);
|
||||
const [graphVisualizationEnabled] = useUiSetting$<boolean>(ENABLE_GRAPH_VISUALIZATION_SETTING);
|
||||
|
||||
const options = [...visualizeButtons];
|
||||
|
||||
if (hasGraphRepresentation && isGraphFeatureEnabled) {
|
||||
if (hasGraphRepresentation && graphVisualizationEnabled) {
|
||||
options.push(graphVisualizationButton);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,11 @@ import { useInvestigateInTimeline } from '../../../../detections/components/aler
|
|||
import { useIsInvestigateInResolverActionEnabled } from '../../../../detections/components/alerts_table/timeline_actions/investigate_in_resolver';
|
||||
import { useGraphPreview } from '../../shared/hooks/use_graph_preview';
|
||||
import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features';
|
||||
import { createUseUiSetting$Mock } from '../../../../common/lib/kibana/kibana_react.mock';
|
||||
import {
|
||||
ENABLE_GRAPH_VISUALIZATION_SETTING,
|
||||
ENABLE_VISUALIZATIONS_IN_FLYOUT_SETTING,
|
||||
} from '../../../../../common/constants';
|
||||
|
||||
jest.mock('../hooks/use_expand_section');
|
||||
jest.mock('../../shared/hooks/use_alert_prevalence_from_process_tree', () => ({
|
||||
|
@ -59,13 +64,14 @@ jest.mock('../../../../common/hooks/use_experimental_features', () => ({
|
|||
}));
|
||||
|
||||
const useIsExperimentalFeatureEnabledMock = useIsExperimentalFeatureEnabled as jest.Mock;
|
||||
useIsExperimentalFeatureEnabledMock.mockReturnValue(true);
|
||||
const mockUseUiSetting = jest.fn().mockImplementation((key) => [false]);
|
||||
|
||||
const mockUseUiSetting = jest.fn().mockReturnValue([false]);
|
||||
jest.mock('@kbn/kibana-react-plugin/public', () => {
|
||||
const original = jest.requireActual('@kbn/kibana-react-plugin/public');
|
||||
return {
|
||||
...original,
|
||||
useUiSetting$: () => mockUseUiSetting(),
|
||||
useUiSetting$: (...args: unknown[]) => mockUseUiSetting(...args),
|
||||
};
|
||||
});
|
||||
jest.mock('../../shared/hooks/use_graph_preview');
|
||||
|
@ -96,7 +102,7 @@ const renderVisualizationsSection = (contextValue = panelContextValue) =>
|
|||
|
||||
describe('<VisualizationsSection />', () => {
|
||||
beforeEach(() => {
|
||||
mockUseUiSetting.mockReturnValue([false]);
|
||||
mockUseUiSetting.mockImplementation(() => [false]);
|
||||
mockUseTimelineDataFilters.mockReturnValue({ selectedPatterns: ['index'] });
|
||||
mockUseAlertPrevalenceFromProcessTree.mockReturnValue({
|
||||
loading: false,
|
||||
|
@ -139,8 +145,17 @@ describe('<VisualizationsSection />', () => {
|
|||
});
|
||||
(useIsInvestigateInResolverActionEnabled as jest.Mock).mockReturnValue(true);
|
||||
(useExpandSection as jest.Mock).mockReturnValue(true);
|
||||
mockUseUiSetting.mockReturnValue([false]);
|
||||
useIsExperimentalFeatureEnabledMock.mockReturnValue(false);
|
||||
mockUseUiSetting.mockImplementation((key, defaultValue) => {
|
||||
const useUiSetting$Mock = createUseUiSetting$Mock();
|
||||
|
||||
if (key === ENABLE_GRAPH_VISUALIZATION_SETTING) {
|
||||
return [false, jest.fn()];
|
||||
} else if (key === ENABLE_VISUALIZATIONS_IN_FLYOUT_SETTING) {
|
||||
return [false, jest.fn()];
|
||||
}
|
||||
|
||||
return useUiSetting$Mock(key, defaultValue);
|
||||
});
|
||||
|
||||
const { getByTestId, queryByTestId } = renderVisualizationsSection();
|
||||
expect(getByTestId(VISUALIZATIONS_SECTION_CONTENT_TEST_ID)).toBeVisible();
|
||||
|
@ -152,18 +167,36 @@ describe('<VisualizationsSection />', () => {
|
|||
|
||||
it('should render the graph preview component if the feature is enabled', () => {
|
||||
(useExpandSection as jest.Mock).mockReturnValue(true);
|
||||
mockUseUiSetting.mockReturnValue([true]);
|
||||
useIsExperimentalFeatureEnabledMock.mockReturnValue(true);
|
||||
mockUseUiSetting.mockImplementation((key, defaultValue) => {
|
||||
const useUiSetting$Mock = createUseUiSetting$Mock();
|
||||
|
||||
if (key === ENABLE_GRAPH_VISUALIZATION_SETTING) {
|
||||
return [true, jest.fn()];
|
||||
} else if (key === ENABLE_VISUALIZATIONS_IN_FLYOUT_SETTING) {
|
||||
return [true, jest.fn()];
|
||||
}
|
||||
|
||||
return useUiSetting$Mock(key, defaultValue);
|
||||
});
|
||||
|
||||
const { getByTestId } = renderVisualizationsSection();
|
||||
|
||||
expect(getByTestId(`${GRAPH_PREVIEW_TEST_ID}LeftSection`)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should not render the graph preview component if the experimental feature is disabled', () => {
|
||||
it('should not render the graph preview component if the graph feature is disabled', () => {
|
||||
(useExpandSection as jest.Mock).mockReturnValue(true);
|
||||
mockUseUiSetting.mockReturnValue([true]);
|
||||
useIsExperimentalFeatureEnabledMock.mockReturnValue(false);
|
||||
mockUseUiSetting.mockImplementation((key, defaultValue) => {
|
||||
const useUiSetting$Mock = createUseUiSetting$Mock();
|
||||
|
||||
if (key === ENABLE_GRAPH_VISUALIZATION_SETTING) {
|
||||
return [false, jest.fn()];
|
||||
} else if (key === ENABLE_VISUALIZATIONS_IN_FLYOUT_SETTING) {
|
||||
return [true, jest.fn()];
|
||||
}
|
||||
|
||||
return useUiSetting$Mock(key, defaultValue);
|
||||
});
|
||||
|
||||
const { queryByTestId } = renderVisualizationsSection();
|
||||
|
||||
|
@ -172,8 +205,17 @@ describe('<VisualizationsSection />', () => {
|
|||
|
||||
it('should not render the graph preview component if the flyout feature is disabled', () => {
|
||||
(useExpandSection as jest.Mock).mockReturnValue(true);
|
||||
mockUseUiSetting.mockReturnValue([false]);
|
||||
useIsExperimentalFeatureEnabledMock.mockReturnValue(true);
|
||||
mockUseUiSetting.mockImplementation((key, defaultValue) => {
|
||||
const useUiSetting$Mock = createUseUiSetting$Mock();
|
||||
|
||||
if (key === ENABLE_GRAPH_VISUALIZATION_SETTING) {
|
||||
return [true, jest.fn()];
|
||||
} else if (key === ENABLE_VISUALIZATIONS_IN_FLYOUT_SETTING) {
|
||||
return [false, jest.fn()];
|
||||
}
|
||||
|
||||
return useUiSetting$Mock(key, defaultValue);
|
||||
});
|
||||
|
||||
const { queryByTestId } = renderVisualizationsSection();
|
||||
|
||||
|
|
|
@ -17,9 +17,10 @@ import { VISUALIZATIONS_TEST_ID } from './test_ids';
|
|||
import { GraphPreviewContainer } from './graph_preview_container';
|
||||
import { useDocumentDetailsContext } from '../../shared/context';
|
||||
import { useGraphPreview } from '../../shared/hooks/use_graph_preview';
|
||||
import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features';
|
||||
import { ENABLE_VISUALIZATIONS_IN_FLYOUT_SETTING } from '../../../../../common/constants';
|
||||
import { GRAPH_VISUALIZATION_IN_FLYOUT_ENABLED_EXPERIMENTAL_FEATURE } from '../../shared/constants/experimental_features';
|
||||
import {
|
||||
ENABLE_VISUALIZATIONS_IN_FLYOUT_SETTING,
|
||||
ENABLE_GRAPH_VISUALIZATION_SETTING,
|
||||
} from '../../../../../common/constants';
|
||||
|
||||
const KEY = 'visualizations';
|
||||
|
||||
|
@ -35,9 +36,7 @@ export const VisualizationsSection = memo(() => {
|
|||
ENABLE_VISUALIZATIONS_IN_FLYOUT_SETTING
|
||||
);
|
||||
|
||||
const isGraphFeatureEnabled = useIsExperimentalFeatureEnabled(
|
||||
GRAPH_VISUALIZATION_IN_FLYOUT_ENABLED_EXPERIMENTAL_FEATURE
|
||||
);
|
||||
const [graphVisualizationEnabled] = useUiSetting$<boolean>(ENABLE_GRAPH_VISUALIZATION_SETTING);
|
||||
|
||||
// Decide whether to show the graph preview or not
|
||||
const { hasGraphRepresentation } = useGraphPreview({
|
||||
|
@ -47,7 +46,7 @@ export const VisualizationsSection = memo(() => {
|
|||
});
|
||||
|
||||
const shouldShowGraphPreview =
|
||||
visualizationInFlyoutEnabled && isGraphFeatureEnabled && hasGraphRepresentation;
|
||||
visualizationInFlyoutEnabled && graphVisualizationEnabled && hasGraphRepresentation;
|
||||
|
||||
return (
|
||||
<ExpandableSection
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/** This security solution experimental feature allows user to enable/disable the graph visualization in Flyout feature (depends on securitySolution:enableVisualizationsInFlyout) */
|
||||
export const GRAPH_VISUALIZATION_IN_FLYOUT_ENABLED_EXPERIMENTAL_FEATURE =
|
||||
'graphVisualizationInFlyoutEnabled' as const;
|
|
@ -41,6 +41,7 @@ import {
|
|||
EXCLUDE_COLD_AND_FROZEN_TIERS_IN_ANALYZER,
|
||||
EXCLUDED_DATA_TIERS_FOR_RULE_EXECUTION,
|
||||
ENABLE_VISUALIZATIONS_IN_FLYOUT_SETTING,
|
||||
ENABLE_GRAPH_VISUALIZATION_SETTING,
|
||||
} from '../common/constants';
|
||||
import type { ExperimentalFeatures } from '../common/experimental_features';
|
||||
import { LogLevelSetting } from '../common/api/detection_engine/rule_monitoring';
|
||||
|
@ -64,6 +65,12 @@ export const initUiSettings = (
|
|||
experimentalFeatures: ExperimentalFeatures,
|
||||
validationsEnabled: boolean
|
||||
) => {
|
||||
const enableVisualizationsInFlyoutLabel = i18n.translate(
|
||||
'xpack.securitySolution.uiSettings.enableVisualizationsInFlyoutLabel',
|
||||
{
|
||||
defaultMessage: 'Enable visualizations in flyout',
|
||||
}
|
||||
);
|
||||
const securityUiSettings: Record<string, UiSettingsParams<unknown>> = {
|
||||
[DEFAULT_APP_REFRESH_INTERVAL]: {
|
||||
type: 'json',
|
||||
|
@ -201,9 +208,7 @@ export const initUiSettings = (
|
|||
schema: schema.boolean(),
|
||||
},
|
||||
[ENABLE_VISUALIZATIONS_IN_FLYOUT_SETTING]: {
|
||||
name: i18n.translate('xpack.securitySolution.uiSettings.enableVisualizationsInFlyoutLabel', {
|
||||
defaultMessage: 'Enable visualizations in flyout',
|
||||
}),
|
||||
name: enableVisualizationsInFlyoutLabel,
|
||||
value: false,
|
||||
description: i18n.translate(
|
||||
'xpack.securitySolution.uiSettings.enableVisualizationsInFlyoutDescription',
|
||||
|
@ -218,6 +223,28 @@ export const initUiSettings = (
|
|||
requiresPageReload: true,
|
||||
schema: schema.boolean(),
|
||||
},
|
||||
[ENABLE_GRAPH_VISUALIZATION_SETTING]: {
|
||||
name: i18n.translate('xpack.securitySolution.uiSettings.enableGraphVisualizationLabel', {
|
||||
defaultMessage: 'Enable graph visualization',
|
||||
}),
|
||||
description: i18n.translate(
|
||||
'xpack.securitySolution.uiSettings.enableGraphVisualizationDescription',
|
||||
{
|
||||
defaultMessage: `<em>[technical preview]</em> Enable the Graph Visualization feature within the Security Solution.
|
||||
<br/>Note: This feature requires the {visualizationFlyoutFeatureFlag} setting to be enabled.
|
||||
<br/>Please ensure both settings are enabled to use graph visualizations in flyout.`,
|
||||
values: {
|
||||
em: (chunks) => `<em>${chunks}</em>`,
|
||||
visualizationFlyoutFeatureFlag: `<code>${enableVisualizationsInFlyoutLabel}</code>`,
|
||||
},
|
||||
}
|
||||
),
|
||||
type: 'boolean',
|
||||
value: false,
|
||||
category: [APP_ID],
|
||||
requiresPageReload: true,
|
||||
schema: schema.boolean(),
|
||||
},
|
||||
[DEFAULT_RULES_TABLE_REFRESH_SETTING]: {
|
||||
name: i18n.translate('xpack.securitySolution.uiSettings.rulesTableRefresh', {
|
||||
defaultMessage: 'Rules auto refresh',
|
||||
|
|
|
@ -45,6 +45,8 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
|||
`--xpack.fleet.packages.0.name=cloud_security_posture`,
|
||||
`--xpack.fleet.packages.0.version=${CLOUD_SECURITY_PLUGIN_VERSION}`,
|
||||
// `--xpack.fleet.registryUrl=https://localhost:8080`,
|
||||
// Enables /internal/cloud_security_posture/graph API
|
||||
`--uiSettings.overrides.securitySolution:enableGraphVisualization=true`,
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
|
@ -44,9 +44,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
|||
* 2. merge the updated version number change to kibana
|
||||
*/
|
||||
`--uiSettings.overrides.securitySolution:enableVisualizationsInFlyout=true`,
|
||||
`--xpack.securitySolution.enableExperimental=${JSON.stringify([
|
||||
'graphVisualizationInFlyoutEnabled',
|
||||
])}`,
|
||||
`--uiSettings.overrides.securitySolution:enableGraphVisualization=true`,
|
||||
`--xpack.fleet.packages.0.name=cloud_security_posture`,
|
||||
`--xpack.fleet.packages.0.version=${CLOUD_SECURITY_PLUGIN_VERSION}`,
|
||||
// `--xpack.fleet.registryUrl=https://localhost:8080`,
|
||||
|
|
|
@ -33,5 +33,7 @@ export default createTestConfig({
|
|||
'--xpack.dataUsage.autoops.api.url=http://localhost:9000',
|
||||
`--xpack.dataUsage.autoops.api.tls.certificate=${KBN_CERT_PATH}`,
|
||||
`--xpack.dataUsage.autoops.api.tls.key=${KBN_KEY_PATH}`,
|
||||
// Enables /internal/cloud_security_posture/graph API
|
||||
`--uiSettings.overrides.securitySolution:enableGraphVisualization=true`,
|
||||
],
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue