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 () => { ...@@ -11,7 +11,6 @@ export default () => {
if (licensesTab) { if (licensesTab) {
const { const {
licenseHeadPath,
canManageLicenses, canManageLicenses,
apiUrl, apiUrl,
licenseManagementSettingsPath, licenseManagementSettingsPath,
...@@ -30,7 +29,6 @@ export default () => { ...@@ -30,7 +29,6 @@ export default () => {
apiUrl, apiUrl,
licensesApiPath, licensesApiPath,
licenseManagementSettingsPath, licenseManagementSettingsPath,
headPath: licenseHeadPath,
canManageLicenses: parseBoolean(canManageLicenses), canManageLicenses: parseBoolean(canManageLicenses),
alwaysOpen: true, alwaysOpen: true,
reportSectionClass: 'split-report-section', reportSectionClass: 'split-report-section',
......
...@@ -47,8 +47,7 @@ export default { ...@@ -47,8 +47,7 @@ export default {
return codeclimate && codeclimate.head_path; return codeclimate && codeclimate.head_path;
}, },
shouldRenderLicenseReport() { shouldRenderLicenseReport() {
const { licenseManagement } = this.mr; return this.mr.enabledReports?.licenseManagement;
return licenseManagement && licenseManagement.head_path;
}, },
hasCodequalityIssues() { hasCodequalityIssues() {
return ( return (
...@@ -332,8 +331,6 @@ export default { ...@@ -332,8 +331,6 @@ export default {
:can-manage-licenses="mr.licenseManagement.can_manage_licenses" :can-manage-licenses="mr.licenseManagement.can_manage_licenses"
:full-report-path="mr.licenseManagement.license_management_full_report_path" :full-report-path="mr.licenseManagement.license_management_full_report_path"
:license-management-settings-path="mr.licenseManagement.license_management_settings_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" :security-approvals-help-page-path="mr.securityApprovalsHelpPagePath"
report-section-class="mr-widget-border-top" report-section-class="mr-widget-border-top"
/> />
......
...@@ -23,15 +23,6 @@ export default { ...@@ -23,15 +23,6 @@ export default {
}, },
mixins: [reportsMixin], mixins: [reportsMixin],
props: { props: {
headPath: {
type: String,
required: true,
},
basePath: {
type: String,
required: false,
default: null,
},
fullReportPath: { fullReportPath: {
type: String, type: String,
required: false, required: false,
...@@ -96,12 +87,10 @@ export default { ...@@ -96,12 +87,10 @@ export default {
}, },
}, },
mounted() { mounted() {
const { headPath, basePath, apiUrl, canManageLicenses, licensesApiPath } = this; const { apiUrl, canManageLicenses, licensesApiPath } = this;
this.setAPISettings({ this.setAPISettings({
apiUrlManageLicenses: apiUrl, apiUrlManageLicenses: apiUrl,
headPath,
basePath,
canManageLicenses, canManageLicenses,
licensesApiPath, licensesApiPath,
}); });
......
...@@ -11,7 +11,6 @@ module EE ...@@ -11,7 +11,6 @@ module EE
include DescriptionDiffActions include DescriptionDiffActions
before_action only: [:show] do before_action only: [:show] do
push_frontend_feature_flag(:parsed_license_report, default_enabled: true)
push_frontend_feature_flag(:anonymous_visual_review_feedback) push_frontend_feature_flag(:anonymous_visual_review_feedback)
end end
......
...@@ -6,16 +6,6 @@ module EE ...@@ -6,16 +6,6 @@ module EE
extend ActiveSupport::Concern extend ActiveSupport::Concern
extend ::Gitlab::Utils::Override 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 def security
if pipeline.expose_security_dashboard? if pipeline.expose_security_dashboard?
render_show render_show
......
...@@ -41,14 +41,6 @@ module EE ...@@ -41,14 +41,6 @@ module EE
end end
expose :license_management, if: -> (mr, _) { head_pipeline_downloadable_path_for_report_type(:license_management) } do 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 :managed_licenses_path do |merge_request|
expose_path(api_v4_projects_managed_licenses_path(id: merge_request.target_project.id)) expose_path(api_v4_projects_managed_licenses_path(id: merge_request.target_project.id))
end end
......
...@@ -17,8 +17,7 @@ ...@@ -17,8 +17,7 @@
- if pipeline.expose_license_scanning_data? - if pipeline.expose_license_scanning_data?
#js-tab-licenses.tab-pane #js-tab-licenses.tab-pane
#js-licenses-app{ data: { license_head_path: pipeline.downloadable_path_for_report_type(:license_management), #js-licenses-app{ data: { api_url: license_management_api_url(project),
api_url: license_management_api_url(project),
license_management_settings_path: license_management_settings_path, license_management_settings_path: license_management_settings_path,
licenses_api_path: licenses_api_path, licenses_api_path: licenses_api_path,
can_manage_licenses: can?(current_user, :admin_software_license_policy, project).to_s } } can_manage_licenses: can?(current_user, :admin_software_license_policy, project).to_s } }
...@@ -41,8 +41,6 @@ describe('License Report MR Widget', () => { ...@@ -41,8 +41,6 @@ describe('License Report MR Widget', () => {
const defaultProps = { const defaultProps = {
loadingText: 'LOADING', loadingText: 'LOADING',
errorText: 'ERROR', errorText: 'ERROR',
headPath: `${TEST_HOST}/head.json`,
basePath: `${TEST_HOST}/head.json`,
licensesApiPath: `${TEST_HOST}/parsed_license_report.json`, licensesApiPath: `${TEST_HOST}/parsed_license_report.json`,
canManageLicenses: true, canManageLicenses: true,
licenseManagementSettingsPath: `${TEST_HOST}/lm_settings`, licenseManagementSettingsPath: `${TEST_HOST}/lm_settings`,
...@@ -229,8 +227,6 @@ describe('License Report MR Widget', () => { ...@@ -229,8 +227,6 @@ describe('License Report MR Widget', () => {
jasmine.any(Object), jasmine.any(Object),
{ {
apiUrlManageLicenses: apiUrl, apiUrlManageLicenses: apiUrl,
headPath: defaultProps.headPath,
basePath: defaultProps.basePath,
licensesApiPath: defaultProps.licensesApiPath, licensesApiPath: defaultProps.licensesApiPath,
canManageLicenses: true, canManageLicenses: true,
}, },
......
...@@ -257,9 +257,7 @@ describe('ee merge request widget options', () => { ...@@ -257,9 +257,7 @@ describe('ee merge request widget options', () => {
describe('with failed request', () => { describe('with failed request', () => {
beforeEach(() => { beforeEach(() => {
mock.onGet('path.json').reply(500, []); mock.onAny().reply(500);
mock.onGet('head_path.json').reply(500, []);
mock.onGet('vulnerability_feedback_path').reply(500, []);
vm = mountComponent(Component, { mrData: gl.mrWidgetData }); vm = mountComponent(Component, { mrData: gl.mrWidgetData });
}); });
...@@ -783,16 +781,15 @@ describe('ee merge request widget options', () => { ...@@ -783,16 +781,15 @@ describe('ee merge request widget options', () => {
}); });
describe('license management report', () => { describe('license management report', () => {
const headPath = `${TEST_HOST}/head.json`;
const basePath = `${TEST_HOST}/base.json`;
const licenseManagementApiUrl = `${TEST_HOST}/manage_license_api`; const licenseManagementApiUrl = `${TEST_HOST}/manage_license_api`;
it('should be rendered if license management data is set', () => { it('should be rendered if license management data is set', () => {
gl.mrWidgetData = { gl.mrWidgetData = {
...mockData, ...mockData,
enabled_reports: {
license_management: true,
},
license_management: { license_management: {
head_path: headPath,
base_path: basePath,
managed_licenses_path: licenseManagementApiUrl, managed_licenses_path: licenseManagementApiUrl,
can_manage_licenses: false, can_manage_licenses: false,
}, },
...@@ -1115,6 +1112,14 @@ describe('ee merge request widget options', () => { ...@@ -1115,6 +1112,14 @@ describe('ee merge request widget options', () => {
enabled_reports: noSecurityReportsEnabled, 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 }); vm = mountComponent(Component, { mrData: gl.mrWidgetData });
expect(findSecurityWidget()).toBe(null); expect(findSecurityWidget()).toBe(null);
......
...@@ -15,7 +15,7 @@ export default Object.assign({}, mockData, { ...@@ -15,7 +15,7 @@ export default Object.assign({}, mockData, {
container_scanning: false, container_scanning: false,
dast: false, dast: false,
dependency_scanning: false, dependency_scanning: false,
license_management: true, license_management: false,
}, },
}); });
......
...@@ -32,7 +32,7 @@ describe MergeRequestWidgetEntity do ...@@ -32,7 +32,7 @@ describe MergeRequestWidgetEntity do
end end
def create_all_artifacts def create_all_artifacts
artifacts = %i(codequality license_management performance) artifacts = %i(codequality performance)
artifacts.each do |artifact_type| artifacts.each do |artifact_type|
create(:ee_ci_build, artifact_type, :success, pipeline: pipeline, project: pipeline.project) create(:ee_ci_build, artifact_type, :success, pipeline: pipeline, project: pipeline.project)
...@@ -95,7 +95,6 @@ describe MergeRequestWidgetEntity do ...@@ -95,7 +95,6 @@ describe MergeRequestWidgetEntity do
where(:json_entry, :artifact_type) do where(:json_entry, :artifact_type) do
:codeclimate | :codequality :codeclimate | :codequality
:license_management | :license_management
:performance | :performance :performance | :performance
end end
...@@ -149,12 +148,9 @@ describe MergeRequestWidgetEntity do ...@@ -149,12 +148,9 @@ describe MergeRequestWidgetEntity do
it 'is included' do it 'is included' do
expect(subject.as_json).to include(:license_management) 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(:managed_licenses_path)
expect(subject.as_json[:license_management]).to include(:can_manage_licenses) 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]).to include(:license_management_full_report_path)
expect(subject.as_json[:license_management][:head_path]).to include('proxy=true')
end end
context 'when feature is not licensed' do 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