Skip to content

Add validation initForm helper

What does this MR do?

This adds initForm helper function that creates the form object that has the compliant structure to be used with the Validation directive.

Before

const form = {
  state: false,
  showValidation: false,
  fields: {
    name: initFormField({ value: this.projectName }),
  },
};

After

const form = initForm({
  fields: {
    name: { value: this.projectName },
  },
});

Follow-up MRs

After this MR is merged, we will proceed with updating the existing vue component to use this helper:

  • app/assets/javascripts/pages/projects/forks/new/components/fork_form.vue
  • ee/app/assets/javascripts/on_demand_scans/components/on_demand_scans_form.vue
  • ee/app/assets/javascripts/security_configuration/dast_scanner_profiles/components/dast_scanner_profile_form.vue
  • ee/app/assets/javascripts/security_configuration/dast_site_profiles_form/components/dast_site_auth_section.vue
  • ee/app/assets/javascripts/security_configuration/dast_site_profiles_form/components/dast_site_profile_form.vue

And remove

  • ee/app/assets/javascripts/security_configuration/utils.js

Here's the follow up issue that captures this > #330303

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

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 #327842

Edited by Samantha Ming

Merge request reports