Create a shared form for compliance frameworks creation and updating
What does this MR do?
This MR creates a new shared form for use by the overarching create and update processes for compliance frameworks.
This shared form holds all the fields that these overarching forms need to us. It handles the display and validation of the fields, as well as the display of the loading icon and error messages.
The overarching forms will handle the actual processing of these fields.
Steps | MR |
---|---|
1 - Create a shared form for create and update |
|
2 - Create the create form | !52476 (merged) |
3 - Create the update form | !52479 (merged) |
Screenshots (strongly suggested)
Validation | Screen_Recording_2021-01-25_at_11.21.17 |
Dark mode |
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry
- [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides - [-] Database guides
-
Separation of EE specific content
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 67b29829dd0363ec8caf85d8e4d062cb4bb5755c)
+++ b/ee/app/assets/javascripts/pages/groups/edit/index.js (date 1611573270389)
@@ -1,6 +1,9 @@
+import Vue from 'vue';
+
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 SharedForm from 'ee/groups/settings/compliance_frameworks/components/shared_form.vue';
import createFlash from '~/flash';
import { __ } from '~/locale';
@@ -19,6 +22,28 @@
const complianceFrameworksList = document.querySelector('#js-compliance-frameworks-list');
+const createComplianceFrameworksFormApp = (el) => {
+ if (!el) {
+ return false;
+ }
+
+ const { groupEditPath } = el.dataset;
+
+ return new Vue({
+ el,
+ render(createElement) {
+ const element = SharedForm;
+ const props = { groupEditPath };
+
+ return createElement(element, {
+ props,
+ });
+ },
+ });
+};
+
+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 67b29829dd0363ec8caf85d8e4d062cb4bb5755c)
+++ b/ee/app/helpers/compliance_management/compliance_framework/group_settings_helper.rb (date 1611573304029)
@@ -13,6 +13,14 @@
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')
+ }
+ 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 67b29829dd0363ec8caf85d8e4d062cb4bb5755c)
+++ b/ee/app/views/groups/_compliance_frameworks.html.haml (date 1611573304031)
@@ -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 }
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers - [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
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