[CTI] removes inspect button (#105988)

* [CTI] removes inspect button
This commit is contained in:
Ece Özalp 2021-07-16 19:06:13 -04:00 committed by GitHub
parent 54b5fd275b
commit 5b68c54568
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 2 deletions

View file

@ -41,7 +41,12 @@ export const CtiDisabledModuleComponent = () => {
);
return (
<ThreatIntelPanelView totalEventCount={0} splitPanel={danger} listItems={EMPTY_LIST_ITEMS} />
<ThreatIntelPanelView
totalEventCount={0}
splitPanel={danger}
listItems={EMPTY_LIST_ITEMS}
isInspectEnabled={false}
/>
);
};

View file

@ -144,4 +144,32 @@ describe('ThreatIntelPanelView', () => {
`Showing: ${mockThreatIntelPanelViewProps.totalEventCount} indicators`
);
});
it('renders inspect button by default', () => {
const wrapper = mount(
<Provider store={store}>
<I18nProvider>
<ThemeProvider theme={mockTheme}>
<ThreatIntelPanelView {...mockThreatIntelPanelViewProps} />
</ThemeProvider>
</I18nProvider>
</Provider>
);
expect(wrapper.exists('[data-test-subj="inspect-icon-button"]')).toBe(true);
});
it('does not render inspect button if isInspectEnabled is false', () => {
const wrapper = mount(
<Provider store={store}>
<I18nProvider>
<ThemeProvider theme={mockTheme}>
<ThreatIntelPanelView {...mockThreatIntelPanelViewProps} isInspectEnabled={false} />
</ThemeProvider>
</I18nProvider>
</Provider>
);
expect(wrapper.exists('[data-test-subj="inspect-icon-button"]')).toBe(false);
});
});

View file

@ -55,6 +55,7 @@ const RightSideLink = styled(EuiLink)`
interface ThreatIntelPanelViewProps {
buttonHref?: string;
isDashboardPluginDisabled?: boolean;
isInspectEnabled?: boolean;
listItems: CtiListItem[];
splitPanel?: JSX.Element;
totalEventCount: number;
@ -77,6 +78,7 @@ const panelTitle = (
export const ThreatIntelPanelView: React.FC<ThreatIntelPanelViewProps> = ({
buttonHref = '',
isDashboardPluginDisabled,
isInspectEnabled = true,
listItems,
splitPanel,
totalEventCount,
@ -142,7 +144,11 @@ export const ThreatIntelPanelView: React.FC<ThreatIntelPanelViewProps> = ({
<EuiFlexItem grow={1}>
<InspectButtonContainer>
<EuiPanel hasBorder>
<HeaderSection id={CTIEventCountQueryId} subtitle={subtitle} title={panelTitle}>
<HeaderSection
id={isInspectEnabled ? CTIEventCountQueryId : undefined}
subtitle={subtitle}
title={panelTitle}
>
<>{button}</>
</HeaderSection>
{splitPanel}