Skip to content

Policy editor refreshes when a user selects the policy type

Why are we doing this work

From https://staging.gitlab.com/govern-team-test/cnp-alert-demo/-/security/policies/new, select a policy. The page refreshes even though it already has all the data from the backend and all the components are loaded. We should be able to make this transition faster by not refreshing the page.

Relevant links

Non-functional requirements

  • Documentation:
  • Feature flag:
  • Performance:
  • Testing:

Implementation plan

  • add ?type=scan_x_policy to the url when the policy is selected
  • navigate to the appropriate policy editor
    • frontend update policy_type_selector.vue to update the page to the selected policy without refreshing the page
    • There was some conversation here about it -I am sure that there are parts of the application that add properties to the URL without refreshing the page; I was gong to see what they are doing. I would prefer not to use Vue Router as it seems like overkill, but I could be wrong.
    • We are going from http://gdk.test:3443/gitlab-org/gitlab-test/-/security/policies/new => http://gdk.test:3443/gitlab-org/gitlab-test/-/security/policies/new?type=scan_result_policy, so we need to
    • For modifying location.search. I see we have url_utility#setUrlParams, maybe we can just use that?
  • when a user selects a policy, then navigates back to the policy selection page, prevent a reload

Verification steps

  1. Upload a GitLab Ultimate license
  2. Navigate to a project/group => Secure => Policies => New policy
  3. Select a policy
  4. Verify the url updates appropriately
  5. Verify the page navigates to the policy editor page without refreshing
Edited by Alexander Turinske