Implement loading and error state in DAST scans view

What does this MR do and why?

This improves the on-demand scans UX by implementing a loading and an error states.

Screenshots or screen recordings

Loading state Error state
Screen_Shot_2021-10-29_at_11.20.41_AM Screen_Shot_2021-10-29_at_11.21.12_AM

How to set up and validate locally

  1. Enable the on-demands scans page.

    Feature.enable(:dast_view_scans)
  2. Visit any project's on-demand scans page such as http://127.0.0.1:3000/groups/flightjs/-/on_demand_scans.

    • If you have run at least one on-demand scan in the past, you should see the loading state here. Otherwise, follow the instructions to run an on-demand scan.
  3. For the error state to show up, go wild and break the GraphQL query by applying the following patch (copy the code block and run pbpaste | git apply):

    diff --git a/ee/app/assets/javascripts/on_demand_scans/graphql/on_demand_scans.query.graphql b/ee/app/assets/javascripts/on_demand_scans/graphql/on_demand_scans.query.graphql
    index e6a5e1f4fbd..8b62bbbf645 100644
    --- a/ee/app/assets/javascripts/on_demand_scans/graphql/on_demand_scans.query.graphql
    +++ b/ee/app/assets/javascripts/on_demand_scans/graphql/on_demand_scans.query.graphql
    @@ -13,6 +13,7 @@ query allPipelinesCount($fullPath: ID!, $first: Int, $last: Int, $after: String,
             ...PageInfo
           }
           nodes {
    +        foo
             id
             path
             createdAt

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #341364 (closed)

Edited by Paul Gascou-Vaillancourt

Merge request reports

Loading