DAST Scanner Profiles implementation - Form MVC - Edit profiles - Frontend

Summary

This issue is for adding edit capability to the DAST Scanner Profile form.

Implementation plan

Production code

  • Create the DastSiteProfilesController#edit controller action in ee/app/controllers/projects/dast_scanner_profiles_controller.rb.
    • The action should retrieve the profile being edited and pass it down to the view.
  • Create the corresponding edit route in ee/config/routes/project.rb.
    • The route should be protected with the same policy as /:namespace/:project/-/on_demand_scans.
  • Create the HAML view in ee/app/views/projects/dast_scanner_profiles/edit.html.haml.
    • The HAML view renders a mount point for the previously created DAST Scanner Profile form.
    • It passes the profile's data down to the Vue app via data- attributes:
      • ID.
      • Profile Name.
      • Spider Timeout.
      • Target Timeout.
  • Active nav items for editing profile
    • In ee/app/helpers/ee/projects_helper.rb
  • Create the client-side GraphQL mutation dastScannerProfileUpdate in ee/app/assets/javascripts/dast_scanner_profiles_form/graphql/dast_scanner_profile_update.mutation.graphql
  • Implement the edit mode in the DAST Scanner Profile form.
    • The component should accept a profile's data via props (see data- attributes above).
    • The fields should be populated with the profile's data.
    • On submit, the dastScannerProfileUpdate mutation is triggered instead of dastScannerProfileCreated, and the variables include the profile's ID.
    • Strings match the edit context.
      • Title.
      • Generic error message.
      • Cancel modal title.
  • Add #scanner-profile to the redirect link for form submission & discard

Specs

  • ee/spec/frontend/dast_scanner_profiles_form/components/dast_scanner_profiles_form_spec.js
    • Shows correct strings depending on the new/edit context.
    • Handles submission success properly
      • Loading state.
      • GraphQL mutation.
      • Redirection.
    • Handles submission errors properly
      • Loading state.
      • Generic error.
      • Erros-as-data.
    • Cancellation
      • Form untouched.
        • Redirection.
      • Form touched.
        • Confirmation
        • Redirection.
  • ee/spec/views/projects/dast_scanner_profiles/new.html.haml_spec.rb
    • Share new action's specs.

Related resources

Edited by Dheeraj Joshi