Skip to content

Create the update form for compliance frameworks

Robert Hunt requested to merge 287827-update-compliance-framework-form into master

What does this MR do?

This MR creates a new create form for use by compliance frameworks.

This form handles the processing of the update GraphQL endpoint. On success or failure, it passes this information onto the shared form to be rendered.

Steps MR
1 - Create a shared form for create and update !52475 (merged)
2 - Create the create form !52476 (merged)
3 - Create the update form 👈 You are here

Screenshots (strongly suggested)

Validation Screen_Recording_2021-01-25_at_13.29.26
Dark mode image

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

This form isn't used anywhere yet. If you want to test it locally, an example patch for the compliance framework settings area is below:

Patch
Index: ee/app/assets/javascripts/pages/groups/edit/index.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/ee/app/assets/javascripts/pages/groups/edit/index.js b/ee/app/assets/javascripts/pages/groups/edit/index.js
--- a/ee/app/assets/javascripts/pages/groups/edit/index.js	(revision 7610f6418b38723b35daad8dd45586ee33bfd661)
+++ b/ee/app/assets/javascripts/pages/groups/edit/index.js	(date 1611574464012)
@@ -1,6 +1,7 @@
 import '~/pages/groups/edit';
 import validateRestrictedIpAddress from 'ee/groups/settings/access_restriction_field/validate_ip_address';
 import initAccessRestrictionField from 'ee/groups/settings/access_restriction_field';
+import { createComplianceFrameworksFormApp } from 'ee/groups/settings/compliance_frameworks/init_form';
 import createFlash from '~/flash';
 import { __ } from '~/locale';
 
@@ -19,6 +20,8 @@
 
 const complianceFrameworksList = document.querySelector('#js-compliance-frameworks-list');
 
+createComplianceFrameworksFormApp(document.querySelector('#js-compliance-frameworks-form'));
+
 if (complianceFrameworksList) {
   (async () => {
     try {
Index: ee/app/helpers/compliance_management/compliance_framework/group_settings_helper.rb
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/ee/app/helpers/compliance_management/compliance_framework/group_settings_helper.rb b/ee/app/helpers/compliance_management/compliance_framework/group_settings_helper.rb
--- a/ee/app/helpers/compliance_management/compliance_framework/group_settings_helper.rb	(revision a02d197881c3ed7ef4d80062c554bc3764992345)
+++ b/ee/app/helpers/compliance_management/compliance_framework/group_settings_helper.rb	(date 1611928435650)
@@ -13,6 +13,15 @@
           group_path: @group.full_path
         }
       end
+
+      def compliance_frameworks_form_data
+        {
+          framework_id: 1,
+          group_path: @group.full_path,
+          group_edit_path: edit_group_path(@group, anchor: 'js-compliance-frameworks-settings'),
+          graphql_field_name: ComplianceManagement::Framework.name,
+        }
+      end
     end
   end
 end
Index: ee/app/views/groups/_compliance_frameworks.html.haml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/ee/app/views/groups/_compliance_frameworks.html.haml b/ee/app/views/groups/_compliance_frameworks.html.haml
--- a/ee/app/views/groups/_compliance_frameworks.html.haml	(revision 7610f6418b38723b35daad8dd45586ee33bfd661)
+++ b/ee/app/views/groups/_compliance_frameworks.html.haml	(date 1611574464021)
@@ -11,3 +11,4 @@
         = s_('GroupSettings|Configure frameworks to apply enforceable rules to projects.')
     .settings-content
       #js-compliance-frameworks-list{ data: compliance_frameworks_list_data }
+      #js-compliance-frameworks-form{ data: compliance_frameworks_form_data }

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team

Related to #287827 (closed)

Edited by Robert Hunt

Merge request reports