[frontend] Enforce max policy limit
Why are we doing this work
There is a limit set of maximum 5 active vulnerability management policies in the backend, but we're not enforcing this in the frontend. This is similar to the scan execution and merge request approval policies.
Non-functional requirements
-
Documentation: -
Feature flag: vulnerability_management_policy_type -
Performance: -
Testing: unit tests
Implementation plan
- Pass through
maxActiveVulnerabilityManagementPoliciesReachedandmaxVulnerabilityManagementPoliciesAllowedin/security_orchestration/policy_editor.js - Update
policyLimitReached(),policyLimit(), andtype()and injectmaxActiveVulnerabilityManagementPoliciesReachedandmaxVulnerabilityManagementPoliciesAllowedinsecurity_orchestration/components/policy_editor/editor_layout.vue - Set
hasMaxandmaxPoliciesAllowedand injectmaxActiveVulnerabilityManagementPoliciesReachedandmaxVulnerabilityManagementPoliciesAllowedfor vulnerability management policy in/security_orchestration/components/policy_editor/policy_type_selector.vue - Update specs
Verification steps
- Go to https://staging.gitlab.com/govern-team-test/verify-vulnerability-management-policy/verify-465728/-/security/policies
- Click "New policy"
- Verify you can see message " You already have the maximum 5 vulnerability management policies." and you can't create a new vulnerability management policy
- Go back to the policies list
- Click on the disabled policy "Vulnerability management policy 1" and click "Edit policy"
- Verify that the Policy status radio button cannot be set to enabled in the rule mode (because we already have 5 enabled vuln management policies)
- Verify that hovering the radio buttons shows a tooltip
Edited by Lorenz van Herwaarden