[License Compliance MR Widget Extension] - Frontend - Use dedicated API endpoint for collapsed/uncollapsed state

As a follow up to #338281 (closed) we want to optimize the use of the reduced endpoint data to load only the counts for the collapsed state.

UX changes

None

Collapsed

Screen_Shot_2022-03-14_at_6.24.01_PM

Uncollapsed

Screen_Shot_2022-03-12_at_4.37.54_PM

Summary of change

The MR widget extension receives two endpoints. One for the collapsed state, and one for the expanded state. We currently use the same endpoint for both. Ideally, we should only load the initial summary version of the data that simply contains the license counts for new licenses

Implementation Plan

  • Build on the changes in !75341 (merged)

  • Will need to pass in the new endpoint path all the way from the HAML template in ee/app/views/projects/merge_requests/show.html.haml and consume in ee/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js and ee/app/assets/javascripts/vue_merge_request_widget/extensions/license_compliance/index.js

  • Update fetchCollapsedData in ee/app/assets/javascripts/vue_merge_request_widget/extensions/license_compliance/index.js to consume counts from new endpoint.

  • Ensure both fetchCollapsedData and fetchFullData to use pollUntilComplete to handle 204 status codes while pipeline is running and/or parsing results. For reference use: https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/assets/javascripts/vue_shared/license_compliance/store/actions.js#L90

  • Update unit tests

Testing

Frontend engineer to update unit tests. SET to update Browser level tests to test for collapsed / expanded states.

Edited by -