Skip to content

Commit

Permalink
add disabled actions
Browse files Browse the repository at this point in the history
  • Loading branch information
angorayc committed Jan 3, 2024
1 parent 2cddc60 commit 02a51e5
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 02a51e5

Please sign in to comment.