[License Compliance MR Widget Extension] - Frontend - Implement missing MR widget link buttons to reports and manage licenses page by consuming MR widget extension API
Description
The current MR Widget extension spec does not support adding buttons in the header. Adding support to the core extension framework will be tracked in a separate issue and will be marked as blocking this issue.
This issue covers the work to consume the the MR Widget Extension API and add the needed buttons.
Note
We may end up closing this issue if the WorkingGroupMergeRequestReportWidgets decides not to support additional buttons in the Widget header
Implementation Plan
- Blocked, and TBD based on IF and HOW the API is implemented in the core widget extension
What we have
What we would implement
Implementation Plan
We need to pass the report paths down from the backend.
-
In https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js#L35 add this.manageLicensesPath
andthis.licensesFullReportPath
-
Add paths as props to https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/assets/javascripts/vue_merge_request_widget/extensions/license_compliance/index.js#L23 -
In ee/app/assets/javascripts/vue_merge_request_widget/extensions/license_compliance/index.js
update the config to add buttons. Something like:
tertiaryButtons() {
return [{
text: 'Manage Licenses',
href: this.manageLicensePath,
target: '_blank', // Optional
},{
text: 'Full Report',
href: this.licensesFullReportPath,
target: '_blank', // Optional
}]
}
-
In backend add to https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/serializers/ee/merge_request_poll_cached_widget_entity.rb#L16
expose :manage_liceses_path do |merge_request|
if merge_request.has_license_scanning_reports?
<manage_licenses_path>(merge_request.project, merge_request, format: :json)
end
end
expose :licenses_full_report_path do |merge_request|
if merge_request.has_license_scanning_reports??
<licenses_full_report_path>(merge_request.project, merge_request, format: :json)
end
end
Testing
SET to update License Compliance MR Widget E2E UI test