DAST Scanner Profiles implementation - Form MVC - Edit profiles - Frontend
- Main issue: #222767 (closed)
- Parent issue: #235407 (closed)
- backend counterpart: #235408 (closed)
Summary
This issue is for adding edit capability to the DAST Scanner Profile form.
Implementation plan
Production code
- Create the
DastSiteProfilesController#editcontroller action inee/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
editroute inee/config/routes/project.rb.- The route should be protected with the same policy as
/:namespace/:project/-/on_demand_scans.
- The route should be protected with the same policy as
- 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
dastScannerProfileUpdateinee/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
dastScannerProfileUpdatemutation is triggered instead ofdastScannerProfileCreated, and the variables include the profile's ID. - Strings match the edit context.
- Title.
- Generic error message.
- Cancel modal title.
- The component should accept a profile's data via props (see
- Add
#scanner-profileto 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/editcontext. - 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.
- Form untouched.
- Shows correct strings depending on the
-
ee/spec/views/projects/dast_scanner_profiles/new.html.haml_spec.rb- Share
newaction's specs.
- Share
Related resources
- Prior work: !38315 (merged)
Edited by Dheeraj Joshi