mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[Cloud Security] fix disabled button when Agentless is selected (#190713)
## Summary Summarize your PR. If it involves visual changes include a screenshot or gif. This PR is to create Security project and to debug validation errors in Serverless QA. In Serverless QA, when we submit save an Agentless integration, the Save and Continue button is disabled. Locally, the button works as expected. I need to add `console.debug on Validation errors` since I don't have visibility on the package policy validation errors. [Reverted code back to show Agent-based pop-ups](https://github.com/elastic/kibana/pull/189932/files#r1707816416) and setFormState depending on the agentCount. **Before:** **Locally** https://github.com/user-attachments/assets/940cd523-c83b-44e2-8bf7-92bff019d85a **QA** https://github.com/user-attachments/assets/ce15011c-ccc0-4941-8798-40e78cf81023 **After Project CI Build:** **Serverless QA** https://github.com/user-attachments/assets/364903f4-c6af-4768-ab48-ca8da9cdb476 --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
c1e751d9ff
commit
0ffd37a074
4 changed files with 36 additions and 8 deletions
|
@ -119,12 +119,12 @@ Utilize AWS CloudFormation (a built-in AWS tool) or a series of manual steps to
|
|||
defaultMessage="Tick the checkbox under {capabilities} in the opened CloudFormation stack review form: {acknowledge}"
|
||||
values={{
|
||||
acknowledge: (
|
||||
<em>
|
||||
<strong>
|
||||
<FormattedMessage
|
||||
id="xpack.csp.agentlessForm.cloudFormation.steps.accept.acknowledge"
|
||||
defaultMessage="I acknowledge that AWS CloudFormation might create IAM resources."
|
||||
/>
|
||||
</em>
|
||||
</strong>
|
||||
),
|
||||
capabilities: (
|
||||
<strong>
|
||||
|
|
|
@ -378,17 +378,28 @@ export function useOnSubmit({
|
|||
|
||||
const hasGoogleCloudShell = data?.item ? getCloudShellUrlFromPackagePolicy(data.item) : false;
|
||||
|
||||
if (agentCount > 0) {
|
||||
setFormState('SUBMITTED');
|
||||
return;
|
||||
// Check if agentless is configured in ESS and Serverless until Agentless API migrates to Serverless
|
||||
const isAgentlessConfigured =
|
||||
isAgentlessAgentPolicy(createdPolicy) || isAgentlessPackagePolicy(data!.item);
|
||||
|
||||
// Removing this code will disabled the Save and Continue button. We need code below update form state and trigger correct modal depending on agent count
|
||||
if (hasFleetAddAgentsPrivileges && !isAgentlessConfigured) {
|
||||
if (agentCount) {
|
||||
setFormState('SUBMITTED');
|
||||
} else if (hasAzureArmTemplate) {
|
||||
setFormState('SUBMITTED_AZURE_ARM_TEMPLATE');
|
||||
} else if (hasCloudFormation) {
|
||||
setFormState('SUBMITTED_CLOUD_FORMATION');
|
||||
} else if (hasGoogleCloudShell) {
|
||||
setFormState('SUBMITTED_GOOGLE_CLOUD_SHELL');
|
||||
} else {
|
||||
setFormState('SUBMITTED_NO_AGENTS');
|
||||
}
|
||||
}
|
||||
|
||||
if (!error) {
|
||||
setSavedPackagePolicy(data!.item);
|
||||
|
||||
// Check if agentless is configured in ESS and Serverless until Agentless API migrates to Serverless
|
||||
const isAgentlessConfigured =
|
||||
isAgentlessAgentPolicy(createdPolicy) || isAgentlessPackagePolicy(data!.item);
|
||||
const promptForAgentEnrollment =
|
||||
!(agentCount && agentPolicies.length > 0) &&
|
||||
!isAgentlessConfigured &&
|
||||
|
|
|
@ -476,6 +476,10 @@ export function AddCisIntegrationFormPageProvider({
|
|||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
};
|
||||
|
||||
const showSuccessfulToast = async (testSubjectId: string) => {
|
||||
return await testSubjects.exists(testSubjectId);
|
||||
};
|
||||
|
||||
const getFirstCspmIntegrationPageIntegration = async () => {
|
||||
const integration = await testSubjects.find('integrationNameLink');
|
||||
return await integration.getVisibleText();
|
||||
|
@ -539,5 +543,6 @@ export function AddCisIntegrationFormPageProvider({
|
|||
getFirstCspmIntegrationPageIntegration,
|
||||
getFirstCspmIntegrationPageAgent,
|
||||
getAgentBasedPolicyValue,
|
||||
showSuccessfulToast,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -142,5 +142,17 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
).to.be('true');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Serverless - Agentless CIS_AWS Create flow', () => {
|
||||
it(`user should save agentless integration policy when there are no api or validation errors and button is not disabled`, async () => {
|
||||
await cisIntegration.createAgentlessIntegration({
|
||||
cloudProvider: 'aws',
|
||||
});
|
||||
|
||||
expect(await cisIntegration.showSuccessfulToast('packagePolicyCreateSuccessToast')).to.be(
|
||||
true
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue