FE: Clean up code for `scan_result_policy`

Why are we doing this work

We have been supporting both scan_result_policy and approval_policy types since %16.9. We should remove the support for scan_result_policy now.

Relevant links

  • Documentation: Remove mentions of scan_result_policy from documentation
  • Feature flag:
  • Performance:
  • Testing:

Implementation plan

  • remove support for type: scan_result
Diff
diff --git a/ee/app/assets/javascripts/security_orchestration/components/constants.js b/ee/app/assets/javascripts/security_orchestration/components/constants.js
index b492f2cf37f0..34a7a13d0fae 100644
--- a/ee/app/assets/javascripts/security_orchestration/components/constants.js
+++ b/ee/app/assets/javascripts/security_orchestration/components/constants.js
@@ -10,13 +10,6 @@ export const POLICY_TYPE_COMPONENT_OPTIONS = {
     urlParameter: 'scan_execution_policy',
     value: 'scanExecution',
   },
-  scanResult: {
-    component: 'scan-result-policy-editor',
-    text: s__('SecurityOrchestration|Merge request approval'),
-    typeName: 'ScanResultPolicy',
-    urlParameter: 'scan_result_policy',
-    value: 'scanResult',
-  },
   approval: {
     component: 'scan-result-policy-editor',
     text: s__('SecurityOrchestration|Merge request approval'),
diff --git a/ee/app/assets/javascripts/security_orchestration/components/policy_drawer/drawer_wrapper.vue b/ee/app/assets/javascripts/security_orchestration/components/policy_drawer/drawer_wrapper.vue
index 3b77464e775a..fae19e29d83d 100644
--- a/ee/app/assets/javascripts/security_orchestration/components/policy_drawer/drawer_wrapper.vue
+++ b/ee/app/assets/javascripts/security_orchestration/components/policy_drawer/drawer_wrapper.vue
@@ -21,7 +21,6 @@ import ScanResultDrawer from './scan_result/details_drawer.vue';
 
 const policyComponent = {
   [POLICY_TYPE_COMPONENT_OPTIONS.scanExecution.value]: ScanExecutionDrawer,
-  [POLICY_TYPE_COMPONENT_OPTIONS.scanResult.value]: ScanResultDrawer,
   [POLICY_TYPE_COMPONENT_OPTIONS.approval.value]: ScanResultDrawer,
 };
 
diff --git a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/app.vue b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/app.vue
index 79234a206218..575760fec86e 100644
--- a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/app.vue
+++ b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/app.vue
@@ -93,9 +93,6 @@ export default {
       default: s__('SecurityOrchestration|New policy'),
     },
     editTitles: {
-      [POLICY_TYPE_COMPONENT_OPTIONS.scanResult.value]: s__(
-        'SecurityOrchestration|Edit merge request approval policy',
-      ),
       [POLICY_TYPE_COMPONENT_OPTIONS.approval.value]: s__(
         'SecurityOrchestration|Edit merge request approval policy',
       ),
diff --git a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/editor_layout.vue b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/editor_layout.vue
index 5bece4687659..98782bd42421 100644
--- a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/editor_layout.vue
+++ b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/editor_layout.vue
@@ -219,8 +219,7 @@ export default {
     },
     shouldShowRuntimeMessage() {
       return (
-        (this.policy.type === POLICY_TYPE_COMPONENT_OPTIONS.scanResult.urlParameter ||
-          this.policy.type === POLICY_TYPE_COMPONENT_OPTIONS.approval.urlParameter) &&
+        this.policy.type === POLICY_TYPE_COMPONENT_OPTIONS.approval.urlParameter &&
         this.namespaceType !== NAMESPACE_TYPES.PROJECT
       );
     },
diff --git a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/policy_type_selector.vue b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/policy_type_selector.vue
index a3176dfe4c7b..820cd91afb43 100644
--- a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/policy_type_selector.vue
+++ b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/policy_type_selector.vue
@@ -72,7 +72,7 @@ export default {
     policies() {
       const policies = [
         {
-          text: POLICY_TYPE_COMPONENT_OPTIONS.scanResult.text.toLowerCase(),
+          text: POLICY_TYPE_COMPONENT_OPTIONS.approval.text.toLowerCase(),
           urlParameter: POLICY_TYPE_COMPONENT_OPTIONS.approval.urlParameter,
           title: i18n.scanResultPolicyTitle,
           titlePopover: i18n.scanResultPolicyTitlePopoverTitle,

Verification steps

  1. Check that new policy is created with approval_policy type and can be saved
  2. Check that policy can be edited
  3. Check that policies are listed in the Policy page and can be filtered
Edited by Alexander Turinske