Commit 83c4a463 authored by Fernando Arias's avatar Fernando Arias Committed by Mark Florian

Normalize to License Compliance nomenclature

Rename license_management directories to license_compliance

* Rename vue_shared directory
* Rename spec directory
* Rename import references

Rename project_licenses to license_compliance

* Rename project_licenses directory
* Move license_compliance dir under vue_share
* Update import referencesd

Rename PaginatedLicenseTable to LicenseScanning

* Search and replace and update imports and file names

Rename licenseManagement object

* Rename licenseManegement to licenseScanning
* In the MR widget pass in props from mr.licenseScanning

Fix jest unit tests

* Update import file paths

Fix karma tests

* Update mocked data

Run prettier to fix job failure

* Fixes static analysis job

Apply code review feedback

* Use null propagation operator in mr_widget_options.vue

Rename license_scanning component

* Rename to detected_licenses_table
parent 70b1b6cc
...@@ -2,19 +2,19 @@ ...@@ -2,19 +2,19 @@
import { mapActions, mapState, mapGetters } from 'vuex'; import { mapActions, mapState, mapGetters } from 'vuex';
import { GlEmptyState, GlLoadingIcon, GlLink, GlIcon, GlTab, GlTabs, GlBadge } from '@gitlab/ui'; import { GlEmptyState, GlLoadingIcon, GlLink, GlIcon, GlTab, GlTabs, GlBadge } from '@gitlab/ui';
import { LICENSE_LIST } from '../store/constants'; import { LICENSE_LIST } from '../store/constants';
import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_management/store/constants'; import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_compliance/store/constants';
import PaginatedLicensesTable from './paginated_licenses_table.vue'; import DetectedLicensesTable from './detected_licenses_table.vue';
import PipelineInfo from './pipeline_info.vue'; import PipelineInfo from './pipeline_info.vue';
import LicenseManagement from 'ee/vue_shared/license_management/license_management.vue'; import LicenseManagement from 'ee/vue_shared/license_compliance/license_management.vue';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
export default { export default {
name: 'ProjectLicensesApp', name: 'LicenseComplianceApp',
components: { components: {
GlEmptyState, GlEmptyState,
GlLoadingIcon, GlLoadingIcon,
GlLink, GlLink,
PaginatedLicensesTable, DetectedLicensesTable,
PipelineInfo, PipelineInfo,
GlIcon, GlIcon,
GlTab, GlTab,
...@@ -107,7 +107,7 @@ export default { ...@@ -107,7 +107,7 @@ export default {
<gl-badge pill>{{ licenseCount }}</gl-badge> <gl-badge pill>{{ licenseCount }}</gl-badge>
</template> </template>
<paginated-licenses-table /> <detected-licenses-table />
</gl-tab> </gl-tab>
<gl-tab> <gl-tab>
...@@ -122,7 +122,7 @@ export default { ...@@ -122,7 +122,7 @@ export default {
</template> </template>
<template v-else> <template v-else>
<paginated-licenses-table class="mt-3" /> <detected-licenses-table class="mt-3" />
</template> </template>
</div> </div>
</template> </template>
...@@ -5,7 +5,7 @@ import LicensesTable from './licenses_table.vue'; ...@@ -5,7 +5,7 @@ import LicensesTable from './licenses_table.vue';
import { LICENSE_LIST } from '../store/constants'; import { LICENSE_LIST } from '../store/constants';
export default { export default {
name: 'PaginatedLicensesTable', name: 'DetectedLicensesTable',
components: { components: {
LicensesTable, LicensesTable,
Pagination, Pagination,
......
import Vue from 'vue'; import Vue from 'vue';
import ProjectLicensesApp from './components/app.vue'; import LicenseComplianceApp from './components/app.vue';
import createStore from './store'; import createStore from './store';
import { LICENSE_LIST } from './store/constants'; import { LICENSE_LIST } from './store/constants';
...@@ -23,10 +23,10 @@ export default () => { ...@@ -23,10 +23,10 @@ export default () => {
el, el,
store, store,
components: { components: {
ProjectLicensesApp, LicenseComplianceApp,
}, },
render(createElement) { render(createElement) {
return createElement(ProjectLicensesApp, { return createElement(LicenseComplianceApp, {
props: { props: {
emptyStateSvgPath, emptyStateSvgPath,
documentationPath, documentationPath,
......
...@@ -2,9 +2,9 @@ import Vue from 'vue'; ...@@ -2,9 +2,9 @@ import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import listModule from './modules/list'; import listModule from './modules/list';
import { licenseManagementModule } from 'ee/vue_shared/license_management/store/index'; import { licenseManagementModule } from 'ee/vue_shared/license_compliance/store/index';
import { LICENSE_LIST } from './constants'; import { LICENSE_LIST } from './constants';
import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_management/store/constants'; import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_compliance/store/constants';
Vue.use(Vuex); Vue.use(Vuex);
......
import initProjectLicensesApp from 'ee/project_licenses'; import initLicenseComplianceApp from 'ee/license_compliance';
document.addEventListener('DOMContentLoaded', initProjectLicensesApp); document.addEventListener('DOMContentLoaded', initLicenseComplianceApp);
import Vue from 'vue'; import Vue from 'vue';
import LicenseReportApp from 'ee/vue_shared/license_management/mr_widget_license_report.vue'; import LicenseReportApp from 'ee/vue_shared/license_compliance/mr_widget_license_report.vue';
import Translate from '~/vue_shared/translate'; import Translate from '~/vue_shared/translate';
import { parseBoolean } from '~/lib/utils/common_utils'; import { parseBoolean } from '~/lib/utils/common_utils';
import { updateBadgeCount } from './utils'; import { updateBadgeCount } from './utils';
......
import Vue from 'vue'; import Vue from 'vue';
import LicenseManagement from 'ee/vue_shared/license_management/license_management.vue'; import LicenseManagement from 'ee/vue_shared/license_compliance/license_management.vue';
import createStore from 'ee/vue_shared/license_management/store/index'; import createStore from 'ee/vue_shared/license_compliance/store/index';
import ProtectedEnvironmentCreate from 'ee/protected_environments/protected_environment_create'; import ProtectedEnvironmentCreate from 'ee/protected_environments/protected_environment_create';
import ProtectedEnvironmentEditList from 'ee/protected_environments/protected_environment_edit_list'; import ProtectedEnvironmentEditList from 'ee/protected_environments/protected_environment_edit_list';
import showToast from '~/vue_shared/plugins/global_toast'; import showToast from '~/vue_shared/plugins/global_toast';
......
import PerformanceIssueBody from 'ee/vue_merge_request_widget/components/performance_issue_body.vue'; import PerformanceIssueBody from 'ee/vue_merge_request_widget/components/performance_issue_body.vue';
import CodequalityIssueBody from 'ee/vue_merge_request_widget/components/codequality_issue_body.vue'; import CodequalityIssueBody from 'ee/vue_merge_request_widget/components/codequality_issue_body.vue';
import BlockingMergeRequestsBody from 'ee/vue_merge_request_widget/components/blocking_merge_requests/blocking_merge_request_body.vue'; import BlockingMergeRequestsBody from 'ee/vue_merge_request_widget/components/blocking_merge_requests/blocking_merge_request_body.vue';
import LicenseIssueBody from 'ee/vue_shared/license_management/components/license_issue_body.vue'; import LicenseIssueBody from 'ee/vue_shared/license_compliance/components/license_issue_body.vue';
import SastIssueBody from 'ee/vue_shared/security_reports/components/sast_issue_body.vue'; import SastIssueBody from 'ee/vue_shared/security_reports/components/sast_issue_body.vue';
import ContainerScanningIssueBody from 'ee/vue_shared/security_reports/components/container_scanning_issue_body.vue'; import ContainerScanningIssueBody from 'ee/vue_shared/security_reports/components/container_scanning_issue_body.vue';
import DastIssueBody from 'ee/vue_shared/security_reports/components/dast_issue_body.vue'; import DastIssueBody from 'ee/vue_shared/security_reports/components/dast_issue_body.vue';
......
...@@ -4,7 +4,7 @@ import GroupedSecurityReportsApp from 'ee/vue_shared/security_reports/grouped_se ...@@ -4,7 +4,7 @@ import GroupedSecurityReportsApp from 'ee/vue_shared/security_reports/grouped_se
import GroupedMetricsReportsApp from 'ee/vue_shared/metrics_reports/grouped_metrics_reports_app.vue'; import GroupedMetricsReportsApp from 'ee/vue_shared/metrics_reports/grouped_metrics_reports_app.vue';
import reportsMixin from 'ee/vue_shared/security_reports/mixins/reports_mixin'; import reportsMixin from 'ee/vue_shared/security_reports/mixins/reports_mixin';
import { componentNames } from 'ee/reports/components/issue_body'; import { componentNames } from 'ee/reports/components/issue_body';
import MrWidgetLicenses from 'ee/vue_shared/license_management/mr_widget_license_report.vue'; import MrWidgetLicenses from 'ee/vue_shared/license_compliance/mr_widget_license_report.vue';
import ReportSection from '~/reports/components/report_section.vue'; import ReportSection from '~/reports/components/report_section.vue';
import BlockingMergeRequestsReport from './components/blocking_merge_requests/blocking_merge_requests_report.vue'; import BlockingMergeRequestsReport from './components/blocking_merge_requests/blocking_merge_requests_report.vue';
...@@ -161,7 +161,7 @@ export default { ...@@ -161,7 +161,7 @@ export default {
); );
}, },
licensesApiPath() { licensesApiPath() {
return (gl && gl.mrWidgetData && gl.mrWidgetData.license_management_comparison_path) || null; return gl?.mrWidgetData?.license_scanning_comparison_path || null;
}, },
}, },
watch: { watch: {
...@@ -331,12 +331,12 @@ export default { ...@@ -331,12 +331,12 @@ export default {
/> />
<mr-widget-licenses <mr-widget-licenses
v-if="shouldRenderLicenseReport" v-if="shouldRenderLicenseReport"
:api-url="mr.licenseManagement.managed_licenses_path" :api-url="mr.licenseScanning.managed_licenses_path"
:licenses-api-path="licensesApiPath" :licenses-api-path="licensesApiPath"
:pipeline-path="mr.pipeline.path" :pipeline-path="mr.pipeline.path"
:can-manage-licenses="mr.licenseManagement.can_manage_licenses" :can-manage-licenses="mr.licenseScanning.can_manage_licenses"
:full-report-path="mr.licenseManagement.license_management_full_report_path" :full-report-path="mr.licenseScanning.full_report_path"
:license-management-settings-path="mr.licenseManagement.license_management_settings_path" :license-management-settings-path="mr.licenseScanning.settings_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"
/> />
......
...@@ -29,7 +29,7 @@ export default class MergeRequestStore extends CEMergeRequestStore { ...@@ -29,7 +29,7 @@ export default class MergeRequestStore extends CEMergeRequestStore {
this.initCodeclimate(data); this.initCodeclimate(data);
this.initPerformanceReport(data); this.initPerformanceReport(data);
this.licenseManagement = data.license_management; this.licenseScanning = data.license_scanning;
this.metricsReportsPath = data.metrics_reports_path; this.metricsReportsPath = data.metrics_reports_path;
this.enabledReports = convertObjectPropsToCamelCase(data.enabled_reports); this.enabledReports = convertObjectPropsToCamelCase(data.enabled_reports);
......
<script> <script>
import { mapActions } from 'vuex'; import { mapActions } from 'vuex';
import { GlDropdown, GlDropdownItem, GlLoadingIcon } from '@gitlab/ui'; import { GlDropdown, GlDropdownItem, GlLoadingIcon } from '@gitlab/ui';
import { getIssueStatusFromLicenseStatus } from 'ee/vue_shared/license_management/store/utils'; import { getIssueStatusFromLicenseStatus } from 'ee/vue_shared/license_compliance/store/utils';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import IssueStatusIcon from '~/reports/components/issue_status_icon.vue'; import IssueStatusIcon from '~/reports/components/issue_status_icon.vue';
import { LICENSE_APPROVAL_STATUS, LICENSE_APPROVAL_ACTION } from '../constants'; import { LICENSE_APPROVAL_STATUS, LICENSE_APPROVAL_ACTION } from '../constants';
import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_management/store/constants'; import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_compliance/store/constants';
const visibleClass = 'visible'; const visibleClass = 'visible';
const invisibleClass = 'invisible'; const invisibleClass = 'invisible';
......
...@@ -4,7 +4,7 @@ import { mapActions, mapState } from 'vuex'; ...@@ -4,7 +4,7 @@ import { mapActions, mapState } from 'vuex';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
import DeprecatedModal2 from '~/vue_shared/components/deprecated_modal_2.vue'; import DeprecatedModal2 from '~/vue_shared/components/deprecated_modal_2.vue';
import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_management/store/constants'; import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_compliance/store/constants';
export default { export default {
name: 'LicenseDeleteConfirmationModal', name: 'LicenseDeleteConfirmationModal',
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { mapActions } from 'vuex'; import { mapActions } from 'vuex';
import LicensePackages from './license_packages.vue'; import LicensePackages from './license_packages.vue';
import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_management/store/constants'; import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_compliance/store/constants';
export default { export default {
name: 'LicenseIssueBody', name: 'LicenseIssueBody',
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { import {
getIssueStatusFromLicenseStatus, getIssueStatusFromLicenseStatus,
getStatusTranslationsFromLicenseStatus, getStatusTranslationsFromLicenseStatus,
} from 'ee/vue_shared/license_management/store/utils'; } from 'ee/vue_shared/license_compliance/store/utils';
import IssueStatusIcon from '~/reports/components/issue_status_icon.vue'; import IssueStatusIcon from '~/reports/components/issue_status_icon.vue';
export default { export default {
......
...@@ -5,7 +5,7 @@ import { s__ } from '~/locale'; ...@@ -5,7 +5,7 @@ import { s__ } from '~/locale';
import DeprecatedModal2 from '~/vue_shared/components/deprecated_modal_2.vue'; import DeprecatedModal2 from '~/vue_shared/components/deprecated_modal_2.vue';
import LicensePackages from './license_packages.vue'; import LicensePackages from './license_packages.vue';
import { LICENSE_APPROVAL_STATUS } from '../constants'; import { LICENSE_APPROVAL_STATUS } from '../constants';
import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_management/store/constants'; import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_compliance/store/constants';
export default { export default {
name: 'LicenseSetApprovalStatusModal', name: 'LicenseSetApprovalStatusModal',
......
...@@ -8,7 +8,7 @@ import LicenseManagementRow from './components/license_management_row.vue'; ...@@ -8,7 +8,7 @@ import LicenseManagementRow from './components/license_management_row.vue';
import DeleteConfirmationModal from './components/delete_confirmation_modal.vue'; import DeleteConfirmationModal from './components/delete_confirmation_modal.vue';
import PaginatedList from '~/vue_shared/components/paginated_list.vue'; import PaginatedList from '~/vue_shared/components/paginated_list.vue';
import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_management/store/constants'; import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_compliance/store/constants';
export default { export default {
name: 'LicenseManagement', name: 'LicenseManagement',
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
import { mapState, mapGetters, mapActions } from 'vuex'; import { mapState, mapGetters, mapActions } from 'vuex';
import { GlLink } from '@gitlab/ui'; import { GlLink } from '@gitlab/ui';
import reportsMixin from 'ee/vue_shared/security_reports/mixins/reports_mixin'; import reportsMixin from 'ee/vue_shared/security_reports/mixins/reports_mixin';
import SetLicenseApprovalModal from 'ee/vue_shared/license_management/components/set_approval_status_modal.vue'; import SetLicenseApprovalModal from 'ee/vue_shared/license_compliance/components/set_approval_status_modal.vue';
import { componentNames } from 'ee/reports/components/issue_body'; import { componentNames } from 'ee/reports/components/issue_body';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import ReportSection from '~/reports/components/report_section.vue'; import ReportSection from '~/reports/components/report_section.vue';
import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_management/store/constants'; import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_compliance/store/constants';
import createStore from './store'; import createStore from './store';
......
import { LICENSE_APPROVAL_STATUS } from 'ee/vue_shared/license_management/constants'; import { LICENSE_APPROVAL_STATUS } from 'ee/vue_shared/license_compliance/constants';
import { s__, n__, sprintf } from '~/locale'; import { s__, n__, sprintf } from '~/locale';
import { STATUS_FAILED, STATUS_NEUTRAL, STATUS_SUCCESS } from '~/reports/constants'; import { STATUS_FAILED, STATUS_NEUTRAL, STATUS_SUCCESS } from '~/reports/constants';
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
window.gl.mrWidgetData.approvals_help_path = '#{help_page_path("user/project/merge_requests/merge_request_approvals")}'; window.gl.mrWidgetData.approvals_help_path = '#{help_page_path("user/project/merge_requests/merge_request_approvals")}';
window.gl.mrWidgetData.codequality_help_path = '#{help_page_path("user/project/merge_requests/code_quality", anchor: "code-quality-reports")}'; window.gl.mrWidgetData.codequality_help_path = '#{help_page_path("user/project/merge_requests/code_quality", anchor: "code-quality-reports")}';
window.gl.mrWidgetData.visual_review_app_available = '#{@project.feature_available?(:visual_review_app)}' === 'true'; window.gl.mrWidgetData.visual_review_app_available = '#{@project.feature_available?(:visual_review_app)}' === 'true';
window.gl.mrWidgetData.license_management_comparison_path = '#{license_management_reports_project_merge_request_path(@project, @merge_request) if @project.feature_available?(:license_management)}' window.gl.mrWidgetData.license_scanning_comparison_path = '#{license_management_reports_project_merge_request_path(@project, @merge_request) if @project.feature_available?(:license_management)}'
window.gl.mrWidgetData.container_scanning_comparison_path = '#{container_scanning_reports_project_merge_request_path(@project, @merge_request) if @project.feature_available?(:container_scanning)}' window.gl.mrWidgetData.container_scanning_comparison_path = '#{container_scanning_reports_project_merge_request_path(@project, @merge_request) if @project.feature_available?(:container_scanning)}'
window.gl.mrWidgetData.dependency_scanning_comparison_path = '#{dependency_scanning_reports_project_merge_request_path(@project, @merge_request) if @project.feature_available?(:dependency_scanning)}' window.gl.mrWidgetData.dependency_scanning_comparison_path = '#{dependency_scanning_reports_project_merge_request_path(@project, @merge_request) if @project.feature_available?(:dependency_scanning)}'
window.gl.mrWidgetData.sast_comparison_path = '#{sast_reports_project_merge_request_path(@project, @merge_request) if @project.feature_available?(:sast)}' window.gl.mrWidgetData.sast_comparison_path = '#{sast_reports_project_merge_request_path(@project, @merge_request) if @project.feature_available?(:sast)}'
......
...@@ -5,16 +5,19 @@ import Vuex from 'vuex'; ...@@ -5,16 +5,19 @@ import Vuex from 'vuex';
import { GlEmptyState, GlLoadingIcon, GlTab, GlTabs } from '@gitlab/ui'; import { GlEmptyState, GlLoadingIcon, GlTab, GlTabs } from '@gitlab/ui';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import { REPORT_STATUS } from 'ee/project_licenses/store/modules/list/constants'; import { REPORT_STATUS } from 'ee/license_compliance/store/modules/list/constants';
import ProjectLicensesApp from 'ee/project_licenses/components/app.vue'; import LicenseComplianceApp from 'ee/license_compliance/components/app.vue';
import PaginatedLicensesTable from 'ee/project_licenses/components/paginated_licenses_table.vue'; import DetectedLicensesTable from 'ee/license_compliance/components/detected_licenses_table.vue';
import PipelineInfo from 'ee/project_licenses/components/pipeline_info.vue'; import PipelineInfo from 'ee/license_compliance/components/pipeline_info.vue';
import LicenseManagement from 'ee/vue_shared/license_management/license_management.vue'; import LicenseManagement from 'ee/vue_shared/license_compliance/license_management.vue';
import * as getters from 'ee/project_licenses/store/modules/list/getters'; import * as getters from 'ee/license_compliance/store/modules/list/getters';
import { approvedLicense, blacklistedLicense } from 'ee_jest/license_management/mock_data'; import {
approvedLicense,
blacklistedLicense,
} from 'ee_jest/vue_shared/license_compliance/mock_data';
Vue.use(Vuex); Vue.use(Vuex);
...@@ -55,7 +58,7 @@ const createComponent = ({ state, props, options }) => { ...@@ -55,7 +58,7 @@ const createComponent = ({ state, props, options }) => {
}, },
}); });
wrapper = shallowMount(ProjectLicensesApp, { wrapper = shallowMount(LicenseComplianceApp, {
propsData: { propsData: {
emptyStateSvgPath, emptyStateSvgPath,
documentationPath, documentationPath,
...@@ -89,7 +92,7 @@ describe('Project Licenses', () => { ...@@ -89,7 +92,7 @@ describe('Project Licenses', () => {
}); });
it('does not show the list of detected in project licenses', () => { it('does not show the list of detected in project licenses', () => {
expect(wrapper.find(PaginatedLicensesTable).exists()).toBe(false); expect(wrapper.find(DetectedLicensesTable).exists()).toBe(false);
}); });
it('does not show the list of license policies', () => { it('does not show the list of license policies', () => {
...@@ -125,7 +128,7 @@ describe('Project Licenses', () => { ...@@ -125,7 +128,7 @@ describe('Project Licenses', () => {
}); });
it('does not show the list of detected in project licenses', () => { it('does not show the list of detected in project licenses', () => {
expect(wrapper.find(PaginatedLicensesTable).exists()).toBe(false); expect(wrapper.find(DetectedLicensesTable).exists()).toBe(false);
}); });
it('does not show the list of license policies', () => { it('does not show the list of license policies', () => {
...@@ -164,7 +167,7 @@ describe('Project Licenses', () => { ...@@ -164,7 +167,7 @@ describe('Project Licenses', () => {
}); });
it('it renders the "Detected in project" table', () => { it('it renders the "Detected in project" table', () => {
expect(wrapper.find(PaginatedLicensesTable).exists()).toBe(true); expect(wrapper.find(DetectedLicensesTable).exists()).toBe(true);
}); });
it('it renders the "Policies" table', () => { it('it renders the "Policies" table', () => {
...@@ -196,7 +199,7 @@ describe('Project Licenses', () => { ...@@ -196,7 +199,7 @@ describe('Project Licenses', () => {
}); });
it('only renders the "Detected in project" table', () => { it('only renders the "Detected in project" table', () => {
expect(wrapper.find(PaginatedLicensesTable).exists()).toBe(true); expect(wrapper.find(DetectedLicensesTable).exists()).toBe(true);
expect(wrapper.find(LicenseManagement).exists()).toBe(false); expect(wrapper.find(LicenseManagement).exists()).toBe(false);
}); });
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import createStore from 'ee/project_licenses/store'; import createStore from 'ee/license_compliance/store';
import LicensesTable from 'ee/project_licenses/components/licenses_table.vue'; import LicensesTable from 'ee/license_compliance/components/licenses_table.vue';
import { toLicenseObject } from 'ee/project_licenses/utils/mappers'; import { toLicenseObject } from 'ee/license_compliance/utils/mappers';
import { LICENSE_LIST } from 'ee/project_licenses/store/constants'; import { LICENSE_LIST } from 'ee/license_compliance/store/constants';
import PaginatedLicensesTable from 'ee/project_licenses/components/paginated_licenses_table.vue'; import DetectedLicensesTable from 'ee/license_compliance/components/detected_licenses_table.vue';
import Pagination from '~/vue_shared/components/pagination_links.vue'; import Pagination from '~/vue_shared/components/pagination_links.vue';
import mockLicensesResponse from '../store/modules/list/data/mock_licenses.json'; import mockLicensesResponse from '../store/modules/list/data/mock_licenses.json';
jest.mock('lodash/uniqueId', () => () => 'fakeUniqueId'); jest.mock('lodash/uniqueId', () => () => 'fakeUniqueId');
describe('PaginatedLicensesTable component', () => { describe('DetectedLicenesTable component', () => {
const namespace = LICENSE_LIST; const namespace = LICENSE_LIST;
let store; let store;
...@@ -18,7 +18,7 @@ describe('PaginatedLicensesTable component', () => { ...@@ -18,7 +18,7 @@ describe('PaginatedLicensesTable component', () => {
const factory = () => { const factory = () => {
store = createStore(); store = createStore();
wrapper = shallowMount(PaginatedLicensesTable, { wrapper = shallowMount(DetectedLicensesTable, {
store, store,
}); });
}; };
......
...@@ -3,7 +3,7 @@ import { GlModal, GlLink, GlIntersperse } from '@gitlab/ui'; ...@@ -3,7 +3,7 @@ import { GlModal, GlLink, GlIntersperse } from '@gitlab/ui';
import LicenseComponentLinks, { import LicenseComponentLinks, {
VISIBLE_COMPONENT_COUNT, VISIBLE_COMPONENT_COUNT,
} from 'ee/project_licenses/components/license_component_links.vue'; } from 'ee/license_compliance/components/license_component_links.vue';
describe('LicenseComponentLinks component', () => { describe('LicenseComponentLinks component', () => {
// data helpers // data helpers
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { GlLink, GlSkeletonLoading } from '@gitlab/ui'; import { GlLink, GlSkeletonLoading } from '@gitlab/ui';
import LicenseComponentLinks from 'ee/project_licenses/components/license_component_links.vue'; import LicenseComponentLinks from 'ee/license_compliance/components/license_component_links.vue';
import LicensesTableRow from 'ee/project_licenses/components/licenses_table_row.vue'; import LicensesTableRow from 'ee/license_compliance/components/licenses_table_row.vue';
import { makeLicense } from './utils'; import { makeLicense } from './utils';
describe('LicensesTableRow component', () => { describe('LicensesTableRow component', () => {
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import LicensesTable from 'ee/project_licenses/components/licenses_table.vue'; import LicensesTable from 'ee/license_compliance/components/licenses_table.vue';
import LicensesTableRow from 'ee/project_licenses/components/licenses_table_row.vue'; import LicensesTableRow from 'ee/license_compliance/components/licenses_table_row.vue';
import { makeLicense } from './utils'; import { makeLicense } from './utils';
describe('LicensesTable component', () => { describe('LicensesTable component', () => {
......
...@@ -2,11 +2,11 @@ import axios from 'axios'; ...@@ -2,11 +2,11 @@ import axios from 'axios';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import * as actions from 'ee/project_licenses/store/modules/list/actions'; import * as actions from 'ee/license_compliance/store/modules/list/actions';
import * as types from 'ee/project_licenses/store/modules/list/mutation_types'; import * as types from 'ee/license_compliance/store/modules/list/mutation_types';
import getInitialState from 'ee/project_licenses/store/modules/list/state'; import getInitialState from 'ee/license_compliance/store/modules/list/state';
import { FETCH_ERROR_MESSAGE } from 'ee/project_licenses/store/modules/list/constants'; import { FETCH_ERROR_MESSAGE } from 'ee/license_compliance/store/modules/list/constants';
import createFlash from '~/flash'; import createFlash from '~/flash';
import mockLicensesResponse from './data/mock_licenses.json'; import mockLicensesResponse from './data/mock_licenses.json';
......
import * as getters from 'ee/project_licenses/store/modules/list/getters'; import * as getters from 'ee/license_compliance/store/modules/list/getters';
import { REPORT_STATUS } from 'ee/project_licenses/store/modules/list/constants'; import { REPORT_STATUS } from 'ee/license_compliance/store/modules/list/constants';
describe('Licenses getters', () => { describe('Licenses getters', () => {
describe.each` describe.each`
......
import * as types from 'ee/project_licenses/store/modules/list/mutation_types'; import * as types from 'ee/license_compliance/store/modules/list/mutation_types';
import mutations from 'ee/project_licenses/store/modules/list/mutations'; import mutations from 'ee/license_compliance/store/modules/list/mutations';
import { toLicenseObject } from 'ee/project_licenses/utils/mappers'; import { toLicenseObject } from 'ee/license_compliance/utils/mappers';
import getInitialState from 'ee/project_licenses/store/modules/list/state'; import getInitialState from 'ee/license_compliance/store/modules/list/state';
import { REPORT_STATUS } from 'ee/project_licenses/store/modules/list/constants'; import { REPORT_STATUS } from 'ee/license_compliance/store/modules/list/constants';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
describe('Licenses mutations', () => { describe('Licenses mutations', () => {
......
import { toLicenseObject } from 'ee/project_licenses/utils/mappers'; import { toLicenseObject } from 'ee/license_compliance/utils/mappers';
const UNIQUE_ID = 'fakeUniqueId'; const UNIQUE_ID = 'fakeUniqueId';
jest.mock('lodash/uniqueId', () => () => 'fakeUniqueId'); jest.mock('lodash/uniqueId', () => () => 'fakeUniqueId');
describe('ee/project_licenses/utils/mappers', () => { describe('ee/license_compliance/utils/mappers', () => {
describe('toLicenseObject', () => { describe('toLicenseObject', () => {
describe.each` describe.each`
input | key input | key
......
import Vue from 'vue'; import Vue from 'vue';
import $ from 'jquery'; import $ from 'jquery';
import Dropdown from 'ee/vue_shared/license_management/components/add_license_form_dropdown.vue'; import Dropdown from 'ee/vue_shared/license_compliance/components/add_license_form_dropdown.vue';
import { KNOWN_LICENSES } from 'ee/vue_shared/license_management/constants'; import { KNOWN_LICENSES } from 'ee/vue_shared/license_compliance/constants';
import mountComponent from 'helpers/vue_mount_component_helper'; import mountComponent from 'helpers/vue_mount_component_helper';
describe('AddLicenseFormDropdown', () => { describe('AddLicenseFormDropdown', () => {
......
import Vue from 'vue'; import Vue from 'vue';
import LicenseIssueBody from 'ee/vue_shared/license_management/components/add_license_form.vue'; import LicenseIssueBody from 'ee/vue_shared/license_compliance/components/add_license_form.vue';
import mountComponent from 'helpers/vue_mount_component_helper'; import mountComponent from 'helpers/vue_mount_component_helper';
import { LICENSE_APPROVAL_STATUS } from 'ee/vue_shared/license_management/constants'; import { LICENSE_APPROVAL_STATUS } from 'ee/vue_shared/license_compliance/constants';
describe('AddLicenseForm', () => { describe('AddLicenseForm', () => {
const Component = Vue.extend(LicenseIssueBody); const Component = Vue.extend(LicenseIssueBody);
......
import Vue from 'vue'; import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import AdminLicenseManagementRow from 'ee/vue_shared/license_management/components/admin_license_management_row.vue'; import AdminLicenseManagementRow from 'ee/vue_shared/license_compliance/components/admin_license_management_row.vue';
import { LICENSE_APPROVAL_STATUS } from 'ee/vue_shared/license_management/constants'; import { LICENSE_APPROVAL_STATUS } from 'ee/vue_shared/license_compliance/constants';
import { mountComponentWithStore } from 'helpers/vue_mount_component_helper'; import { mountComponentWithStore } from 'helpers/vue_mount_component_helper';
import { approvedLicense } from '../mock_data'; import { approvedLicense } from '../mock_data';
......
import Vue from 'vue'; import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import DeleteConfirmationModal from 'ee/vue_shared/license_management/components/delete_confirmation_modal.vue'; import DeleteConfirmationModal from 'ee/vue_shared/license_compliance/components/delete_confirmation_modal.vue';
import { trimText } from 'helpers/text_helper'; import { trimText } from 'helpers/text_helper';
import { mountComponentWithStore } from 'helpers/vue_mount_component_helper'; import { mountComponentWithStore } from 'helpers/vue_mount_component_helper';
import { approvedLicense } from '../mock_data'; import { approvedLicense } from '../mock_data';
......
import Vue from 'vue'; import Vue from 'vue';
import LicenseIssueBody from 'ee/vue_shared/license_management/components/license_issue_body.vue'; import LicenseIssueBody from 'ee/vue_shared/license_compliance/components/license_issue_body.vue';
import { trimText } from 'helpers/text_helper'; import { trimText } from 'helpers/text_helper';
import { mountComponentWithStore } from 'helpers/vue_mount_component_helper'; import { mountComponentWithStore } from 'helpers/vue_mount_component_helper';
import createStore from 'ee/vue_shared/license_management/store'; import createStore from 'ee/vue_shared/license_compliance/store';
import { licenseReport } from '../mock_data'; import { licenseReport } from '../mock_data';
describe('LicenseIssueBody', () => { describe('LicenseIssueBody', () => {
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import LicenseManagementRow from 'ee/vue_shared/license_management/components/license_management_row.vue'; import LicenseManagementRow from 'ee/vue_shared/license_compliance/components/license_management_row.vue';
import { approvedLicense, blacklistedLicense } from 'ee_jest/license_management/mock_data'; import {
approvedLicense,
blacklistedLicense,
} from 'ee_jest/vue_shared/license_compliance/mock_data';
let wrapper; let wrapper;
......
import Vue from 'vue'; import Vue from 'vue';
import LicensePackages from 'ee/vue_shared/license_management/components/license_packages.vue'; import LicensePackages from 'ee/vue_shared/license_compliance/components/license_packages.vue';
import mountComponent from 'helpers/vue_mount_component_helper'; import mountComponent from 'helpers/vue_mount_component_helper';
import { licenseReport } from '../mock_data'; import { licenseReport } from '../mock_data';
......
import Vue from 'vue'; import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import SetApprovalModal from 'ee/vue_shared/license_management/components/set_approval_status_modal.vue'; import SetApprovalModal from 'ee/vue_shared/license_compliance/components/set_approval_status_modal.vue';
import { LICENSE_APPROVAL_STATUS } from 'ee/vue_shared/license_management/constants'; import { LICENSE_APPROVAL_STATUS } from 'ee/vue_shared/license_compliance/constants';
import { trimText } from 'helpers/text_helper'; import { trimText } from 'helpers/text_helper';
import { mountComponentWithStore } from 'helpers/vue_mount_component_helper'; import { mountComponentWithStore } from 'helpers/vue_mount_component_helper';
import { licenseReport } from '../mock_data'; import { licenseReport } from '../mock_data';
......
...@@ -2,11 +2,11 @@ import { shallowMount } from '@vue/test-utils'; ...@@ -2,11 +2,11 @@ import { shallowMount } from '@vue/test-utils';
import { GlButton, GlLoadingIcon } from '@gitlab/ui'; import { GlButton, GlLoadingIcon } from '@gitlab/ui';
import Vue from 'vue'; import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import LicenseManagement from 'ee/vue_shared/license_management/license_management.vue'; import LicenseManagement from 'ee/vue_shared/license_compliance/license_management.vue';
import AdminLicenseManagementRow from 'ee/vue_shared/license_management/components/admin_license_management_row.vue'; import AdminLicenseManagementRow from 'ee/vue_shared/license_compliance/components/admin_license_management_row.vue';
import LicenseManagementRow from 'ee/vue_shared/license_management/components/license_management_row.vue'; import LicenseManagementRow from 'ee/vue_shared/license_compliance/components/license_management_row.vue';
import AddLicenseForm from 'ee/vue_shared/license_management/components/add_license_form.vue'; import AddLicenseForm from 'ee/vue_shared/license_compliance/components/add_license_form.vue';
import DeleteConfirmationModal from 'ee/vue_shared/license_management/components/delete_confirmation_modal.vue'; import DeleteConfirmationModal from 'ee/vue_shared/license_compliance/components/delete_confirmation_modal.vue';
import { approvedLicense, blacklistedLicense } from './mock_data'; import { approvedLicense, blacklistedLicense } from './mock_data';
Vue.use(Vuex); Vue.use(Vuex);
......
import { LICENSE_APPROVAL_STATUS } from 'ee/vue_shared/license_management/constants'; import { LICENSE_APPROVAL_STATUS } from 'ee/vue_shared/license_compliance/constants';
export const approvedLicense = { export const approvedLicense = {
id: 5, id: 5,
......
import Vue from 'vue'; import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import LicenseManagement from 'ee/vue_shared/license_management/mr_widget_license_report.vue'; import LicenseManagement from 'ee/vue_shared/license_compliance/mr_widget_license_report.vue';
import { LOADING, ERROR, SUCCESS } from 'ee/vue_shared/security_reports/store/constants'; import { LOADING, ERROR, SUCCESS } from 'ee/vue_shared/security_reports/store/constants';
import { mountComponentWithStore } from 'helpers/vue_mount_component_helper'; import { mountComponentWithStore } from 'helpers/vue_mount_component_helper';
import { TEST_HOST } from 'spec/test_constants'; import { TEST_HOST } from 'spec/test_constants';
......
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import * as actions from 'ee/vue_shared/license_management/store/actions'; import * as actions from 'ee/vue_shared/license_compliance/store/actions';
import * as mutationTypes from 'ee/vue_shared/license_management/store/mutation_types'; import * as mutationTypes from 'ee/vue_shared/license_compliance/store/mutation_types';
import createState from 'ee/vue_shared/license_management/store/state'; import createState from 'ee/vue_shared/license_compliance/store/state';
import { LICENSE_APPROVAL_STATUS } from 'ee/vue_shared/license_management/constants'; import { LICENSE_APPROVAL_STATUS } from 'ee/vue_shared/license_compliance/constants';
import { TEST_HOST } from 'spec/test_constants'; import { TEST_HOST } from 'spec/test_constants';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import { approvedLicense, blacklistedLicense } from '../mock_data'; import { approvedLicense, blacklistedLicense } from '../mock_data';
......
import createState from 'ee/vue_shared/license_management/store/state'; import createState from 'ee/vue_shared/license_compliance/store/state';
import * as getters from 'ee/vue_shared/license_management/store/getters'; import * as getters from 'ee/vue_shared/license_compliance/store/getters';
import { licenseReport as licenseReportMock } from '../mock_data'; import { licenseReport as licenseReportMock } from '../mock_data';
......
import createStore from 'ee/vue_shared/license_management/store'; import createStore from 'ee/vue_shared/license_compliance/store';
import * as types from 'ee/vue_shared/license_management/store/mutation_types'; import * as types from 'ee/vue_shared/license_compliance/store/mutation_types';
import { LICENSE_APPROVAL_STATUS } from 'ee/vue_shared/license_management/constants'; import { LICENSE_APPROVAL_STATUS } from 'ee/vue_shared/license_compliance/constants';
import { TEST_HOST } from 'spec/test_constants'; import { TEST_HOST } from 'spec/test_constants';
import { approvedLicense } from '../mock_data'; import { approvedLicense } from '../mock_data';
......
...@@ -4,8 +4,8 @@ import { ...@@ -4,8 +4,8 @@ import {
getStatusTranslationsFromLicenseStatus, getStatusTranslationsFromLicenseStatus,
getIssueStatusFromLicenseStatus, getIssueStatusFromLicenseStatus,
convertToOldReportFormat, convertToOldReportFormat,
} from 'ee/vue_shared/license_management/store/utils'; } from 'ee/vue_shared/license_compliance/store/utils';
import { LICENSE_APPROVAL_STATUS } from 'ee/vue_shared/license_management/constants'; import { LICENSE_APPROVAL_STATUS } from 'ee/vue_shared/license_compliance/constants';
import { licenseReport } from '../mock_data'; import { licenseReport } from '../mock_data';
import { STATUS_FAILED, STATUS_NEUTRAL, STATUS_SUCCESS } from '~/reports/constants'; import { STATUS_FAILED, STATUS_NEUTRAL, STATUS_SUCCESS } from '~/reports/constants';
......
...@@ -789,7 +789,7 @@ describe('ee merge request widget options', () => { ...@@ -789,7 +789,7 @@ describe('ee merge request widget options', () => {
enabled_reports: { enabled_reports: {
license_management: true, license_management: true,
}, },
license_management: { license_scanning: {
managed_licenses_path: licenseManagementApiUrl, managed_licenses_path: licenseManagementApiUrl,
can_manage_licenses: false, can_manage_licenses: false,
}, },
...@@ -1114,7 +1114,7 @@ describe('ee merge request widget options', () => { ...@@ -1114,7 +1114,7 @@ describe('ee merge request widget options', () => {
if (noSecurityReportsEnabled?.license_management) { if (noSecurityReportsEnabled?.license_management) {
// Provide license report config if it's going to be rendered // Provide license report config if it's going to be rendered
gl.mrWidgetData.license_management = { gl.mrWidgetData.license_scanning = {
managed_licenses_path: `${TEST_HOST}/manage_license_api`, managed_licenses_path: `${TEST_HOST}/manage_license_api`,
can_manage_licenses: false, can_manage_licenses: false,
}; };
......
...@@ -15,13 +15,13 @@ module QA ...@@ -15,13 +15,13 @@ module QA
element :icon_status, ':data-qa-selector="`status_${status}_icon`" ' # rubocop:disable QA/ElementWithPattern element :icon_status, ':data-qa-selector="`status_${status}_icon`" ' # rubocop:disable QA/ElementWithPattern
end end
view 'ee/app/assets/javascripts/vue_shared/license_management/components/set_approval_status_modal.vue' do view 'ee/app/assets/javascripts/vue_shared/license_compliance/components/set_approval_status_modal.vue' do
element :license_management_modal element :license_management_modal
element :approve_license_button element :approve_license_button
element :blacklist_license_button element :blacklist_license_button
end end
view 'ee/app/assets/javascripts/vue_shared/license_management/mr_widget_license_report.vue' do view 'ee/app/assets/javascripts/vue_shared/license_compliance/mr_widget_license_report.vue' do
element :license_report_widget element :license_report_widget
end end
end end
......
...@@ -7,20 +7,20 @@ module QA::EE ...@@ -7,20 +7,20 @@ module QA::EE
class LicenseCompliance < QA::Page::Base class LicenseCompliance < QA::Page::Base
include QA::Page::Component::Select2 # Select2 is an external library, so we can't add our own selectors include QA::Page::Component::Select2 # Select2 is an external library, so we can't add our own selectors
view 'ee/app/assets/javascripts/vue_shared/license_management/license_management.vue' do view 'ee/app/assets/javascripts/vue_shared/license_compliance/license_management.vue' do
element :license_add_button element :license_add_button
end end
view 'ee/app/assets/javascripts/vue_shared/license_management/components/add_license_form.vue' do view 'ee/app/assets/javascripts/vue_shared/license_compliance/components/add_license_form.vue' do
element :license_radio, 'data-qa-selector="`${option.value}_license_radio`"' # rubocop:disable QA/ElementWithPattern element :license_radio, 'data-qa-selector="`${option.value}_license_radio`"' # rubocop:disable QA/ElementWithPattern
element :add_license_submit_button element :add_license_submit_button
end end
view 'ee/app/assets/javascripts/vue_shared/license_management/license_management.vue' do view 'ee/app/assets/javascripts/vue_shared/license_compliance/license_management.vue' do
element :license_compliance_list element :license_compliance_list
end end
view 'ee/app/assets/javascripts/vue_shared/license_management/components/admin_license_management_row.vue' do view 'ee/app/assets/javascripts/vue_shared/license_compliance/components/admin_license_management_row.vue' do
element :admin_license_compliance_row element :admin_license_compliance_row
element :license_name_content element :license_name_content
end end
......
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