Commit 908b60b5 authored by Savas Vedova's avatar Savas Vedova

Merge branch 'Remove-license-compliance-feature-flag-reference' into 'master'

Remove license compliance feature flag reference

See merge request gitlab-org/gitlab!74143
parents 036a22f3 efc06841
...@@ -58,9 +58,6 @@ export default { ...@@ -58,9 +58,6 @@ export default {
submitDisabled() { submitDisabled() {
return this.isInvalidLicense || this.licenseName.trim() === '' || this.approvalStatus === ''; return this.isInvalidLicense || this.licenseName.trim() === '' || this.approvalStatus === '';
}, },
isDescriptionEnabled() {
return Boolean(this.glFeatures.licenseComplianceDeniesMr);
},
}, },
methods: { methods: {
addLicense() { addLicense() {
...@@ -99,10 +96,10 @@ export default { ...@@ -99,10 +96,10 @@ export default {
:value="option.value" :value="option.value"
:data-qa-selector="`${option.value}_license_radio`" :data-qa-selector="`${option.value}_license_radio`"
:aria-describedby="`js-${option.value}-license-radio`" :aria-describedby="`js-${option.value}-license-radio`"
:class="{ 'mb-3': isDescriptionEnabled }" class="gl-mb-3"
> >
{{ option.label }} {{ option.label }}
<div v-if="isDescriptionEnabled" class="text-secondary"> <div class="text-secondary">
{{ option.description }} {{ option.description }}
</div> </div>
</gl-form-radio> </gl-form-radio>
......
...@@ -46,9 +46,6 @@ export default { ...@@ -46,9 +46,6 @@ export default {
showLoadingSpinner() { showLoadingSpinner() {
return this.isLoadingManagedLicenses && !this.hasPendingLicenses; return this.isLoadingManagedLicenses && !this.hasPendingLicenses;
}, },
isTooltipEnabled() {
return Boolean(this.glFeatures.licenseComplianceDeniesMr);
},
}, },
watch: { watch: {
isAddingNewLicense(isAddingNewLicense) { isAddingNewLicense(isAddingNewLicense) {
...@@ -104,36 +101,34 @@ export default { ...@@ -104,36 +101,34 @@ export default {
</div> </div>
<template v-else> <template v-else>
<div class="table-section gl-d-flex gl-pl-2 section-70" role="rowheader"> <div class="table-section gl-display-flex gl-pl-2 section-70" role="rowheader">
{{ s__('Licenses|Policy') }} {{ s__('Licenses|Policy') }}
<template v-if="isTooltipEnabled"> <gl-icon
<gl-icon ref="reportInfo"
ref="reportInfo" name="question"
name="question" class="text-info gl-ml-2 gl-cursor-pointer"
class="text-info gl-ml-1 gl-cursor-pointer" :aria-label="__('help')"
:aria-label="__('help')" :size="14"
:size="14" />
/> <gl-popover
<gl-popover :target="() => $refs.reportInfo.$el"
:target="() => $refs.reportInfo.$el" placement="bottom"
placement="bottom" triggers="click blur"
triggers="click blur" :css-classes="['gl-mt-3']"
:css-classes="['gl-mt-3']" >
<div class="h5">{{ __('Allowed') }}</div>
<span class="text-secondary">
{{ s__('Licenses|Acceptable license to be used in the project') }}</span
>
<div class="h5">{{ __('Denied') }}</div>
<span class="text-secondary">
{{
s__(
"Licenses|Unacceptable license, if detected it will disallow a merge request until it's removed",
)
}}</span
> >
<div class="h5">{{ __('Allowed') }}</div> </gl-popover>
<span class="text-secondary">
{{ s__('Licenses|Acceptable license to be used in the project') }}</span
>
<div class="h5">{{ __('Denied') }}</div>
<span class="text-secondary">
{{
s__(
'Licenses|Disallow Merge request if detected and will instruct the developer to remove',
)
}}</span
>
</gl-popover>
</template>
</div> </div>
<div class="table-section section-30" role="rowheader"> <div class="table-section section-30" role="rowheader">
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`AddLicenseForm template does not show radio button descriptions, if licenseComplianceDeniesMr feature flag is disabled 1`] = `
<gl-form-radio-stub
aria-describedby="js-approved-license-radio"
class=""
data-qa-selector="approved_license_radio"
value="approved"
>
Allow
<!---->
</gl-form-radio-stub>
`;
exports[`AddLicenseForm template does not show radio button descriptions, if licenseComplianceDeniesMr feature flag is disabled 2`] = `
<gl-form-radio-stub
aria-describedby="js-blacklisted-license-radio"
class=""
data-qa-selector="blacklisted_license_radio"
value="blacklisted"
>
Deny
<!---->
</gl-form-radio-stub>
`;
...@@ -103,12 +103,25 @@ describe('AddLicenseForm', () => { ...@@ -103,12 +103,25 @@ describe('AddLicenseForm', () => {
expect(dropdownElement.exists()).toBe(true); expect(dropdownElement.exists()).toBe(true);
}); });
it('renders the license approval radio buttons dropdown', () => { describe('license approval radio list', () => {
const approvalOptions = findRadioInputs(); it('renders the correct approval options', () => {
const approvalOptions = findRadioInputs();
expect(approvalOptions).toHaveLength(2); expect(approvalOptions).toHaveLength(2);
expect(approvalOptions.at(0).text()).toBe('Allow'); expect(approvalOptions.at(0).text()).toContain('Allow');
expect(approvalOptions.at(1).text()).toBe('Deny'); expect(approvalOptions.at(1).text()).toContain('Deny');
});
it('renders the approval option descriptions', () => {
const approvalOptions = findRadioInputs();
expect(approvalOptions.at(0).text()).toContain(
'Acceptable license to be used in the project',
);
expect(approvalOptions.at(1).text()).toContain(
'Disallow merge request if detected and will instruct developer to remove',
);
});
}); });
it('renders error text, if there is a duplicate license', async () => { it('renders error text, if there is a duplicate license', async () => {
...@@ -123,15 +136,12 @@ describe('AddLicenseForm', () => { ...@@ -123,15 +136,12 @@ describe('AddLicenseForm', () => {
expect(feedbackElement.text()).toBe('This license already exists in this project.'); expect(feedbackElement.text()).toBe('This license already exists in this project.');
}); });
it('shows radio button descriptions, if licenseComplianceDeniesMr feature flag is enabled', async () => { it('shows radio button descriptions', async () => {
wrapper = shallowMount(LicenseIssueBody, { wrapper = shallowMount(LicenseIssueBody, {
propsData: { propsData: {
managedLicenses: [{ name: 'FOO' }], managedLicenses: [{ name: 'FOO' }],
knownLicenses: KNOWN_LICENSES, knownLicenses: KNOWN_LICENSES,
}, },
provide: {
glFeatures: { licenseComplianceDeniesMr: true },
},
}); });
await Vue.nextTick(); await Vue.nextTick();
...@@ -145,15 +155,6 @@ describe('AddLicenseForm', () => { ...@@ -145,15 +155,6 @@ describe('AddLicenseForm', () => {
); );
}); });
it('does not show radio button descriptions, if licenseComplianceDeniesMr feature flag is disabled', () => {
createComponent({ managedLicenses: [{ name: 'FOO' }] });
wrapper.setData({ licenseName: 'FOO' });
return Vue.nextTick().then(() => {
expect(findRadioInputs().at(0).element).toMatchSnapshot();
expect(findRadioInputs().at(1).element).toMatchSnapshot();
});
});
it('disables submit, if the form is invalid', async () => { it('disables submit, if the form is invalid', async () => {
wrapper.setData({ licenseName: '' }); wrapper.setData({ licenseName: '' });
await Vue.nextTick(); await Vue.nextTick();
......
...@@ -66,7 +66,6 @@ const createComponent = ({ state, getters, props, actionMocks, isAdmin, options, ...@@ -66,7 +66,6 @@ const createComponent = ({ state, getters, props, actionMocks, isAdmin, options,
PaginatedList, PaginatedList,
}, },
provide: { provide: {
glFeatures: { licenseComplianceDeniesMr: false },
...provide, ...provide,
}, },
store: fakeStore, store: fakeStore,
...@@ -176,23 +175,15 @@ describe('License Management', () => { ...@@ -176,23 +175,15 @@ describe('License Management', () => {
}); });
}); });
describe.each([true, false])( it('should not show the developer only tooltip', () => {
'when licenseComplianceDeniesMr feature flag is %p', createComponent({
(licenseComplianceDeniesMr) => { state: { isLoadingManagedLicenses: false },
it('should not show the developer only tooltip', () => { isAdmin: true,
createComponent({ });
state: { isLoadingManagedLicenses: false },
isAdmin: true, expect(findIcon().exists()).toBe(false);
provide: { expect(findPopover().exists()).toBe(false);
glFeatures: { licenseComplianceDeniesMr }, });
},
});
expect(findIcon().exists()).toBe(false);
expect(findPopover().exists()).toBe(false);
});
},
);
}); });
describe('when developer', () => { describe('when developer', () => {
...@@ -232,27 +223,15 @@ describe('License Management', () => { ...@@ -232,27 +223,15 @@ describe('License Management', () => {
}); });
}); });
describe.each` it('should show the developer only tooltip', () => {
licenseComplianceDeniesMr | should createComponent({
${true} | ${'should'} state: { isLoadingManagedLicenses: false },
${false} | ${'should not'} isAdmin: false,
`( });
'when licenseComplianceDeniesMr feature flag is $licenseComplianceDeniesMr',
({ licenseComplianceDeniesMr, should }) => { expect(findIcon().exists()).toBe(true);
it(`${should} show the developer only tooltip`, () => { expect(findPopover().exists()).toBe(true);
createComponent({ });
state: { isLoadingManagedLicenses: false },
isAdmin: false,
provide: {
glFeatures: { licenseComplianceDeniesMr },
},
});
expect(findIcon().exists()).toBe(licenseComplianceDeniesMr);
expect(findPopover().exists()).toBe(licenseComplianceDeniesMr);
});
},
);
}); });
}); });
}); });
...@@ -20748,9 +20748,6 @@ msgstr "" ...@@ -20748,9 +20748,6 @@ msgstr ""
msgid "Licenses|Detected licenses that are out-of-compliance with the project's assigned policies" msgid "Licenses|Detected licenses that are out-of-compliance with the project's assigned policies"
msgstr "" msgstr ""
msgid "Licenses|Disallow Merge request if detected and will instruct the developer to remove"
msgstr ""
msgid "Licenses|Displays licenses detected in the project, based on the %{linkStart}latest successful%{linkEnd} scan" msgid "Licenses|Displays licenses detected in the project, based on the %{linkStart}latest successful%{linkEnd} scan"
msgstr "" msgstr ""
...@@ -20778,6 +20775,9 @@ msgstr "" ...@@ -20778,6 +20775,9 @@ msgstr ""
msgid "Licenses|The license list details information about the licenses used within your project." msgid "Licenses|The license list details information about the licenses used within your project."
msgstr "" msgstr ""
msgid "Licenses|Unacceptable license, if detected it will disallow a merge request until it's removed"
msgstr ""
msgid "Licenses|View license details for your project" msgid "Licenses|View license details for your project"
msgstr "" msgstr ""
......
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