Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ba7bb7ab
Commit
ba7bb7ab
authored
Jul 01, 2020
by
Fernando
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rework feature flag logic
* Use mixin approach
parent
ede39d83
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
14 deletions
+15
-14
ee/app/assets/javascripts/vue_shared/license_compliance/license_management.vue
...ipts/vue_shared/license_compliance/license_management.vue
+3
-1
ee/app/controllers/projects/licenses_controller.rb
ee/app/controllers/projects/licenses_controller.rb
+1
-1
ee/spec/frontend/vue_shared/license_compliance/license_management_spec.js
.../vue_shared/license_compliance/license_management_spec.js
+11
-12
No files found.
ee/app/assets/javascripts/vue_shared/license_compliance/license_management.vue
View file @
ba7bb7ab
<
script
>
import
glFeatureFlagsMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
import
{
mapState
,
mapGetters
,
mapActions
}
from
'
vuex
'
;
import
{
GlButton
,
GlLoadingIcon
,
GlIcon
,
GlPopover
}
from
'
@gitlab/ui
'
;
import
{
s__
}
from
'
~/locale
'
;
...
...
@@ -11,6 +12,7 @@ import DeleteConfirmationModal from './components/delete_confirmation_modal.vue'
import
PaginatedList
from
'
~/vue_shared/components/paginated_list.vue
'
;
import
LicenseApprovals
from
'
../../approvals/components/license_compliance/index.vue
'
;
export
default
{
name
:
'
LicenseManagement
'
,
components
:
{
...
...
@@ -49,7 +51,7 @@ export default {
return
this
.
isLoadingManagedLicenses
&&
!
this
.
hasPendingLicenses
;
},
isTooltipEnabled
()
{
return
Boolean
(
gon
?.
features
?
.
licenseComplianceDeniesMr
);
return
Boolean
(
this
.
glFeatures
.
licenseComplianceDeniesMr
);
},
},
watch
:
{
...
...
ee/app/controllers/projects/licenses_controller.rb
View file @
ba7bb7ab
...
...
@@ -5,8 +5,8 @@ module Projects
before_action
:authorize_read_licenses!
,
only:
[
:index
]
before_action
:authorize_admin_software_license_policy!
,
only:
[
:create
,
:update
]
before_action
do
push_frontend_feature_flag
(
:license_policy_list
,
default_enabled:
true
)
push_frontend_feature_flag
(
:license_approvals
,
default_enabled:
false
)
push_frontend_feature_flag
(
:license_compliance_denies_mr
,
default_enabled:
false
)
end
def
index
...
...
ee/spec/frontend/vue_shared/license_compliance/license_management_spec.js
View file @
ba7bb7ab
...
...
@@ -30,7 +30,7 @@ const PaginatedListMock = {
const
noop
=
()
=>
{};
const
createComponent
=
({
state
,
getters
,
props
,
actionMocks
,
isAdmin
,
options
})
=>
{
const
createComponent
=
({
state
,
getters
,
props
,
actionMocks
,
isAdmin
,
options
,
provide
})
=>
{
const
fakeStore
=
new
Vuex
.
Store
({
modules
:
{
licenseManagement
:
{
...
...
@@ -63,16 +63,16 @@ const createComponent = ({ state, getters, props, actionMocks, isAdmin, options
stubs
:
{
PaginatedList
:
PaginatedListMock
,
},
provide
:
{
glFeatures
:
{
licenseComplianceDeniesMr
:
false
},
...
provide
},
store
:
fakeStore
,
...
options
,
});
};
describe
(
'
License Management
'
,
()
=>
{
beforeEach
(()
=>
{
window
.
gon
=
{
features
:
{
licenseComplianceDeniesMr
:
false
}
};
});
afterEach
(()
=>
{
wrapper
.
destroy
();
wrapper
=
null
;
...
...
@@ -197,11 +197,12 @@ describe('License Management', () => {
describe
(
'
when licenseComplianceDeniesMr feature flag enabled
'
,
()
=>
{
it
(
'
should not show the developer only tooltip
'
,
()
=>
{
window
.
gon
.
features
.
licenseComplianceDeniesMr
=
true
;
createComponent
({
state
:
{
isLoadingManagedLicenses
:
false
},
isAdmin
:
true
,
provide
:
{
glFeatures
:
{
licenseComplianceDeniesMr
:
true
},
},
});
expect
(
wrapper
.
find
(
GlIcon
).
exists
()).
toBe
(
false
);
...
...
@@ -211,8 +212,6 @@ describe('License Management', () => {
describe
(
'
when licenseComplianceDeniesMr feature flag disabled
'
,
()
=>
{
it
(
'
should not show the developer only tooltip
'
,
()
=>
{
window
.
gon
.
features
.
licenseComplianceDeniesMr
=
false
;
createComponent
({
state
:
{
isLoadingManagedLicenses
:
false
},
isAdmin
:
true
,
...
...
@@ -263,11 +262,13 @@ describe('License Management', () => {
describe
(
'
when licenseComplianceDeniesMr feature flag enabled
'
,
()
=>
{
it
(
'
should show the developer only tooltip
'
,
()
=>
{
window
.
gon
.
features
.
licenseComplianceDeniesMr
=
true
;
createComponent
({
state
:
{
isLoadingManagedLicenses
:
false
},
isAdmin
:
false
,
provide
:
{
glFeatures
:
{
licenseComplianceDeniesMr
:
true
},
},
});
expect
(
wrapper
.
find
(
GlIcon
).
exists
()).
toBe
(
true
);
...
...
@@ -277,8 +278,6 @@ describe('License Management', () => {
describe
(
'
when licenseComplianceDeniesMr feature flag disabled
'
,
()
=>
{
it
(
'
should not show the developer only tooltip
'
,
()
=>
{
window
.
gon
.
features
.
licenseComplianceDeniesMr
=
false
;
createComponent
({
state
:
{
isLoadingManagedLicenses
:
false
},
isAdmin
:
false
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment