Skip to content

Draft: Refactor apollo loadingKey to computed property

Lorenz van Herwaarden requested to merge refactor-loading-key-apollo into master

What does this MR do and why?

This MR replaces occurrences of apollo's loadingKey in vulnerability/security components by adding a computed property which returns the apollo query's loading property. The discussion behind refactoring this can be found in the issue #385842 (closed), but boils down to the use of loadingKey being confusing and $apollo.queries.queryName.loading being used everywhere.

Screenshots or screen recordings

location screenshot
vulnerability_finding_modal.vue1 Screenshot_2023-02-08_at_13.16.49
tool_filter.vue2 Screenshot_2023-02-08_at_13.37.15
cluster_filter.vue, cluster_filter_deprecated.vue3, image_filter.vue, image_filter_deprecated.vue3 cluster_filter-image_filter

1to view vulnerability_finding_modal.vue, pipelineSecurityDashboardGraphql feature flag must be true.

2to view tool_filter.vue, refactorVulnerabilityFilters feature flag must be false and you must view the vulnerability report on a group level.

3to view image_filter_deprecated.vue and cluster_filter_deprecated.vue, refactorVulnerabilityFilters feature flag must be false.

How to set up and validate locally

  1. You need an EE license
  2. You need runners enabled
  3. import security reports

vulnerability_finding_modal.vue

  1. enable pipeline_security_dashboard_graphql feature flag echo "Feature.enable(:pipeline_security_dashboard_graphql)" | rails c
  2. create an MR making a small change in security-reports
  3. check the pipeline and go to security tab
  4. set network throttling to fast 3G
  5. click on a vulnerability
  6. verify that loading state can be seen

cluster_filter.vue 7 image_filter.vue

  1. go to the vulnerability report page of security-reports
  2. set network throttling to fast 3G
  3. click operational vulnerabilities tab
  4. verify that both cluster and image filter show loading state for a while

cluster_filter_deprecated.vue & image_filter_deprecated.vue

  1. disable refactor_vulnerability_filters feature flag echo "Feature.disable(:refactor_vulnerability_filters)" | rails c
  2. go to the vulnerability report page of security-reports
  3. set network throttling to fast 3G
  4. click operational vulnerabilities tab
  5. verify that both cluster and image filter show loading state for a while

tool_filter.vue

  1. enable refactor_vulnerability_tool_filter feature flag echo "Feature.enable(:refactor_vulnerability_tool_filter)" | rails c
  2. set network throttling to fast 3G
  3. go to vulnerability report page of flightjs group /groups/flightjs/-/security/vulnerabilities (or other group with vulnerability report)
  4. verify that tool filter shows loading state for a while

MR acceptance checklist

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

Edited by Lorenz van Herwaarden

Merge request reports