Skip to content

Commit

Permalink
[8.12] [SecuritySolution] Disable Panel Settings for visualization co…
Browse files Browse the repository at this point in the history
…ntext menu (#174183) (#174233)

# Backport

This will backport the following commits from `main` to `8.12`:
- [[SecuritySolution] Disable Panel Settings for visualization context
menu (#174183)](#174183)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Angela
Chuang","email":"6295984+angorayc@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-01-04T08:35:05Z","message":"[SecuritySolution]
Disable Panel Settings for visualization context menu (#174183)\n\n##
Summary\r\n\r\n`Panel Settings` action is not compatible with Security
Solution\r\n([bug](#168670)),
removing them\r\nin this PR.\r\n\r\nSteps to verify:\r\n1. Visit network
/ hosts / users / rules / alerts page\r\n2. Find a visualization
rendered with Lens Embeddable\r\n3. Click on `...`, and find `Panel
settings` should not exist\r\n\r\n![Screenshot 2024-01-03 at 22
41\r\n51](https://github.com/elastic/kibana/assets/6295984/f97866a4-0d97-42f5-94d1-46e1b4f3395e)\r\n\r\n\r\n\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","sha":"e2906aee878b25494acbd02f950fe8d4e4abbc9b","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Threat
Hunting","Team: SecuritySolution","Team:Threat
Hunting:Explore","Feature:Lens
Charts","v8.12.1","v8.13.0"],"title":"[SecuritySolution] Disable Panel
Settings for visualization context
menu","number":174183,"url":"https://github.com/elastic/kibana/pull/174183","mergeCommit":{"message":"[SecuritySolution]
Disable Panel Settings for visualization context menu (#174183)\n\n##
Summary\r\n\r\n`Panel Settings` action is not compatible with Security
Solution\r\n([bug](#168670)),
removing them\r\nin this PR.\r\n\r\nSteps to verify:\r\n1. Visit network
/ hosts / users / rules / alerts page\r\n2. Find a visualization
rendered with Lens Embeddable\r\n3. Click on `...`, and find `Panel
settings` should not exist\r\n\r\n![Screenshot 2024-01-03 at 22
41\r\n51](https://github.com/elastic/kibana/assets/6295984/f97866a4-0d97-42f5-94d1-46e1b4f3395e)\r\n\r\n\r\n\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","sha":"e2906aee878b25494acbd02f950fe8d4e4abbc9b"}},"sourceBranch":"main","suggestedTargetBranches":["8.12"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","branchLabelMappingKey":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/174183","number":174183,"mergeCommit":{"message":"[SecuritySolution]
Disable Panel Settings for visualization context menu (#174183)\n\n##
Summary\r\n\r\n`Panel Settings` action is not compatible with Security
Solution\r\n([bug](#168670)),
removing them\r\nin this PR.\r\n\r\nSteps to verify:\r\n1. Visit network
/ hosts / users / rules / alerts page\r\n2. Find a visualization
rendered with Lens Embeddable\r\n3. Click on `...`, and find `Panel
settings` should not exist\r\n\r\n![Screenshot 2024-01-03 at 22
41\r\n51](https://github.com/elastic/kibana/assets/6295984/f97866a4-0d97-42f5-94d1-46e1b4f3395e)\r\n\r\n\r\n\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","sha":"e2906aee878b25494acbd02f950fe8d4e4abbc9b"}}]}]
BACKPORT-->

Co-authored-by: Angela Chuang <6295984+angorayc@users.noreply.github.com>
  • Loading branch information
kibanamachine and angorayc authored Jan 4, 2024
1 parent df69c47 commit 8d90baa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { kpiHostMetricLensAttributes } from './lens_attributes/hosts/kpi_host_me
import { LensEmbeddable } from './lens_embeddable';
import { useKibana } from '../../lib/kibana';
import { useActions } from './use_actions';
import { ACTION_CUSTOMIZE_PANEL } from '@kbn/embeddable-plugin/public';

const mockActions = [
{ id: 'inspect' },
Expand Down Expand Up @@ -128,4 +129,10 @@ describe('LensEmbeddable', () => {
expect(mockEmbeddableComponent.mock.calls[0][0].syncTooltips).toEqual(false);
expect(mockEmbeddableComponent.mock.calls[0][0].syncCursor).toEqual(false);
});

it('should not render Panel settings action', () => {
expect(
mockEmbeddableComponent.mock.calls[0][0].disabledActions.includes(ACTION_CUSTOMIZE_PANEL)
).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React, { useCallback, useMemo, useState } from 'react';
import { useDispatch } from 'react-redux';

import { FormattedMessage } from '@kbn/i18n-react';
import { ViewMode } from '@kbn/embeddable-plugin/public';
import { ACTION_CUSTOMIZE_PANEL, ViewMode } from '@kbn/embeddable-plugin/public';
import styled from 'styled-components';
import { EuiEmptyPrompt, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui';
import type { RangeFilterParams } from '@kbn/es-query';
Expand All @@ -29,6 +29,7 @@ import { SourcererScopeName } from '../../store/sourcerer/model';
import { VisualizationActions } from './actions';

const HOVER_ACTIONS_PADDING = 24;
const DISABLED_ACTIONS = [ACTION_CUSTOMIZE_PANEL];

const LensComponentWrapper = styled.div<{
$height?: number;
Expand Down Expand Up @@ -278,6 +279,7 @@ const LensEmbeddableComponent: React.FC<LensEmbeddableComponentProps> = ({
style={style}
timeRange={timerange}
attributes={attributes}
disabledActions={DISABLED_ACTIONS}
onLoad={onLoadCallback}
onBrushEnd={updateDateRange}
onFilter={onFilterCallback}
Expand Down

0 comments on commit 8d90baa

Please sign in to comment.