Commit bb4bd962 authored by Mark Florian's avatar Mark Florian Committed by Dmytro Zaporozhets

Remove parsed_license_report feature flag

This also removes the redundant head/base path handling, and cleans up
the display logic for the license report MR widget.

Part of [Remove parsed_license_report flag from front end code][1].

[1]: https://gitlab.com/gitlab-org/gitlab/issues/37271
parent 07bd816e
......@@ -11,7 +11,6 @@ export default () => {
if (licensesTab) {
const {
licenseHeadPath,
canManageLicenses,
apiUrl,
licenseManagementSettingsPath,
......@@ -30,7 +29,6 @@ export default () => {
apiUrl,
licensesApiPath,
licenseManagementSettingsPath,
headPath: licenseHeadPath,
canManageLicenses: parseBoolean(canManageLicenses),
alwaysOpen: true,
reportSectionClass: 'split-report-section',
......
......@@ -47,8 +47,7 @@ export default {
return codeclimate && codeclimate.head_path;
},
shouldRenderLicenseReport() {
const { licenseManagement } = this.mr;
return licenseManagement && licenseManagement.head_path;
return this.mr.enabledReports?.licenseManagement;
},
hasCodequalityIssues() {
return (
......@@ -332,8 +331,6 @@ export default {
:can-manage-licenses="mr.licenseManagement.can_manage_licenses"
:full-report-path="mr.licenseManagement.license_management_full_report_path"
:license-management-settings-path="mr.licenseManagement.license_management_settings_path"
:base-path="mr.licenseManagement.base_path"
:head-path="mr.licenseManagement.head_path"
:security-approvals-help-page-path="mr.securityApprovalsHelpPagePath"
report-section-class="mr-widget-border-top"
/>
......
......@@ -23,15 +23,6 @@ export default {
},
mixins: [reportsMixin],
props: {
headPath: {
type: String,
required: true,
},
basePath: {
type: String,
required: false,
default: null,
},
fullReportPath: {
type: String,
required: false,
......@@ -96,12 +87,10 @@ export default {
},
},
mounted() {
const { headPath, basePath, apiUrl, canManageLicenses, licensesApiPath } = this;
const { apiUrl, canManageLicenses, licensesApiPath } = this;
this.setAPISettings({
apiUrlManageLicenses: apiUrl,
headPath,
basePath,
canManageLicenses,
licensesApiPath,
});
......
......@@ -11,7 +11,6 @@ module EE
include DescriptionDiffActions
before_action only: [:show] do
push_frontend_feature_flag(:parsed_license_report, default_enabled: true)
push_frontend_feature_flag(:anonymous_visual_review_feedback)
end
......
......@@ -6,16 +6,6 @@ module EE
extend ActiveSupport::Concern
extend ::Gitlab::Utils::Override
prepended do
# Since feature flags are pushed only once on page load, we need to
# ensure they're pushed for all tabs in the pipelines view. This is
# because the user can freely navigate between them *without*
# triggering a page load.
before_action only: [:show, :builds, :failures, :security, :licenses] do
push_frontend_feature_flag(:parsed_license_report, default_enabled: true)
end
end
def security
if pipeline.expose_security_dashboard?
render_show
......
......@@ -41,14 +41,6 @@ module EE
end
expose :license_management, if: -> (mr, _) { head_pipeline_downloadable_path_for_report_type(:license_management) } do
expose :head_path do |merge_request|
head_pipeline_downloadable_path_for_report_type(:license_management)
end
expose :base_path do |merge_request|
base_pipeline_downloadable_path_for_report_type(:license_management)
end
expose :managed_licenses_path do |merge_request|
expose_path(api_v4_projects_managed_licenses_path(id: merge_request.target_project.id))
end
......
......@@ -17,8 +17,7 @@
- if pipeline.expose_license_scanning_data?
#js-tab-licenses.tab-pane
#js-licenses-app{ data: { license_head_path: pipeline.downloadable_path_for_report_type(:license_management),
api_url: license_management_api_url(project),
#js-licenses-app{ data: { api_url: license_management_api_url(project),
license_management_settings_path: license_management_settings_path,
licenses_api_path: licenses_api_path,
can_manage_licenses: can?(current_user, :admin_software_license_policy, project).to_s } }
......@@ -41,8 +41,6 @@ describe('License Report MR Widget', () => {
const defaultProps = {
loadingText: 'LOADING',
errorText: 'ERROR',
headPath: `${TEST_HOST}/head.json`,
basePath: `${TEST_HOST}/head.json`,
licensesApiPath: `${TEST_HOST}/parsed_license_report.json`,
canManageLicenses: true,
licenseManagementSettingsPath: `${TEST_HOST}/lm_settings`,
......@@ -229,8 +227,6 @@ describe('License Report MR Widget', () => {
jasmine.any(Object),
{
apiUrlManageLicenses: apiUrl,
headPath: defaultProps.headPath,
basePath: defaultProps.basePath,
licensesApiPath: defaultProps.licensesApiPath,
canManageLicenses: true,
},
......
......@@ -257,9 +257,7 @@ describe('ee merge request widget options', () => {
describe('with failed request', () => {
beforeEach(() => {
mock.onGet('path.json').reply(500, []);
mock.onGet('head_path.json').reply(500, []);
mock.onGet('vulnerability_feedback_path').reply(500, []);
mock.onAny().reply(500);
vm = mountComponent(Component, { mrData: gl.mrWidgetData });
});
......@@ -783,16 +781,15 @@ describe('ee merge request widget options', () => {
});
describe('license management report', () => {
const headPath = `${TEST_HOST}/head.json`;
const basePath = `${TEST_HOST}/base.json`;
const licenseManagementApiUrl = `${TEST_HOST}/manage_license_api`;
it('should be rendered if license management data is set', () => {
gl.mrWidgetData = {
...mockData,
enabled_reports: {
license_management: true,
},
license_management: {
head_path: headPath,
base_path: basePath,
managed_licenses_path: licenseManagementApiUrl,
can_manage_licenses: false,
},
......@@ -1115,6 +1112,14 @@ describe('ee merge request widget options', () => {
enabled_reports: noSecurityReportsEnabled,
};
if (noSecurityReportsEnabled?.license_management) {
// Provide license report config if it's going to be rendered
gl.mrWidgetData.license_management = {
managed_licenses_path: `${TEST_HOST}/manage_license_api`,
can_manage_licenses: false,
};
}
vm = mountComponent(Component, { mrData: gl.mrWidgetData });
expect(findSecurityWidget()).toBe(null);
......
......@@ -15,7 +15,7 @@ export default Object.assign({}, mockData, {
container_scanning: false,
dast: false,
dependency_scanning: false,
license_management: true,
license_management: false,
},
});
......
......@@ -32,7 +32,7 @@ describe MergeRequestWidgetEntity do
end
def create_all_artifacts
artifacts = %i(codequality license_management performance)
artifacts = %i(codequality performance)
artifacts.each do |artifact_type|
create(:ee_ci_build, artifact_type, :success, pipeline: pipeline, project: pipeline.project)
......@@ -95,7 +95,6 @@ describe MergeRequestWidgetEntity do
where(:json_entry, :artifact_type) do
:codeclimate | :codequality
:license_management | :license_management
:performance | :performance
end
......@@ -149,12 +148,9 @@ describe MergeRequestWidgetEntity do
it 'is included' do
expect(subject.as_json).to include(:license_management)
expect(subject.as_json[:license_management]).to include(:head_path)
expect(subject.as_json[:license_management]).to include(:base_path)
expect(subject.as_json[:license_management]).to include(:managed_licenses_path)
expect(subject.as_json[:license_management]).to include(:can_manage_licenses)
expect(subject.as_json[:license_management]).to include(:license_management_full_report_path)
expect(subject.as_json[:license_management][:head_path]).to include('proxy=true')
end
context 'when feature is not licensed' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment