mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Cloud Security] Remove Add integration
button from agent policy details page when the agent policy supports_agentless
(#202211)
This commit is contained in:
parent
94f4f66917
commit
3520e696f4
2 changed files with 80 additions and 39 deletions
40
x-pack/plugins/fleet/cypress/e2e/agents/agentless.cy.ts
Normal file
40
x-pack/plugins/fleet/cypress/e2e/agents/agentless.cy.ts
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import { ADD_PACKAGE_POLICY_BTN } from '../../screens/fleet';
|
||||
import { login } from '../../tasks/login';
|
||||
|
||||
describe('View agentless policy details', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
cy.intercept('/api/fleet/agent_policies/policy-1', {
|
||||
item: {
|
||||
id: 'policy-1',
|
||||
name: 'Agentless policy for cspm-1',
|
||||
description: '',
|
||||
namespace: 'default',
|
||||
monitoring_enabled: ['logs', 'metrics'],
|
||||
status: 'active',
|
||||
supports_agentless: true,
|
||||
package_policies: [
|
||||
{
|
||||
id: 'cspm-1',
|
||||
name: 'cspm-1',
|
||||
policy_id: 'policy-1',
|
||||
policy_ids: ['policy-1'],
|
||||
inputs: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('should not show the add integration button if the policy support agentless', () => {
|
||||
cy.visit('/app/fleet/policies/policy-1');
|
||||
cy.getBySel(ADD_PACKAGE_POLICY_BTN).should('not.exist');
|
||||
});
|
||||
});
|
|
@ -400,45 +400,46 @@ export const PackagePoliciesTable: React.FunctionComponent<Props> = ({
|
|||
}}
|
||||
{...rest}
|
||||
search={{
|
||||
toolsRight: agentPolicy.is_managed
|
||||
? []
|
||||
: [
|
||||
<EuiButtonWithTooltip
|
||||
key="addPackagePolicyButton"
|
||||
fill
|
||||
isDisabled={!canWriteIntegrationPolicies}
|
||||
iconType="plusInCircle"
|
||||
onClick={() => {
|
||||
application.navigateToApp(INTEGRATIONS_PLUGIN_ID, {
|
||||
path: pagePathGetters.integrations_all({})[1],
|
||||
state: { forAgentPolicyId: agentPolicy.id },
|
||||
});
|
||||
}}
|
||||
data-test-subj="addPackagePolicyButton"
|
||||
tooltip={
|
||||
!canWriteIntegrationPolicies
|
||||
? {
|
||||
content: missingSecurityConfiguration ? (
|
||||
<FormattedMessage
|
||||
id="xpack.fleet.epm.addPackagePolicyButtonSecurityRequiredTooltip"
|
||||
defaultMessage="To add Elastic Agent Integrations, you must have security enabled and have the All privilege for Fleet. Contact your administrator."
|
||||
/>
|
||||
) : (
|
||||
<FormattedMessage
|
||||
id="xpack.fleet.epm.addPackagePolicyButtonPrivilegesRequiredTooltip"
|
||||
defaultMessage="Elastic Agent Integrations require the All privilege for Agent policies and All privilege for Integrations. Contact your administrator."
|
||||
/>
|
||||
),
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<FormattedMessage
|
||||
id="xpack.fleet.policyDetails.addPackagePolicyButtonText"
|
||||
defaultMessage="Add integration"
|
||||
/>
|
||||
</EuiButtonWithTooltip>,
|
||||
],
|
||||
toolsRight:
|
||||
agentPolicy.is_managed || agentPolicy.supports_agentless
|
||||
? []
|
||||
: [
|
||||
<EuiButtonWithTooltip
|
||||
key="addPackagePolicyButton"
|
||||
fill
|
||||
isDisabled={!canWriteIntegrationPolicies}
|
||||
iconType="plusInCircle"
|
||||
onClick={() => {
|
||||
application.navigateToApp(INTEGRATIONS_PLUGIN_ID, {
|
||||
path: pagePathGetters.integrations_all({})[1],
|
||||
state: { forAgentPolicyId: agentPolicy.id },
|
||||
});
|
||||
}}
|
||||
data-test-subj="addPackagePolicyButton"
|
||||
tooltip={
|
||||
!canWriteIntegrationPolicies
|
||||
? {
|
||||
content: missingSecurityConfiguration ? (
|
||||
<FormattedMessage
|
||||
id="xpack.fleet.epm.addPackagePolicyButtonSecurityRequiredTooltip"
|
||||
defaultMessage="To add Elastic Agent Integrations, you must have security enabled and have the All privilege for Fleet. Contact your administrator."
|
||||
/>
|
||||
) : (
|
||||
<FormattedMessage
|
||||
id="xpack.fleet.epm.addPackagePolicyButtonPrivilegesRequiredTooltip"
|
||||
defaultMessage="Elastic Agent Integrations require the All privilege for Agent policies and All privilege for Integrations. Contact your administrator."
|
||||
/>
|
||||
),
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<FormattedMessage
|
||||
id="xpack.fleet.policyDetails.addPackagePolicyButtonText"
|
||||
defaultMessage="Add integration"
|
||||
/>
|
||||
</EuiButtonWithTooltip>,
|
||||
],
|
||||
box: {
|
||||
incremental: true,
|
||||
schema: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue